def create_voltage_signal(self, list_of_rois): filled_mask = OriginalImage = np.zeros((1000, 1000)) for roi in list_of_rois: filled_mask += polygon2mask((1000, 1000), (roi + 5) * 100) filled_mask = (filled_mask > 0).astype(int).transpose() fig, axs = plt.subplots(1, 1) axs.imshow(filled_mask) scanning_voltage = 5 points_per_contour = int(self.points_per_contour_textbox.text()) sampling_rate = int(self.sampling_rate_textbox.text()) contourScanningSignal = ProcessImage.mask_to_contourScanning_DAQsignals( filled_mask, OriginalImage, scanning_voltage, points_per_contour, sampling_rate, repeats=1) contourScanningSignal = np.vstack( (contourScanningSignal[0][0], contourScanningSignal[1][0])) self.galvoThread = pmtimagingTest_contour() self.galvoThread.setWave_contourscan(sampling_rate, contourScanningSignal, points_per_contour)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # os.chdir('./')# Set directory to current folder. self.setFont(QFont("Arial")) self.setMinimumSize(1200,850) self.setWindowTitle("PMTWidget") self.layout = QGridLayout(self) #------------------------Initiating class------------------- self.pmtTest = pmtimagingTest() self.pmtTest_contour = pmtimagingTest_contour() self.savedirectory = r'M:\tnw\ist\do\projects\Neurophotonics\Brinkslab\Data\Octoscope\pmt_image_default_dump' self.prefixtextboxtext = '_fromGalvoWidget' #************************************************************************************************************************************** #-------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------GUI for PMT tab------------------------------------------------------------ #-------------------------------------------------------------------------------------------------------------------------------------- #************************************************************************************************************************************** pmtimageContainer = QGroupBox("PMT image") self.pmtimageLayout = QGridLayout() self.pmtvideoWidget = pg.ImageView() self.pmtvideoWidget.ui.roiBtn.hide() self.pmtvideoWidget.ui.menuBtn.hide() self.pmtvideoWidget.resize(400,400) self.pmtimageLayout.addWidget(self.pmtvideoWidget, 0, 0) pmtroiContainer = QGroupBox("PMT ROI") self.pmtimageroiLayout = QGridLayout() self.pmt_roiwidget = pg.GraphicsLayoutWidget() self.pmt_roiwidget.resize(150,150) self.pmt_roiwidget.addLabel('ROI', row=0, col=0) # create ROI self.vb_2 = self.pmt_roiwidget.addViewBox(row=1, col=0, lockAspect=True, colspan=1) self.vb_2.name = 'ROI' self.pmtimgroi = pg.ImageItem() self.vb_2.addItem(self.pmtimgroi) #self.roi = pg.RectROI([20, 20], [20, 20], pen=(0,9)) #r1 = QRectF(0, 0, 895, 500) ROIpen = QPen() # creates a default pen ROIpen.setStyle(Qt.DashDotLine) ROIpen.setWidth(0.5) ROIpen.setBrush(QColor(0,161,255)) self.roi = pg.PolyLineROI([[0,0], [80,0], [80,80], [0,80]], closed=True, pen=ROIpen)#, maxBounds=r1 #self.roi.addScaleHandle([1,0], [1, 0]) self.roi.sigHoverEvent.connect(lambda: self.show_handle_num()) # update handle numbers self.pmtvb = self.pmtvideoWidget.getView() self.pmtimageitem = self.pmtvideoWidget.getImageItem() self.pmtvb.addItem(self.roi)# add ROIs to main image self.pmtimageroiLayout.addWidget(self.pmt_roiwidget, 0, 0) pmtimageContainer.setMinimumWidth(850) pmtroiContainer.setMaximumHeight(380) # pmtroiContainer.setMaximumWidth(300) pmtimageContainer.setLayout(self.pmtimageLayout) pmtroiContainer.setLayout(self.pmtimageroiLayout) #----------------------------Contour----------------------------------- pmtContourContainer = QGroupBox("Contour selection") pmtContourContainer.setFixedWidth(280) self.pmtContourLayout = QGridLayout() #contour_Description = QLabel("Handle number updates when parking mouse cursor upon ROI. Points in contour are divided evenly between handles.") #contour_Description.setStyleSheet('color: blue') #self.pmtContourLayout.addWidget(contour_Description,0,0) self.pmt_handlenum_Label = QLabel("Handle number: ") self.pmtContourLayout.addWidget(self.pmt_handlenum_Label,1,0) self.contour_strategy = QComboBox() self.contour_strategy.addItems(['Manual','Uniform']) self.pmtContourLayout.addWidget(self.contour_strategy, 1, 1) self.pointsinContour = QSpinBox(self) self.pointsinContour.setMinimum(1) self.pointsinContour.setMaximum(1000) self.pointsinContour.setValue(100) self.pointsinContour.setSingleStep(100) self.pmtContourLayout.addWidget(self.pointsinContour, 2, 1) self.pmtContourLayout.addWidget(QLabel("Points in contour:"), 2, 0) self.contour_samprate = QSpinBox(self) self.contour_samprate.setMinimum(0) self.contour_samprate.setMaximum(1000000) self.contour_samprate.setValue(50000) self.contour_samprate.setSingleStep(50000) self.pmtContourLayout.addWidget(self.contour_samprate, 3, 1) self.pmtContourLayout.addWidget(QLabel("Sampling rate:"), 3, 0) self.generate_contour_sacn = StylishQT.generateButton() self.pmtContourLayout.addWidget(self.generate_contour_sacn, 4, 1) self.generate_contour_sacn.clicked.connect(lambda: self.generate_contour()) self.do_contour_sacn = StylishQT.runButton("Contour") self.do_contour_sacn.setFixedHeight(32) self.pmtContourLayout.addWidget(self.do_contour_sacn, 5, 0) self.do_contour_sacn.clicked.connect(lambda:self.buttonenabled('contourscan', 'start')) self.do_contour_sacn.clicked.connect(lambda: self.measure_pmt_contourscan()) self.stopButton_contour = StylishQT.stop_deleteButton() self.stopButton_contour.setFixedHeight(32) self.stopButton_contour.clicked.connect(lambda:self.buttonenabled('contourscan', 'stop')) self.stopButton_contour.clicked.connect(lambda: self.stopMeasurement_pmt_contour()) self.stopButton_contour.setEnabled(False) self.pmtContourLayout.addWidget(self.stopButton_contour, 5, 1) pmtContourContainer.setLayout(self.pmtContourLayout) #----------------------------Control----------------------------------- controlContainer = QGroupBox("Galvo Scanning Panel") controlContainer.setFixedWidth(280) self.controlLayout = QGridLayout() self.pmt_fps_Label = QLabel("Per frame: ") self.controlLayout.addWidget(self.pmt_fps_Label, 5, 0) self.saveButton_pmt = StylishQT.saveButton() self.saveButton_pmt.clicked.connect(lambda: self.saveimage_pmt()) self.controlLayout.addWidget(self.saveButton_pmt, 5, 1) self.startButton_pmt = StylishQT.runButton("") self.startButton_pmt.setFixedHeight(32) self.startButton_pmt.setCheckable(True) self.startButton_pmt.clicked.connect(lambda:self.buttonenabled('rasterscan', 'start')) self.startButton_pmt.clicked.connect(lambda: self.measure_pmt()) self.controlLayout.addWidget(self.startButton_pmt, 6, 0) self.stopButton = StylishQT.stop_deleteButton() self.stopButton.setFixedHeight(32) self.stopButton.clicked.connect(lambda:self.buttonenabled('rasterscan', 'stop')) self.stopButton.clicked.connect(lambda: self.stopMeasurement_pmt()) self.stopButton.setEnabled(False) self.controlLayout.addWidget(self.stopButton, 6, 1) #-----------------------------------Galvo scanning------------------------------------------------------------------------ self.textboxAA_pmt = QSpinBox(self) self.textboxAA_pmt.setMinimum(0) self.textboxAA_pmt.setMaximum(1000000) self.textboxAA_pmt.setValue(500000) self.textboxAA_pmt.setSingleStep(100000) self.controlLayout.addWidget(self.textboxAA_pmt, 1, 1) self.controlLayout.addWidget(QLabel("Sampling rate:"), 1, 0) #self.controlLayout.addWidget(QLabel("Galvo raster scanning : "), 1, 0) self.textbox1B_pmt = QSpinBox(self) self.textbox1B_pmt.setMinimum(-10) self.textbox1B_pmt.setMaximum(10) self.textbox1B_pmt.setValue(3) self.textbox1B_pmt.setSingleStep(1) self.controlLayout.addWidget(self.textbox1B_pmt, 2, 1) self.controlLayout.addWidget(QLabel("Volt range:"), 2, 0) self.Scanning_pixel_num_combobox = QSpinBox(self) self.Scanning_pixel_num_combobox.setMinimum(0) self.Scanning_pixel_num_combobox.setMaximum(1000) self.Scanning_pixel_num_combobox.setValue(500) self.Scanning_pixel_num_combobox.setSingleStep(244) self.controlLayout.addWidget(self.Scanning_pixel_num_combobox, 3, 1) self.controlLayout.addWidget(QLabel("Pixel number:"), 3, 0) self.textbox1H_pmt = QSpinBox(self) self.textbox1H_pmt.setMinimum(1) self.textbox1H_pmt.setMaximum(20) self.textbox1H_pmt.setValue(1) self.textbox1H_pmt.setSingleStep(1) self.controlLayout.addWidget(self.textbox1H_pmt, 4, 1) self.controlLayout.addWidget(QLabel("average over:"), 4, 0) controlContainer.setLayout(self.controlLayout) #---------------------------Set tab1 layout--------------------------- # pmtmaster = QGridLayout() self.layout.addWidget(pmtimageContainer, 0,0,3,1) self.layout.addWidget(pmtroiContainer,1,1) self.layout.addWidget(pmtContourContainer,2,1) self.layout.addWidget(controlContainer,0,1)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) os.chdir(os.path.dirname( sys.argv[0])) # Set directory to current folder. self.setWindowIcon(QIcon('./Icons/Icon.png')) self.setFont(QFont("Arial")) # print(str(os.getcwd())+'Tupo') # sys.stdout = EmittingStream(textWritten = self.normalOutputWritten) # Uncomment here to link console output to textedit. # sys.stdout = sys.__stdout__ #------------------------Initiating patchclamp class------------------- self.pmtTest = pmtimagingTest() self.pmtTest_contour = pmtimagingTest_contour() self.OC = 0.1 #---------------------------------------------------------------------- #----------------------------------GUI--------------------------------- #---------------------------------------------------------------------- self.setMinimumSize(1710, 1200) self.setWindowTitle("Tupolev v1.0") self.layout = QGridLayout(self) # Setting tabs self.tabs = QTabWidget() self.Galvo_WidgetInstance = GalvoWidget.PMTWidget.PMTWidgetUI() self.Waveformer_WidgetInstance = NIDAQ.Waveformer_for_screening.WaveformGenerator( ) self.PatchClamp_WidgetInstance = PatchClamp.ui_patchclamp_sealtest.PatchclampSealTestUI( ) #self.tab4 = ui_camera_lab_5.CameraUI() self.Analysis_WidgetInstance = ImageAnalysis.AnalysisWidget.AnalysisWidgetUI( ) # Add tabs self.tabs.addTab(self.Galvo_WidgetInstance, "PMT imaging") self.tabs.addTab(self.Waveformer_WidgetInstance, "Waveform") self.tabs.addTab(self.PatchClamp_WidgetInstance, "Patch clamp") #self.tabs.addTab(self.tab4,"Camera") self.tabs.addTab(self.Analysis_WidgetInstance, "Image analysis") self.savedirectory = os.path.join( os.path.expanduser("~"), "Desktop") #'M:/tnw/ist/do/projects/Neurophotonics/Brinkslab/Data' # Establishing communication betweeb widgets. self.Galvo_WidgetInstance.SignalForContourScanning.connect( self.PassVariable_GalvoWidget2Waveformer) self.Galvo_WidgetInstance.MessageBack.connect(self.normalOutputWritten) self.Analysis_WidgetInstance.MessageBack.connect( self.normalOutputWritten) #************************************************************************************************************************************** #-------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------GUI for set directory------------------------------------------------------ #-------------------------------------------------------------------------------------------------------------------------------------- #************************************************************************************************************************************** setdirectoryContainer = QGroupBox("Set directory") self.setdirectorycontrolLayout = QGridLayout() self.saving_prefix = '' self.savedirectorytextbox = QLineEdit(self) self.savedirectorytextbox.setPlaceholderText('Saving directory') self.setdirectorycontrolLayout.addWidget(self.savedirectorytextbox, 0, 1) self.prefixtextbox = QLineEdit(self) self.prefixtextbox.setPlaceholderText('Prefix') self.setdirectorycontrolLayout.addWidget(self.prefixtextbox, 0, 0) #self.setdirectorycontrolLayout.addWidget(QLabel("Saving prefix:"), 0, 0) self.toolButtonOpenDialog = QtWidgets.QPushButton('Click me!') self.toolButtonOpenDialog.setStyleSheet( "QPushButton {color:teal;background-color: pink; border-style: outset;border-radius: 5px;border-width: 2px;font: bold 14px;padding: 2px}" "QPushButton:pressed {color:yellow;background-color: pink; border-style: outset;border-radius: 5px;border-width: 2px;font: bold 14px;padding: 2px}" ) self.toolButtonOpenDialog.setObjectName("toolButtonOpenDialog") self.toolButtonOpenDialog.clicked.connect(self._open_file_dialog) self.setdirectorycontrolLayout.addWidget(self.toolButtonOpenDialog, 0, 2) setdirectoryContainer.setLayout(self.setdirectorycontrolLayout) setdirectoryContainer.setMaximumHeight(70) self.layout.addWidget(setdirectoryContainer, 0, 0) #************************************************************************************************************************************** #-------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------GUI for AOTF--------------------------------------------------------------- #-------------------------------------------------------------------------------------------------------------------------------------- #************************************************************************************************************************************** AOTFcontrolContainer = QGroupBox("AOTF control") self.AOTFcontrolLayout = QGridLayout() self.slider640 = QSlider(Qt.Horizontal) self.slider640.setMinimum(0) self.slider640.setMaximum(500) self.slider640.setTickPosition(QSlider.TicksBothSides) self.slider640.setTickInterval(100) self.slider640.setSingleStep(1) self.line640 = QLineEdit(self) self.line640.setFixedWidth(60) self.slider640.sliderReleased.connect( lambda: self.updatelinevalue(640)) self.slider640.sliderReleased.connect( lambda: self.execute_tread_single_sample_analog('640AO')) self.line640.returnPressed.connect(lambda: self.updatesider(640)) self.ICON_off_AOTF = "./Icons/AOTF_off.png" self.AOTF_red_iconlabel = QLabel(self) self.AOTF_red_iconlabel.setPixmap(QPixmap(self.ICON_off_AOTF)) self.AOTFcontrolLayout.addWidget(self.AOTF_red_iconlabel, 0, 0) self.switchbutton_640 = QPushButton("640") self.switchbutton_640.setStyleSheet( "QPushButton {color:white;background-color: red; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:black;background-color: red; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.switchbutton_640.setCheckable(True) #self.holdingbutton.toggle() self.switchbutton_640.clicked.connect( lambda: self.execute_tread_single_sample_digital('640blanking')) self.switchbutton_640.clicked.connect( lambda: self.change_AOTF_icon('640blanking')) self.AOTFcontrolLayout.addWidget(self.switchbutton_640, 0, 1) self.slider532 = QSlider(Qt.Horizontal) self.slider532.setMinimum(0) self.slider532.setMaximum(500) self.slider532.setTickPosition(QSlider.TicksBothSides) self.slider532.setTickInterval(100) self.slider532.setSingleStep(1) self.line532 = QLineEdit(self) self.line532.setFixedWidth(60) self.slider532.sliderReleased.connect( lambda: self.updatelinevalue(532)) self.slider532.sliderReleased.connect( lambda: self.execute_tread_single_sample_analog('532AO')) self.line532.returnPressed.connect(lambda: self.updatesider(532)) self.AOTF_green_iconlabel = QLabel(self) self.AOTF_green_iconlabel.setPixmap(QPixmap(self.ICON_off_AOTF)) self.AOTFcontrolLayout.addWidget(self.AOTF_green_iconlabel, 1, 0) self.switchbutton_532 = QPushButton("532") self.switchbutton_532.setStyleSheet( "QPushButton {color:white;background-color: green; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:black;background-color: green; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.switchbutton_532.setCheckable(True) #self.holdingbutton.toggle() self.switchbutton_532.clicked.connect( lambda: self.execute_tread_single_sample_digital('532blanking')) self.switchbutton_532.clicked.connect( lambda: self.change_AOTF_icon('532blanking')) self.AOTFcontrolLayout.addWidget(self.switchbutton_532, 1, 1) self.slider488 = QSlider(Qt.Horizontal) self.slider488.setMinimum(0) self.slider488.setMaximum(500) self.slider488.setTickPosition(QSlider.TicksBothSides) self.slider488.setTickInterval(100) self.slider488.setSingleStep(1) self.line488 = QLineEdit(self) self.line488.setFixedWidth(60) self.slider488.sliderReleased.connect( lambda: self.updatelinevalue(488)) self.slider488.sliderReleased.connect( lambda: self.execute_tread_single_sample_analog('488AO')) self.line488.returnPressed.connect(lambda: self.updatesider(488)) self.AOTF_blue_iconlabel = QLabel(self) self.AOTF_blue_iconlabel.setPixmap(QPixmap(self.ICON_off_AOTF)) self.AOTFcontrolLayout.addWidget(self.AOTF_blue_iconlabel, 2, 0) self.switchbutton_488 = QPushButton("488") self.switchbutton_488.setStyleSheet( "QPushButton {color:white;background-color: blue; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:black;background-color: blue; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.switchbutton_488.setCheckable(True) #self.holdingbutton.toggle() self.switchbutton_488.clicked.connect( lambda: self.execute_tread_single_sample_digital('488blanking')) self.switchbutton_488.clicked.connect( lambda: self.change_AOTF_icon('488blanking')) self.AOTFcontrolLayout.addWidget(self.switchbutton_488, 2, 1) self.AOTFcontrolLayout.addWidget(self.slider640, 0, 2) self.AOTFcontrolLayout.addWidget(self.line640, 0, 3) self.AOTFcontrolLayout.addWidget(self.slider532, 1, 2) self.AOTFcontrolLayout.addWidget(self.line532, 1, 3) self.AOTFcontrolLayout.addWidget(self.slider488, 2, 2) self.AOTFcontrolLayout.addWidget(self.line488, 2, 3) AOTFcontrolContainer.setLayout(self.AOTFcontrolLayout) AOTFcontrolContainer.setMaximumHeight(300) self.layout.addWidget(AOTFcontrolContainer, 1, 0) #************************************************************************************************************************************** #-------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------GUI for Stage-------------------------------------------------------------- #-------------------------------------------------------------------------------------------------------------------------------------- #************************************************************************************************************************************** stagecontrolContainer = QGroupBox("Stage control") self.stagecontrolLayout = QGridLayout() self.stage_upwards = QPushButton("↑") self.stage_upwards.setStyleSheet( "QPushButton {color:white;background-color: Olive; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.stagecontrolLayout.addWidget(self.stage_upwards, 1, 2) self.stage_upwards.clicked.connect( lambda: self.sample_stage_move_upwards()) self.stage_upwards.setShortcut('w') self.stage_left = QPushButton("←") self.stage_left.setStyleSheet( "QPushButton {color:white;background-color: Olive; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.stagecontrolLayout.addWidget(self.stage_left, 2, 1) self.stage_left.clicked.connect( lambda: self.sample_stage_move_leftwards()) self.stage_left.setShortcut('a') self.stage_right = QPushButton("→") self.stage_right.setStyleSheet( "QPushButton {color:white;background-color: Olive; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.stagecontrolLayout.addWidget(self.stage_right, 2, 3) self.stage_right.clicked.connect( lambda: self.sample_stage_move_rightwards()) self.stage_right.setShortcut('d') self.stage_down = QPushButton("↓") self.stage_down.setStyleSheet( "QPushButton {color:white;background-color: Olive; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.stagecontrolLayout.addWidget(self.stage_down, 2, 2) self.stage_down.clicked.connect( lambda: self.sample_stage_move_downwards()) self.stage_down.setShortcut('s') self.stage_speed = QSpinBox(self) self.stage_speed.setMinimum(-10000) self.stage_speed.setMaximum(10000) self.stage_speed.setValue(300) self.stage_speed.setSingleStep(100) self.stagecontrolLayout.addWidget(self.stage_speed, 0, 1) self.stagecontrolLayout.addWidget(QLabel("Moving speed:"), 0, 0) self.led_Label = QLabel("White LED: ") self.stagecontrolLayout.addWidget(self.led_Label, 0, 2) self.switchbutton_LED = QPushButton() #self.switchbutton_LED.setStyleSheet("QPushButton {color:white;background-color: blue; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" #"QPushButton:pressed {color:black;background-color: blue; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}") self.switchbutton_LED.setCheckable(True) self.switchbutton_LED.setIcon(QIcon('./Icons/AOTF_off.png')) #self.holdingbutton.toggle() self.switchbutton_LED.clicked.connect( lambda: self.execute_tread_single_sample_digital('LED')) self.switchbutton_LED.clicked.connect( lambda: self.change_AOTF_icon('LED')) self.stagecontrolLayout.addWidget(self.switchbutton_LED, 0, 3) self.stage_current_pos_Label = QLabel("Current position: ") self.stagecontrolLayout.addWidget(self.stage_current_pos_Label, 1, 0) self.stage_goto = QPushButton("Move to:") self.stage_goto.setStyleSheet( "QPushButton {color:white;background-color: blue; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.stagecontrolLayout.addWidget(self.stage_goto, 3, 0) self.stage_goto.clicked.connect( lambda: self.sample_stage_move_towards()) self.stage_goto_x = QLineEdit(self) self.stage_goto_x.setFixedWidth(60) self.stagecontrolLayout.addWidget(self.stage_goto_x, 3, 1) self.stage_goto_y = QLineEdit(self) self.stage_goto_y.setFixedWidth(60) self.stagecontrolLayout.addWidget(self.stage_goto_y, 3, 2) self.stagecontrolLayout.addWidget( QLabel('Click arrow to enable WASD keyboard control'), 4, 0, 1, 3) stagecontrolContainer.setLayout(self.stagecontrolLayout) stagecontrolContainer.setMaximumHeight(300) self.layout.addWidget(stagecontrolContainer, 2, 0) #************************************************************************************************************************************** #-------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------GUI for Filter movement---------------------------------------------------- #-------------------------------------------------------------------------------------------------------------------------------------- #************************************************************************************************************************************** ND_filtercontrolContainer = QGroupBox("ND filter control") self.NDfiltercontrolLayout = QGridLayout() bGBackupFromIntExt = QButtonGroup(self) self.filter1_pos0 = QPushButton('0') self.filter1_pos0.setCheckable(True) bGBackupFromIntExt.addButton(self.filter1_pos0) self.NDfiltercontrolLayout.addWidget(self.filter1_pos0, 0, 1) self.filter1_pos0.clicked.connect( lambda: self.filter_move_towards("COM9", 0)) self.filter1_pos1 = QPushButton('1') self.filter1_pos1.setCheckable(True) bGBackupFromIntExt.addButton(self.filter1_pos1) self.NDfiltercontrolLayout.addWidget(self.filter1_pos1, 0, 2) self.filter1_pos1.clicked.connect( lambda: self.filter_move_towards("COM9", 1)) self.filter1_pos2 = QPushButton('2') self.filter1_pos2.setCheckable(True) bGBackupFromIntExt.addButton(self.filter1_pos2) self.NDfiltercontrolLayout.addWidget(self.filter1_pos2, 0, 3) self.filter1_pos2.clicked.connect( lambda: self.filter_move_towards("COM9", 2)) self.filter1_pos3 = QPushButton('3') self.filter1_pos3.setCheckable(True) bGBackupFromIntExt.addButton(self.filter1_pos3) self.NDfiltercontrolLayout.addWidget(self.filter1_pos3, 0, 4) self.filter1_pos3.clicked.connect( lambda: self.filter_move_towards("COM9", 3)) self.NDfiltercontrolLayout.addWidget(QLabel('Filter-1 pos: '), 0, 0) self.NDfiltercontrolLayout.addWidget(QLabel('Filter-2 pos: '), 1, 0) bGBackupFromIntExt_1 = QButtonGroup(self) self.filter2_pos0 = QPushButton('0') self.filter2_pos0.setCheckable(True) bGBackupFromIntExt_1.addButton(self.filter2_pos0) self.NDfiltercontrolLayout.addWidget(self.filter2_pos0, 1, 1) self.filter2_pos0.clicked.connect( lambda: self.filter_move_towards("COM7", 0)) self.filter2_pos1 = QPushButton('0.1') self.filter2_pos1.setCheckable(True) bGBackupFromIntExt_1.addButton(self.filter2_pos1) self.NDfiltercontrolLayout.addWidget(self.filter2_pos1, 1, 2) self.filter2_pos1.clicked.connect( lambda: self.filter_move_towards("COM7", 1)) self.filter2_pos2 = QPushButton('0.3') self.filter2_pos2.setCheckable(True) bGBackupFromIntExt_1.addButton(self.filter2_pos2) self.NDfiltercontrolLayout.addWidget(self.filter2_pos2, 1, 3) self.filter2_pos2.clicked.connect( lambda: self.filter_move_towards("COM7", 2)) self.filter2_pos3 = QPushButton('0.5') self.filter2_pos3.setCheckable(True) bGBackupFromIntExt_1.addButton(self.filter2_pos3) self.NDfiltercontrolLayout.addWidget(self.filter2_pos3, 1, 4) self.filter2_pos3.clicked.connect( lambda: self.filter_move_towards("COM7", 3)) ND_filtercontrolContainer.setLayout(self.NDfiltercontrolLayout) ND_filtercontrolContainer.setMaximumHeight(200) self.layout.addWidget(ND_filtercontrolContainer, 3, 0) #************************************************************************************************************************************** #-------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------GUI for Objective Motor---------------------------------------------------- #-------------------------------------------------------------------------------------------------------------------------------------- #************************************************************************************************************************************** # Movement based on relative positions. ObjMotorcontrolContainer = QGroupBox("Objective motor control") self.ObjMotorcontrolLayout = QGridLayout() self.ObjMotor_connect = QPushButton("Connect") self.ObjMotor_connect.setStyleSheet( "QPushButton {color:white;background-color: green; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.ObjMotorcontrolLayout.addWidget(self.ObjMotor_connect, 0, 0) self.ObjMotor_connect.clicked.connect(lambda: self.ConnectMotor()) self.ObjMotor_disconnect = QPushButton("Disconnect") self.ObjMotor_disconnect.setStyleSheet( "QPushButton {color:white;background-color: firebrick; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.ObjMotorcontrolLayout.addWidget(self.ObjMotor_disconnect, 0, 1) self.ObjMotor_disconnect.clicked.connect( lambda: self.DisconnectMotor()) self.ObjMotor_upwards = QPushButton("↑") self.ObjMotor_upwards.setStyleSheet( "QPushButton {color:white;background-color: teal; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.ObjMotorcontrolLayout.addWidget(self.ObjMotor_upwards, 2, 2) self.ObjMotor_upwards.clicked.connect( lambda: self.Motor_move_upwards()) # self.ObjMotor_upwards.setShortcut('w') self.ObjMotor_down = QPushButton("↓") self.ObjMotor_down.setStyleSheet( "QPushButton {color:white;background-color: teal; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.ObjMotorcontrolLayout.addWidget(self.ObjMotor_down, 3, 2) self.ObjMotor_down.clicked.connect(lambda: self.Motor_move_downwards()) # self.stage_down.setShortcut('s') self.ObjMotor_target = QDoubleSpinBox(self) self.ObjMotor_target.setMinimum(-10000) self.ObjMotor_target.setMaximum(10000) self.ObjMotor_target.setDecimals(6) # self.ObjMotor_target.setValue(3.45) self.ObjMotor_target.setSingleStep(0.001) self.ObjMotorcontrolLayout.addWidget(self.ObjMotor_target, 1, 1) self.ObjMotorcontrolLayout.addWidget(QLabel("Target:"), 1, 0) self.ObjMotor_current_pos_Label = QLabel("Current position: ") self.ObjMotorcontrolLayout.addWidget(self.ObjMotor_current_pos_Label, 2, 0) self.ObjMotor_goto = QPushButton("Move") self.ObjMotor_goto.setStyleSheet( "QPushButton {color:white;background-color: blue; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" "QPushButton:pressed {color:red;background-color: white; border-style: outset;border-radius: 10px;border-width: 2px;font: bold 14px;padding: 6px}" ) self.ObjMotorcontrolLayout.addWidget(self.ObjMotor_goto, 1, 2) self.ObjMotor_goto.clicked.connect(self.MoveMotor) self.ObjMotor_step = QDoubleSpinBox(self) self.ObjMotor_step.setMinimum(-10000) self.ObjMotor_step.setMaximum(10000) self.ObjMotor_step.setDecimals(6) self.ObjMotor_step.setValue(0.001) self.ObjMotor_step.setSingleStep(0.001) self.ObjMotorcontrolLayout.addWidget(self.ObjMotor_step, 3, 1) self.ObjMotorcontrolLayout.addWidget(QLabel("Step: "), 3, 0) ObjMotorcontrolContainer.setLayout(self.ObjMotorcontrolLayout) ObjMotorcontrolContainer.setMaximumHeight(300) self.layout.addWidget(ObjMotorcontrolContainer, 4, 0) #************************************************************************************************************************************** #-------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------GUI for camera button------------------------------------------------------ #-------------------------------------------------------------------------------------------------------------------------------------- #************************************************************************************************************************************** self.open_cam = QPushButton('Open Camera') self.open_cam.clicked.connect(self.open_camera) self.layout.addWidget(self.open_cam, 5, 0) self.console_text_edit = QTextEdit() self.console_text_edit.setFontItalic(True) self.console_text_edit.setPlaceholderText('Notice board from console.') self.console_text_edit.setMaximumHeight(200) self.layout.addWidget(self.console_text_edit, 6, 0) #************************************************************************************************************************************** #self.setLayout(pmtmaster) self.layout.addWidget(self.tabs, 0, 1, 8, 4) self.setLayout(self.layout) '''