def createStatisticsDisplay(self, parentWidget): # Generate the widget self.statisticsWidget = qtw.QWidget() self.statisticsLayout = qtw.QVBoxLayout(self.statisticsWidget) # Populate all the informations self.statisticsGridWidget = qtw.QWidget() self.statisticsGridLayout = qtw.QGridLayout(self.statisticsGridWidget) # Mean PV current_row = 0 self.statisticsGridLayout.addWidget( CLabel('Mean PV:'), current_row, 0) self.meanValueLabel = qtw.QLabel() self.statisticsGridLayout.addWidget( self.meanValueLabel, current_row, 1) # Standard Deviation current_row += 1 self.statisticsGridLayout.addWidget( CLabel('St. Dev.:'), current_row, 0) self.standardDeviationLabel = qtw.QLabel() self.statisticsGridLayout.addWidget( self.standardDeviationLabel, current_row, 1) # Standard Deviation current_row += 1 self.statisticsGridLayout.addWidget( CLabel('Variations:'), current_row, 0) self.variationsLabel = qtw.QLabel() self.statisticsGridLayout.addWidget( self.variationsLabel, current_row, 1) self.statisticsGridWidget.setLayout(self.statisticsGridLayout) self.statisticsLayout.addWidget( self.statisticsGridWidget, alignment=qtc.Qt.AlignLeft) # Display the widget self.statisticsWidget.setLayout(self.statisticsLayout) parentWidget.addWidget(self.statisticsWidget)
def populateGeneral(self): # Metadata type if self.data_type == 'experiment': _metadata_type = 'EXPERIMENT' _, _file_name = os.path.split(self.file_path) elif self.data_type == 'fast_record': _metadata_type = 'FAST RECORD' _file_name, _ = os.path.split(self.file_path) _, _file_name = os.path.split(_file_name) self.generalInfosLayout.addWidget(CLabel(_metadata_type), alignment=qtc.Qt.AlignCenter) self.generalInfosLayout.addWidget(qtw.QLabel(_file_name), alignment=qtc.Qt.AlignCenter) # Populate all the informations self.generalGridWidget = qtw.QWidget() self.generalGridLayout = qtw.QGridLayout(self.generalGridWidget) for i, name in enumerate(self.data_general.keys()): # Name of the section self.generalGridLayout.addWidget(CLabel(name), i, 0) # Value of the section crt_value = qtw.QLabel(self.data_general[name]) self.generalGridLayout.addWidget(crt_value, i, 1) self.generalGridWidget.setLayout(self.generalGridLayout) self.generalInfosLayout.addWidget(self.generalGridWidget, alignment=qtc.Qt.AlignLeft)
def createInformationDisplay(self, parentWidget): # Generate the widget self.infoDisplayWidget = qtw.QWidget() self.infoDisplayLayout = qtw.QGridLayout(self.infoDisplayWidget) # Display the total number of frames current_row = 0 self.infoDisplayLayout.addWidget(CLabel("Total # frames:"), current_row, 0) self.infoDisplayLayout.addWidget(qtw.QLabel(str(self.max_n)), current_row, 1) # Display the final number of frames after average current_row += 1 self.infoDisplayLayout.addWidget(CLabel("# frames after averaging:"), current_row, 0) self.frameAfterLabel = qtw.QLabel("") self.infoDisplayLayout.addWidget(self.frameAfterLabel, current_row, 1) # Display the final number of frames after average current_row += 1 self.infoDisplayLayout.addWidget(CLabel("# frames lost:"), current_row, 0) self.frameLostLabel = qtw.QLabel("") self.infoDisplayLayout.addWidget(self.frameLostLabel, current_row, 1) # Display the widget self.infoDisplayWidget.setLayout(self.infoDisplayLayout) parentWidget.addWidget(self.infoDisplayWidget, alignment=qtc.Qt.AlignLeft)
def createResultDisplay(self, parentWidget): # Generate the widget self.resultDisplayWidget = qtw.QWidget() self.resultDisplayLayout = qtw.QGridLayout(self.resultDisplayWidget) current_row = 0 self.resultDisplayLayout.addWidget(CLabel('RESULTS'), current_row, 0, 1, 2) # Contrast current_row += 1 self.resultDisplayLayout.addWidget(CLabel('- Contrast:'), current_row, 0) self.contrastLabel = qtw.QLabel("") self.resultDisplayLayout.addWidget(self.contrastLabel, current_row, 1) # Signal-to-noise ratio current_row += 1 self.resultDisplayLayout.addWidget(CLabel('- SNR:'), current_row, 0) self.snrLabel = qtw.QLabel("") self.resultDisplayLayout.addWidget(self.snrLabel, current_row, 1) # Noise current_row += 1 self.resultDisplayLayout.addWidget(CLabel('- Noise:'), current_row, 0) self.noiseLabel = qtw.QLabel("") self.resultDisplayLayout.addWidget(self.noiseLabel, current_row, 1) # Display the widget self.resultDisplayWidget.setLayout(self.resultDisplayLayout) parentWidget.addWidget(self.resultDisplayWidget, alignment=qtc.Qt.AlignLeft)
def createScaleSettings(self, parentWidget): # Generate the widget self.scaleSettingsWidget = qtw.QWidget() self.scaleSettingsLayout = qtw.QGridLayout(self.scaleSettingsWidget) # Label for space scale current_row = 0 self.scaleSettingsLayout.addWidget(CLabel("Space Scale:"), current_row, 0, 1, 2) # Entry for the distance in pixel current_row += 1 self.scaleSettingsLayout.addWidget(qtw.QLabel("Distance in pixels"), current_row, 0) self.pixelDistanceEntry = qtw.QLineEdit() self.pixelDistanceEntry.setText(str( self.image_class.scale.space_scale)) self.scaleSettingsLayout.addWidget(self.pixelDistanceEntry, current_row, 1) # Entry for the real distance current_row += 1 self.scaleSettingsLayout.addWidget(qtw.QLabel("Known distance"), current_row, 0) self.knownDistanceEntry = qtw.QLineEdit() self.knownDistanceEntry.setText("1") self.scaleSettingsLayout.addWidget(self.knownDistanceEntry, current_row, 1) # Entry for the length unit current_row += 1 self.scaleSettingsLayout.addWidget(qtw.QLabel("Unit of length"), current_row, 0) self.lengthUnitEntry = qtw.QLineEdit() self.lengthUnitEntry.setText(self.image_class.scale.space_unit) self.scaleSettingsLayout.addWidget(self.lengthUnitEntry, current_row, 1) current_row += 1 self.scaleSettingsLayout.addWidget(CHorizontalSeparator(), current_row, 0, 1, 2) # Label for time scale current_row += 1 self.scaleSettingsLayout.addWidget(CLabel("Time Scale:"), current_row, 0, 1, 2) # Entry for the length unit current_row += 1 self.scaleSettingsLayout.addWidget(qtw.QLabel("Frame rate"), current_row, 0) self.frameRateEntry = qtw.QLineEdit() self.frameRateEntry.setText(str(self.image_class.scale.frame_rate)) self.scaleSettingsLayout.addWidget(self.frameRateEntry, current_row, 1) # Display the widget self.scaleSettingsWidget.setLayout(self.scaleSettingsLayout) parentWidget.addWidget(self.scaleSettingsWidget)
def createImageInfosDisplay(self, parentWidget): # Generate the widget self.imageInfoWidget = qtw.QWidget() self.imageInfoLayout = qtw.QVBoxLayout(self.imageInfoWidget) # Populate all the informations self.infoGridWidget = qtw.QWidget() self.infoGridLayout = qtw.QGridLayout(self.infoGridWidget) # Number of images self.imageNumberLabel = qtw.QLabel('') self.infoGridLayout.addWidget(CLabel('Number of image(s):'), 0, 0) self.infoGridLayout.addWidget(self.imageNumberLabel, 0, 1) # Image size self.imageSizeLabel = qtw.QLabel('') self.infoGridLayout.addWidget(CLabel('Image Size:'), 1, 0) self.infoGridLayout.addWidget(self.imageSizeLabel, 1, 1) # Image bitness self.imageBitsLabel = qtw.QLabel('') self.infoGridLayout.addWidget(CLabel('Image Bitness:'), 2, 0) self.infoGridLayout.addWidget(self.imageBitsLabel, 2, 1) # Display the grid self.infoGridWidget.setLayout(self.infoGridLayout) self.imageInfoLayout.addWidget(self.infoGridWidget, alignment=qtc.Qt.AlignLeft) # Crop selection self.cropCheckBox = qtw.QCheckBox('Crop the image?') self.cropCheckBox.setEnabled(False) self.imageInfoLayout.addWidget(self.cropCheckBox) # Signed bit correction self.signCorrectionCheckBox = qtw.QCheckBox('Correct signed bits?') self.signCorrectionCheckBox.setEnabled(False) self.imageInfoLayout.addWidget(self.signCorrectionCheckBox) # Signed bit correction self.backgroundCorrectionCheckBox = qtw.QCheckBox( 'Apply background correction?') self.backgroundCorrectionCheckBox.setEnabled(False) self.imageInfoLayout.addWidget(self.backgroundCorrectionCheckBox) # Display the widget self.imageInfoWidget.setLayout(self.imageInfoLayout) parentWidget.addWidget(self.imageInfoWidget)
def createScaleSelection(self, parentWidget): # Generate the widget self.scaleSelectionWidget = qtw.QWidget() self.scaleSelectionLayout = qtw.QGridLayout(self.scaleSelectionWidget) current_row = 0 self.scaleSelectionLayout.addWidget(CLabel('Scale(s):'), current_row, 0, 1, 4) current_row += 1 self.scaleSelectionLayout.addWidget( qtw.QLabel('Space scale (px/unit):'), current_row, 0) self.spaceScaleEntry = qtw.QLineEdit() self.scaleSelectionLayout.addWidget(self.spaceScaleEntry, current_row, 1) self.scaleSelectionLayout.addWidget(qtw.QLabel('Time scale (FPS):'), current_row, 2) self.timeScaleEntry = qtw.QLineEdit() self.scaleSelectionLayout.addWidget(self.timeScaleEntry, current_row, 3) current_row += 1 self.scaleSelectionLayout.addWidget(qtw.QLabel('Space unit:'), current_row, 0) self.spaceUnitEntry = qtw.QLineEdit() self.scaleSelectionLayout.addWidget(self.spaceUnitEntry, current_row, 1) # Display the widget self.scaleSelectionWidget.setLayout(self.scaleSelectionLayout) parentWidget.addWidget(self.scaleSelectionWidget)
def createCorrectionSettings(self, parentWidget): # Generate the widget self.correctionSettingsWidget = qtw.QWidget() self.correctionSettingsLayout = qtw.QVBoxLayout( self.correctionSettingsWidget) self.correctionSettingsLayout.addWidget(CLabel("Background type:")) # Get the background type self.backgroundTypeComboBox = qtw.QComboBox() self.backgroundTypeComboBox.addItem('Median') self.backgroundTypeComboBox.addItem('Mean') self.backgroundTypeComboBox.activated.connect(self.refreshFrameDisplay) self.correctionSettingsLayout.addWidget(self.backgroundTypeComboBox) # Add the checkbox for intensity fluctuations corrections self.previewCheckBox = qtw.QCheckBox("Preview?") self.previewCheckBox.setChecked(True) self.previewCheckBox.clicked.connect(self.refreshFrameDisplay) self.correctionSettingsLayout.addWidget(self.previewCheckBox) # Display the widget self.correctionSettingsWidget.setLayout(self.correctionSettingsLayout) parentWidget.addWidget(self.correctionSettingsWidget)
def createCorrectionSettings(self, parentWidget): # Generate the widget self.correctionSettingsWidget = qtw.QWidget() self.correctionSettingsLayout = qtw.QVBoxLayout( self.correctionSettingsWidget) self.correctionSettingsLayout.addWidget(CLabel("Correction settings:")) # Get the correction type self.correctionTypeComboBox = qtw.QComboBox() self.correctionTypeComboBox.addItem('Division') self.correctionTypeComboBox.addItem('Subtraction') self.correctionSettingsLayout.addWidget(self.correctionTypeComboBox) # Get the background type self.backgroundTypeComboBox = qtw.QComboBox() self.backgroundTypeComboBox.addItem('Median') self.backgroundTypeComboBox.addItem('Mean') self.correctionSettingsLayout.addWidget(self.backgroundTypeComboBox) # Add the checkbox for intensity fluctuations corrections self.correctFluctuationsCheckBox = qtw.QCheckBox( "Correct intensity fluctuations") self.correctFluctuationsCheckBox.setChecked(True) self.correctionSettingsLayout.addWidget( self.correctFluctuationsCheckBox) # Display the widget self.correctionSettingsWidget.setLayout(self.correctionSettingsLayout) parentWidget.addWidget(self.correctionSettingsWidget)
def createCorrectionOptions(self, parentWidget): # Generate the widget self.correctionOptionsWidget = qtw.QWidget() self.correctionOptionsLayout = qtw.QVBoxLayout( self.correctionOptionsWidget) self.correctionOptionsLayout.addWidget(CLabel("Options:")) # Crop selection self.cropCheckBox = qtw.QCheckBox('Crop the image?') self.cropCheckBox.setEnabled(False) self.correctionOptionsLayout.addWidget(self.cropCheckBox) # Crop size selection cropSizeEntry_l, self.cropSizeEntry = CLabelledLineEdit( "Crop size (px):", bold=False) self.cropSizeEntry.setText(str(self.parent.config.crop_size)) self.correctionOptionsLayout.addWidget(cropSizeEntry_l) # Signed bit correction self.signCorrectionCheckBox = qtw.QCheckBox('Correct signed bits?') #self.signCorrectionCheckBox.setEnabled(False) self.correctionOptionsLayout.addWidget(self.signCorrectionCheckBox) # Signed bit correction self.replaceTabCheckBox = qtw.QCheckBox('Replace current tab?') self.replaceTabCheckBox.setChecked(True) self.correctionOptionsLayout.addWidget(self.replaceTabCheckBox) # Display the widget self.correctionOptionsWidget.setLayout(self.correctionOptionsLayout) parentWidget.addWidget(self.correctionOptionsWidget)
def createProgressDisplay(self, parentWidget): # Show the progress bar text self.progressTopLabel = CLabel('Signal analysis in progress.') parentWidget.addWidget(self.progressTopLabel, alignment=qtc.Qt.AlignCenter) self.progressBottomLabel = qtw.QLabel('This operation can take several minutes.') parentWidget.addWidget(self.progressBottomLabel, alignment=qtc.Qt.AlignCenter)
def createDetectionControls(self, parentWidget): # Make the grid for values self.settingsGridWidget = qtw.QWidget() self.settingsGridLayout = qtw.QGridLayout(self.settingsGridWidget) # Minimum intensity input current_row = 0 self.settingsGridLayout.addWidget(CLabel("Intensity Min."), current_row, 0) self.minIntensityEntry = qtw.QLineEdit() #self.minIntensityEntry.setValidator(qtg.QDoubleValidator(999999,0,3)) self.minIntensityEntry.editingFinished.connect(self.doLiveUpdate) self.settingsGridLayout.addWidget(self.minIntensityEntry, current_row, 1) current_row += 1 self.settingsGridLayout.addWidget(CLabel("Diameter"), current_row, 0) self.diameterEntry = qtw.QLineEdit() #self.diameterEntry.setValidator(qtg.QIntValidator(999999,1)) self.diameterEntry.editingFinished.connect(self.doLiveUpdate) self.settingsGridLayout.addWidget(self.diameterEntry, current_row, 1) current_row += 1 self.darkSpotCheckBox = qtw.QCheckBox("Dark particles?") self.darkSpotCheckBox.clicked.connect(self.doLiveUpdate) self.settingsGridLayout.addWidget(self.darkSpotCheckBox, current_row, 0) current_row += 1 self.manageTrackerButton = qtw.QPushButton("Tracker...") self.manageTrackerButton.clicked.connect(self.openTrackerMenu) self.manageTrackerButton.setFixedWidth(125) self.settingsGridLayout.addWidget(self.manageTrackerButton, current_row, 0) self.advancedSettingsButton = qtw.QPushButton("Advanced") self.advancedSettingsButton.clicked.connect(self.openAdvancedSettings) self.advancedSettingsButton.setFixedWidth(125) self.settingsGridLayout.addWidget(self.advancedSettingsButton, current_row, 1) # Display the widget self.settingsGridWidget.setLayout(self.settingsGridLayout) parentWidget.addWidget(self.settingsGridWidget)
def createProgressBarDisplay(self, parentWidget): # Show the progress bar text self.progressBarLabel = CLabel("") parentWidget.addWidget(self.progressBarLabel, alignment=qtc.Qt.AlignCenter) # Show the progress bar self.progressBarWidget = qtw.QProgressBar() parentWidget.addWidget(self.progressBarWidget)
def createCorrectionSettings(self, parentWidget): # Generate the widget self.correctionSettingsWidget = qtw.QWidget() self.correctionSettingsLayout = qtw.QGridLayout( self.correctionSettingsWidget) # Get the correction type current_row = 0 self.averagingTypeComboBox = qtw.QComboBox() self.averagingTypeComboBox.addItem('Standard Average') self.averagingTypeComboBox.addItem('Running Average') self.averagingTypeComboBox.currentIndexChanged.connect( self.calculateInfos) self.correctionSettingsLayout.addWidget(self.averagingTypeComboBox, current_row, 0, 1, 2) # Add the entry for the number of frames current_row += 1 self.correctionSettingsLayout.addWidget(CLabel('Number of frames:'), current_row, 0) self.numberFrameEntry = qtw.QLineEdit() self.numberFrameEntry.setText(str(2)) self.numberFrameEntry.setValidator(qtg.QIntValidator(2, self.max_n)) self.numberFrameEntry.editingFinished.connect(self.entryIsEdited) self.correctionSettingsLayout.addWidget(self.numberFrameEntry, current_row, 1) # Add the slider for number of frames selection current_row += 1 self.numberFrameSlider = qtw.QSlider(qtc.Qt.Horizontal) self.numberFrameSlider.setMinimum(2) self.numberFrameSlider.setMaximum(self.max_n) self.numberFrameSlider.setValue(2) self.numberFrameSlider.sliderMoved.connect(self.sliderIsEdited) self.correctionSettingsLayout.addWidget(self.numberFrameSlider, current_row, 0, 1, 2) # Add the checkbox for processing partial data current_row += 1 self.partialDataCheckBox = qtw.QCheckBox("Add partial data?") self.partialDataCheckBox.setChecked(False) self.partialDataCheckBox.clicked.connect(self.calculateInfos) self.correctionSettingsLayout.addWidget(self.partialDataCheckBox, current_row, 0, 1, 2) # Add the checkbox for new tab current_row += 1 self.replaceTabCheckBox = qtw.QCheckBox("Replace current tab?") self.replaceTabCheckBox.setChecked(False) self.correctionSettingsLayout.addWidget(self.replaceTabCheckBox, current_row, 0, 1, 2) # Display the widget self.correctionSettingsWidget.setLayout(self.correctionSettingsLayout) parentWidget.addWidget(self.correctionSettingsWidget)
def createSaveFileDisplay(self, parentWidget): # Generate the widget self.saveSettingsWidget = qtw.QWidget() self.saveSettingsLayout = qtw.QGridLayout(self.saveSettingsWidget) # Format selection current_row = 0 self.saveSettingsLayout.addWidget(CLabel("Format:"), current_row, 0) self.formatComboBox = qtw.QComboBox() self.formatComboBox.addItems(['Tiff', 'Jpeg', 'BMP', 'PNG']) self.formatComboBox.activated.connect(self.updateRadioButton) self.saveSettingsLayout.addWidget(self.formatComboBox, current_row, 1) # Bitness selection self.bitnessSelectionGroupButton = qtw.QButtonGroup( self.saveSettingsWidget) current_row += 1 self.saveSettingsLayout.addWidget(CLabel("Bitness:"), current_row, 0) self.bit16Radiobutton = qtw.QRadioButton("16-bits") self.bit16Radiobutton.setChecked(True) self.bitnessSelectionGroupButton.addButton(self.bit16Radiobutton) self.saveSettingsLayout.addWidget(self.bit16Radiobutton, current_row, 1) current_row += 1 self.bit8Radiobutton = qtw.QRadioButton("8-bits") self.bitnessSelectionGroupButton.addButton(self.bit8Radiobutton) self.saveSettingsLayout.addWidget(self.bit8Radiobutton, current_row, 1) # Save all frames selection current_row += 1 self.allFramesCheckbox = qtw.QCheckBox("Save all frames?") self.saveSettingsLayout.addWidget(self.allFramesCheckbox, current_row, 0, 1, 2) # Display the widget self.saveSettingsWidget.setLayout(self.saveSettingsLayout) parentWidget.addWidget(self.saveSettingsWidget, alignment=qtc.Qt.AlignLeft)
def createGeneralSettings(self): # Generate the widget self.generalSettingsWidget = qtw.QWidget() self.generalSettingsLayout = qtw.QVBoxLayout(self.generalSettingsWidget) # Settings for image opening self.generalSettingsLayout.addWidget( CLabel("Open Image(s):") ) # Default type of object self.imageTypeButtonGroupWidget = qtw.QWidget() self.imageTypeButtonGroupLayout = qtw.QVBoxLayout(self.imageTypeButtonGroupWidget) self.imageTypeGroupButton = qtw.QButtonGroup(self.imageTypeButtonGroupWidget) self.singleFileRadiobutton = qtw.QRadioButton("Single File") self.singleFileRadiobutton.setChecked( self.parent.config.single_images ) self.imageTypeGroupButton.addButton(self.singleFileRadiobutton) self.imageTypeButtonGroupLayout.addWidget(self.singleFileRadiobutton) self.imageFolderRadiobutton = qtw.QRadioButton("Images Folder") self.imageFolderRadiobutton.setChecked( not self.parent.config.single_images ) self.imageTypeGroupButton.addButton(self.imageFolderRadiobutton) self.imageTypeButtonGroupLayout.addWidget(self.imageFolderRadiobutton) self.imageTypeButtonGroupWidget.setLayout(self.imageTypeButtonGroupLayout) self.imageTypeButtonGroupWidget.setContentsMargins(0, 0, 0, 0) self.generalSettingsLayout.addWidget(self.imageTypeButtonGroupWidget) # Load automatically with the recommandation self.autoOpenImageCheckBox = qtw.QCheckBox("Auto-load with suggestions?") self.autoOpenImageCheckBox.setChecked( self.parent.config.autoload_images ) self.generalSettingsLayout.addWidget(self.autoOpenImageCheckBox) # Load automatically with the recommandation self.autoBackgroundCorrectionCheckBox = qtw.QCheckBox("Correct background automatically?") self.autoBackgroundCorrectionCheckBox.setChecked( self.parent.config.auto_background ) self.generalSettingsLayout.addWidget(self.autoBackgroundCorrectionCheckBox) self.generalSettingsLayout.addWidget( CHorizontalSeparator() ) # Add dark theme checkbox #self.darkThemeCheckBox = qtw.QCheckBox("Use dark theme?") #self.darkThemeCheckBox.setChecked( self.parent.config.dark_theme ) #self.generalSettingsLayout.addWidget(self.darkThemeCheckBox) # Add empty widget for i in range(8): self.generalSettingsLayout.addWidget(qtw.QWidget()) # Display the widget self.generalSettingsWidget.setLayout(self.generalSettingsLayout) return self.generalSettingsWidget
def createPathSelection(self, parentWidget): # Generate the widget self.pathSelectionWidget = qtw.QWidget() self.pathSelectionLayout = qtw.QHBoxLayout(self.pathSelectionWidget) # Add the path selection combobox self.pathSelectionLayout.addWidget(CLabel('Analyse path:')) self.pathSelectionBox = qtw.QComboBox() self.pathSelectionLayout.addWidget(self.pathSelectionBox) # Display the widget self.pathSelectionWidget.setLayout(self.pathSelectionLayout) parentWidget.addWidget(self.pathSelectionWidget, alignment=qtc.Qt.AlignLeft)
def createCorrectionSelection(self, parentWidget): # Generate the widget self.correctionWidget = qtw.QWidget() self.correctionLayout = qtw.QHBoxLayout(self.correctionWidget) # Display the combo box self.correctionLayout.addWidget(CLabel('Correction type:')) self.correctionSelectionBox = qtw.QComboBox() self.correctionSelectionBox.addItems(['Median', 'Mean']) self.correctionLayout.addWidget(self.correctionSelectionBox) # Display the widget self.correctionWidget.setLayout(self.correctionLayout) parentWidget.addWidget(self.correctionWidget)
def createNameSelection(self, parentWidget): # Generate the widget self.nameSelectionWidget = qtw.QWidget() self.nameSelectionLayout = qtw.QHBoxLayout(self.nameSelectionWidget) # Add the label self.nameSelectionLayout.addWidget(CLabel('Tracker name')) # Add the entry self.nameSelectionEntry = qtw.QLineEdit() self.nameSelectionLayout.addWidget(self.nameSelectionEntry) # Display the widget self.nameSelectionWidget.setLayout(self.nameSelectionLayout) parentWidget.addWidget(self.nameSelectionWidget)
def createTableWidget(self, parentWidget): # Generate the widget self.frameDisplayWidget = qtw.QWidget() self.frameDisplayLayout = qtw.QVBoxLayout(self.frameDisplayWidget) # Generate the frame selection self.frameSelectionWidget = qtw.QWidget() self.frameSelectionLayout = qtw.QHBoxLayout(self.frameSelectionWidget) # Label self.frameSelectionLayout.addWidget(CLabel('Frame:'), alignment=qtc.Qt.AlignRight) # Selection self.frameSelectionEntry = qtw.QLineEdit() self.frameSelectionEntry.setText(str(self.current_frame + 1)) self.frameSelectionEntry.setFixedWidth(75) self.frameSelectionLayout.addWidget(self.frameSelectionEntry) # Frame number self.totalFrameLabel = qtw.QLabel("/ " + str(self.n_frames)) self.frameSelectionLayout.addWidget(self.totalFrameLabel, alignment=qtc.Qt.AlignLeft) # Display the widget self.frameSelectionWidget.setLayout(self.frameSelectionLayout) self.frameDisplayLayout.addWidget(self.frameSelectionWidget, alignment=qtc.Qt.AlignLeft) # ---------- # Generate the table of servers self.frameTable = qtw.QTableWidget(1, 6) self.frameTable.setHorizontalHeaderLabels(['']) self.frameTable.setSelectionMode(qtw.QAbstractItemView.NoSelection) self.frameTable.setEditTriggers(qtw.QAbstractItemView.NoEditTriggers) self.frameTable.setShowGrid(True) self.frameTable.setMinimumHeight(63) self.frameTable.setMaximumHeight(63) self.frameDisplayLayout.addWidget(self.frameTable) # Display the widget self.frameDisplayWidget.setLayout(self.frameDisplayLayout) parentWidget.addWidget(self.frameDisplayWidget)
def createSaveFileDisplay(self, parentWidget): # Generate the widget self.saveSettingsWidget = qtw.QWidget() self.saveSettingsLayout = qtw.QGridLayout(self.saveSettingsWidget) # Format selection current_row = 0 self.saveSettingsLayout.addWidget(CLabel("Frame Rate (FPS):"), current_row, 0) self.frameRateEntry = qtw.QLineEdit() self.frameRateEntry.setText('25') self.saveSettingsLayout.addWidget(self.frameRateEntry, current_row, 1) # Display the widget self.saveSettingsWidget.setLayout(self.saveSettingsLayout) parentWidget.addWidget(self.saveSettingsWidget, alignment=qtc.Qt.AlignLeft)
def createRangeSelectionDisplay(self, parentWidget): # Generate the widget self.imageInfoWidget = qtw.QWidget() self.imageInfoLayout = qtw.QVBoxLayout(self.imageInfoWidget) self.imageInfoLayout.addWidget( CLabel('Open range:') ) # Range selection self.frameRangeSelection = CRangeSelection() self.frameRangeSelection.setMin(1) self.frameRangeSelection.setMax(self.n_frames) self.frameRangeSelection.setRange(1,self.n_frames) self.imageInfoLayout.addWidget( self.frameRangeSelection ) # Display the widget self.imageInfoWidget.setLayout(self.imageInfoLayout) parentWidget.addWidget(self.imageInfoWidget)
def createPathSelection(self, parentWidget): # Generate the widget self.pathSelectionWidget = qtw.QWidget() self.pathSelectionLayout = qtw.QHBoxLayout(self.pathSelectionWidget) # Add the path selection labels self.pathSelectionLayout.addWidget(CLabel('Current path:'), alignment=qtc.Qt.AlignRight) self.selectedPathLabel = qtw.QLabel(str(self.current_path)) self.pathSelectionLayout.addWidget(self.selectedPathLabel, alignment=qtc.Qt.AlignLeft) # Add the button to save the changes self.pathSelectionBox = qtw.QComboBox() self.pathSelectionBox.addItems( self.image_class.trajectory.listTracks().astype(str)) #self.pathSelectionBox.setFixedWidth(150) self.pathSelectionLayout.addWidget(self.pathSelectionBox, alignment=qtc.Qt.AlignRight) # Initial the combobox settings _index_correction = self.pathSelectionBox.findText( str(self.current_path), qtc.Qt.MatchFixedString) if _index_correction >= 0: self.pathSelectionBox.setCurrentIndex(_index_correction) # Add the button to load path self.loadButton = qtw.QPushButton("Load path") self.loadButton.clicked.connect(self.changePath) self.loadButton.setFixedWidth(150) self.pathSelectionLayout.addWidget(self.loadButton, alignment=qtc.Qt.AlignRight) # Add the button to create new path self.newPathButton = qtw.QPushButton("New path") self.newPathButton.clicked.connect(self.createNewPath) self.newPathButton.setFixedWidth(150) self.pathSelectionLayout.addWidget(self.newPathButton, alignment=qtc.Qt.AlignRight) # Display the widget self.pathSelectionWidget.setLayout(self.pathSelectionLayout) parentWidget.addWidget(self.pathSelectionWidget)
def __init__(self, parent): super(aboutHelpWindow, self).__init__(parent) # Initialise the subwindow self.parent = parent self.setWindowModality(qtc.Qt.ApplicationModal) self.mainWidget = qtw.QWidget() self.mainLayout = qtw.QVBoxLayout(self.mainWidget) self.setWindowTitle('About...') # Show the logo imageWidget = qtw.QLabel() image = qtg.QPixmap(self.parent.appctxt.get_resource('iscan_logo.png')) imageWidget.setPixmap(image) self.mainLayout.addWidget(imageWidget, alignment=qtc.Qt.AlignCenter) # Show the title titleText = CLabel("iSCAN - v1.0") self.mainLayout.addWidget(titleText, alignment=qtc.Qt.AlignCenter) # Show the text aboutText = qtw.QLabel("""Release Date: XX/XX/2020 Author: Vivien Walter Contact: [email protected] More information and documentation can be found on the website of the software: https://github.com/vivien-walter/iscan""") self.mainLayout.addWidget(aboutText) #, alignment=qtc.Qt.AlignCenter) # Exit button self.exitButton = qtw.QPushButton("Close") self.exitButton.setFixedWidth(125) self.exitButton.clicked.connect(self.close) self.mainLayout.addWidget(self.exitButton, alignment=qtc.Qt.AlignCenter) # Display the panel #self.mainLayout.setAlignment(qtc.Qt.AlignCenter) self.mainWidget.setLayout(self.mainLayout) self.setCentralWidget(self.mainWidget) self.resize(300, 300) self.show() self.setFixedSize(self.size())
def createPathSelectionDisplay(self, parentWidget): self.pathSelectionWidget = qtw.QWidget() self.pathSelectionLayout = qtw.QVBoxLayout(self.pathSelectionWidget) # Add the label self.pathSelectionLayout.addWidget(CLabel("Path selection:")) # Add the checkbox for displaying trajectory self.pathSelectionEntry = CPathSelection() self.pathSelectionEntry.connectChange(self.refreshDisplay) self.pathSelectionLayout.addWidget(self.pathSelectionEntry) # Add the options self.deletePathButton = qtw.QPushButton("Delete Path") self.deletePathButton.setEnabled(False) self.deletePathButton.clicked.connect(self.deleteSelectedPath) self.pathSelectionLayout.addWidget(self.deletePathButton) self.pathSelectionWidget.setLayout(self.pathSelectionLayout) parentWidget.addWidget(self.pathSelectionWidget)
def createAveragingSelection(self, parentWidget): # Generate the widget self.averageSelectionWidget = qtw.QWidget() self.averageSelectionLayout = qtw.QGridLayout( self.averageSelectionWidget) # Average type self.averageSelectionLayout.addWidget(CLabel("Type:"), 0, 0) self.averagingTypeComboBox = qtw.QComboBox() self.averagingTypeComboBox.addItem('Standard Average') self.averagingTypeComboBox.addItem('Running Average') self.averagingTypeComboBox.setFixedWidth(200) self.averageSelectionLayout.addWidget(self.averagingTypeComboBox, 1, 0) # Process button self.processButton = qtw.QPushButton("PROCESS") self.processButton.setFixedHeight(50) self.processButton.setFixedWidth(100) self.processButton.clicked.connect(self.processAveraging) self.averageSelectionLayout.addWidget(self.processButton, 0, 1, 2, 1) # Range selection self.averageSelectionLayout.addWidget(qtw.QLabel('Processing range:'), 2, 0, 1, 2) self.frameRangeSelection = CRangeSelection() self.frameRangeSelection.setMin(2) self.frameRangeSelection.setMax(3) self.frameRangeSelection.setRange(2, 3) self.frameRangeSelection.setFixedWidth(550) self.averageSelectionLayout.addWidget(self.frameRangeSelection, 3, 0, 1, 2, alignment=qtc.Qt.AlignRight) # Display the widget self.averageSelectionWidget.setLayout(self.averageSelectionLayout) parentWidget.addWidget(self.averageSelectionWidget)
def createGraphDisplay(self, parentWidget): # Generate the widget self.plotGraphWidget = qtw.QWidget() self.plotGraphLayout = qtw.QVBoxLayout(self.plotGraphWidget) # Add the graph self.graphWidget = pg.PlotWidget() self.plotGraphLayout.addWidget(self.graphWidget) # Add the path selector self.pathSelectionEntry = CPathSelection() self.pathSelectionEntry.connectChange(self.updateGraph) self.plotGraphLayout.addWidget(self.pathSelectionEntry, alignment=qtc.Qt.AlignCenter) # Add the diffusivity display self.diffusivityValueWidget = qtw.QWidget() self.diffusivityValueLayout = qtw.QHBoxLayout( self.diffusivityValueWidget) self.diffusivityValueLayout.addWidget(CLabel('Diffusivity:')) self.diffusivityValueLabel = qtw.QLabel() self.diffusivityValueLayout.addWidget(self.diffusivityValueLabel, alignment=qtc.Qt.AlignLeft) self.diffusivityValueWidget.setLayout(self.diffusivityValueLayout) self.plotGraphLayout.addWidget(self.diffusivityValueWidget) # Add log checkbox self.logScaleCheckbox = qtw.QCheckBox('Log scale?') self.logScaleCheckbox.setChecked(True) self.logScaleCheckbox.clicked.connect(self.updateGraph) self.plotGraphLayout.addWidget(self.logScaleCheckbox, alignment=qtc.Qt.AlignLeft) # Display the widget self.plotGraphWidget.setLayout(self.plotGraphLayout) parentWidget.addWidget(self.plotGraphWidget)
def createSizeControl(self, parentWidget): # Generate the widget self.sizeControlWidget = qtw.QWidget() self.sizeControlLayout = qtw.QGridLayout(self.sizeControlWidget) current_row = 0 self.sizeControlLayout.addWidget(CLabel('Crop size'), current_row, 0, 1, 3) # Slider to change the size current_row += 1 self.sizeSlider = qtw.QSlider(qtc.Qt.Horizontal) self.sizeSlider.setMinimum(4) self.sizeSlider.sliderMoved.connect(self.updateSlider) self.sizeControlLayout.addWidget(self.sizeSlider, current_row, 0, 1, 3) # Add labels and controls current_row += 1 minLabel = qtw.QLabel('4') minLabel.setAlignment(qtc.Qt.AlignLeft) self.sizeControlLayout.addWidget(minLabel, current_row, 0) self.sizeEntry = qtw.QLineEdit() self.sizeEntry.setFixedWidth(100) self.sizeEntry.setAlignment(qtc.Qt.AlignCenter) self.sizeEntry.editingFinished.connect(self.updateEntry) self.sizeControlLayout.addWidget(self.sizeEntry, current_row, 1) self.maxLabel = qtw.QLabel('') self.maxLabel.setAlignment(qtc.Qt.AlignRight) self.sizeControlLayout.addWidget(self.maxLabel, current_row, 2) # Display the widget self.sizeControlWidget.setLayout(self.sizeControlLayout) parentWidget.addWidget(self.sizeControlWidget)
def createImageSettings(self): # Generate the widget self.imageSettingsWidget = qtw.QWidget() self.imageSettingsLayout = qtw.QVBoxLayout(self.imageSettingsWidget) # Settings for image preparation self.imageSettingsLayout.addWidget( CLabel("Image Preparation:") ) # Crop the image if recommended self.cropImageCheckBox = qtw.QCheckBox("Crop the image") self.cropImageCheckBox.setChecked( self.parent.config.crop_image ) self.imageSettingsLayout.addWidget(self.cropImageCheckBox) cropSizeEntry_l, self.cropSizeEntry = CLabelledLineEdit("Crop size (px):", bold=False) self.cropSizeEntry.setText( str(self.parent.config.crop_size) ) self.imageSettingsLayout.addWidget(cropSizeEntry_l) # Correct signed bits if recommended self.correctSignedBitsCheckBox = qtw.QCheckBox("Correct signed bits") self.correctSignedBitsCheckBox.setChecked( self.parent.config.correct_signed ) self.imageSettingsLayout.addWidget(self.correctSignedBitsCheckBox) self.imageSettingsLayout.addWidget( CHorizontalSeparator() ) # Settings for image correction self.imageSettingsLayout.addWidget( CLabel("Image Correction:") ) # Settings for the background settings self.imageSettingsLayout.addWidget( qtw.QLabel("Background correction settings") ) # Get the correction type self.correctionTypeComboBox = qtw.QComboBox() self.correctionTypeComboBox.addItem('Division') self.correctionTypeComboBox.addItem('Subtraction') _index_correction = self.correctionTypeComboBox.findText(self.parent.config.correction_type.capitalize(), qtc.Qt.MatchFixedString) if _index_correction >= 0: self.correctionTypeComboBox.setCurrentIndex(_index_correction) self.imageSettingsLayout.addWidget(self.correctionTypeComboBox) # Get the background type self.backgroundTypeComboBox = qtw.QComboBox() self.backgroundTypeComboBox.addItem('Median') self.backgroundTypeComboBox.addItem('Mean') _index_background = self.backgroundTypeComboBox.findText(self.parent.config.background_type.capitalize(), qtc.Qt.MatchFixedString) if _index_background >= 0: self.backgroundTypeComboBox.setCurrentIndex(_index_background) self.imageSettingsLayout.addWidget(self.backgroundTypeComboBox) # Correct intensity fluctuation self.correctFluctuationsCheckBox = qtw.QCheckBox("Correct intensity fluctuations") self.correctFluctuationsCheckBox.setChecked( self.parent.config.correct_intensity ) self.imageSettingsLayout.addWidget(self.correctFluctuationsCheckBox) # Correct intensity fluctuation self.newTabCheckBox = qtw.QCheckBox("Open corrected stack in a new tab") self.newTabCheckBox.setChecked( self.parent.config.correct_newtab ) self.imageSettingsLayout.addWidget(self.newTabCheckBox) # Display the widget self.imageSettingsWidget.setLayout(self.imageSettingsLayout) return self.imageSettingsWidget
def createImageInfosDisplay(self, parentWidget): # Generate the widget self.imageInfoWidget = qtw.QWidget() self.imageInfoLayout = qtw.QVBoxLayout(self.imageInfoWidget) # Populate all the informations self.infoGridWidget = qtw.QWidget() self.infoGridLayout = qtw.QGridLayout(self.infoGridWidget) # Number of images self.imageNumberLabel = qtw.QLabel('') self.infoGridLayout.addWidget( CLabel('Number of image(s):'), 0, 0) self.infoGridLayout.addWidget( self.imageNumberLabel, 0, 1) # Image size self.imageSizeLabel = qtw.QLabel('') self.infoGridLayout.addWidget( CLabel('Image Size:'), 1, 0) self.infoGridLayout.addWidget( self.imageSizeLabel, 1, 1) # Image bitness self.imageBitsLabel = qtw.QLabel('') self.infoGridLayout.addWidget( CLabel('Image Bitness:'), 2, 0) self.infoGridLayout.addWidget( self.imageBitsLabel, 2, 1) # Display the grid self.infoGridWidget.setLayout(self.infoGridLayout) self.imageInfoLayout.addWidget( self.infoGridWidget, alignment=qtc.Qt.AlignLeft) # Populate all the informations self.selectionGridWidget = qtw.QWidget() self.selectionGridLayout = qtw.QGridLayout(self.selectionGridWidget) current_row = 0 self.selectionGridLayout.addWidget( qtw.QLabel('Open range:'), current_row, 0, 1, 3) # Range selection current_row += 1 self.frameRangeSelection = CRangeSelection() self.frameRangeSelection.setMin(0) self.frameRangeSelection.setMax(1) self.frameRangeSelection.setRange(0,1) self.frameRangeSelection.setEnabled(False) self.selectionGridLayout.addWidget( self.frameRangeSelection, current_row, 0, 1, 3) # Crop selection current_row += 1 self.cropCheckBox = qtw.QCheckBox('Crop the image?') self.selectionGridLayout.addWidget( self.cropCheckBox, current_row, 0) self.selectionGridLayout.addWidget( qtw.QLabel('size (px):'), current_row, 1) self.cropSizeEntry = qtw.QLineEdit() self.cropSizeEntry.setText( str(self.parent.config.crop_size) ) self.selectionGridLayout.addWidget( self.cropSizeEntry, current_row, 2) # Signed bit correction current_row += 1 self.signCorrectionCheckBox = qtw.QCheckBox('Correct signed bits?') #self.signCorrectionCheckBox.setEnabled(False) self.selectionGridLayout.addWidget( self.signCorrectionCheckBox, current_row, 0, 1, 3) # Signed bit correction current_row += 1 self.backgroundCorrectionCheckBox = qtw.QCheckBox('Apply background correction?') self.backgroundCorrectionCheckBox.setEnabled(False) self.selectionGridLayout.addWidget( self.backgroundCorrectionCheckBox, current_row, 0, 1, 3) # Display the grid self.selectionGridWidget.setLayout(self.selectionGridLayout) self.imageInfoLayout.addWidget( self.selectionGridWidget) # Display the widget self.imageInfoWidget.setLayout(self.imageInfoLayout) parentWidget.addWidget(self.imageInfoWidget)