def createUserInterface(self): """ This step is mostly empty. A volume rendering threshold is added to be useful. """ self.__layout = self.__parent.createUserInterface() self.__threshRange = slicer.qMRMLRangeWidget() self.__threshRange.decimals = 0 self.__threshRange.singleStep = 1 self.__threshRange.connect('valuesChanged(double,double)', self.onThresholdChanged) qt.QTimer.singleShot(0, self.killButton) ThreshGroupBox = qt.QGroupBox() ThreshGroupBox.setTitle('3D Visualization Intensity Threshold') ThreshGroupBoxLayout = qt.QFormLayout(ThreshGroupBox) ThreshGroupBoxLayout.addRow(self.__threshRange) self.__layout.addRow(ThreshGroupBox) editorWidgetParent = slicer.qMRMLWidget() editorWidgetParent.setLayout(qt.QVBoxLayout()) editorWidgetParent.setMRMLScene(slicer.mrmlScene) self.__editorWidget = EditorWidget(parent=editorWidgetParent) self.__editorWidget.setup() self.__layout.addRow(editorWidgetParent) self.hideUnwantedEditorUIElements() RestartGroupBox = qt.QGroupBox() RestartGroupBox.setTitle('Restart') RestartGroupBoxLayout = qt.QFormLayout(RestartGroupBox) self.__RestartButton = qt.QPushButton('Return to Step 1') RestartGroupBoxLayout.addRow(self.__RestartButton) self.__RemoveCroppedSubtractionMap = qt.QCheckBox() self.__RemoveCroppedSubtractionMap.checked = True self.__RemoveCroppedSubtractionMap.setToolTip( "Delete the cropped version of your subtaction map.") RestartGroupBoxLayout.addRow("Delete cropped subtraction map: ", self.__RemoveCroppedSubtractionMap) self.__RemoveFullSubtracitonMap = qt.QCheckBox() self.__RemoveFullSubtracitonMap.checked = True self.__RemoveFullSubtracitonMap.setToolTip( "Delete the full version of your subtaction map.") RestartGroupBoxLayout.addRow("Delete full subtraction map: ", self.__RemoveFullSubtracitonMap) self.__RemoveROI = qt.QCheckBox() self.__RemoveROI.checked = False self.__RemoveROI.setToolTip( "Delete the ROI resulting from your subtaction map.") RestartGroupBoxLayout.addRow("Delete ROI: ", self.__RemoveROI) # self.__RestartButton.setEnabled(0) self.__RestartButton.connect('clicked()', self.Restart) self.__RestartActivated = True self.__layout.addRow(RestartGroupBox)
def createUserInterface(self): """ This UI takes advantage of a pre-built slicer thresholding widget. """ self.__layout = self.__parent.createUserInterface() step_label = qt.QLabel( """Use the slider bar below to set an intensity threshold. Any pixels within your ROI and within the intensity threshold will be selected.""" ) step_label.setWordWrap(True) self.__primaryGroupBox = qt.QGroupBox() self.__primaryGroupBox.setTitle('Information') self.__primaryGroupBoxLayout = qt.QFormLayout(self.__primaryGroupBox) self.__primaryGroupBoxLayout.addRow(step_label) self.__layout.addRow(self.__primaryGroupBox) self.__thresholdGroupBox = qt.QGroupBox() self.__thresholdGroupBox.setTitle('Threshold Range') self.__thresholdGroupBoxLayout = qt.QFormLayout( self.__thresholdGroupBox) threshLabel = qt.QLabel('Select Intensity Range:') threshLabel.alignment = 4 self.__threshRange = slicer.qMRMLRangeWidget() self.__threshRange.decimals = 0 self.__threshRange.singleStep = 1 self.__thresholdGroupBoxLayout.addRow(threshLabel) self.__thresholdGroupBoxLayout.addRow(self.__threshRange) self.__layout.addRow(self.__thresholdGroupBox) self.__threshRange.connect('valuesChanged(double,double)', self.onThresholdChanged) qt.QTimer.singleShot(0, self.killButton)
def createUserInterface(self): """ This method uses qt to create a user interface. qMRMLNodeComboBox is a drop down menu for picking MRML files. MRML files have to be added to a "scene," i.e. the main Slicer container, hence setMRMLScene. """ self.__layout = self.__parent.createUserInterface() step_label = qt.QLabel( 'Choose the volume you would like to threshold. If you are calculating a subtraction map, check the \"Calculate Subtraction Map\" box and select a post-contrast image.' ) step_label.setWordWrap(True) self.__primaryGroupBox = qt.QGroupBox() self.__primaryGroupBox.setTitle('Information') self.__primaryGroupBoxLayout = qt.QFormLayout(self.__primaryGroupBox) self.__subtractionMappingGroupBox = qt.QGroupBox() self.__subtractionMappingGroupBox.setTitle('Volume Selection') self.__subtractionMappingGroupBoxLayout = qt.QFormLayout( self.__subtractionMappingGroupBox) baselineScanLabel = qt.QLabel('Primary / Pre-Contrast Image:') self.__baselineVolumeSelector = slicer.qMRMLNodeComboBox() self.__baselineVolumeSelector.toolTip = "Select the volume you wish to threshold. If you are calculating a subtraction map, this will be the pre-contrast scan." self.__baselineVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__baselineVolumeSelector.setMRMLScene(slicer.mrmlScene) self.__baselineVolumeSelector.addEnabled = 0 subtractionMappingLabel = qt.QLabel('Calculate Subtraction Map:') self.__enableSubtractionMapping = qt.QCheckBox() self.__enableSubtractionMapping.checked = False self.__enableSubtractionMapping.setToolTip( "Check if you would like to calculate a subtraction map") self.__enableSubtractionMapping.connect('clicked()', self.setSubtractionMapping) followupScanLabel = qt.QLabel('Post-Contrast Image:') self.__followupVolumeSelector = slicer.qMRMLNodeComboBox() self.__followupVolumeSelector.toolTip = "Choose the post-contrast scan" self.__followupVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__followupVolumeSelector.setMRMLScene(slicer.mrmlScene) self.__followupVolumeSelector.addEnabled = 0 self.__followupVolumeSelector.enabled = 0 self.__layout.addRow(self.__primaryGroupBox) self.__primaryGroupBoxLayout.addRow(step_label) self.__subtractionMappingGroupBoxLayout.addRow( baselineScanLabel, self.__baselineVolumeSelector) self.__layout.addRow(self.__subtractionMappingGroupBox) self.__subtractionMappingGroupBoxLayout.addRow( subtractionMappingLabel, self.__enableSubtractionMapping) self.__subtractionMappingGroupBoxLayout.addRow( followupScanLabel, self.__followupVolumeSelector) self.updateWidgetFromParameters(self.parameterNode()) # This timer is a trick to wait for buttons to load BEFORE deleting them. qt.QTimer.singleShot(0, self.killButton)
def createUserInterface( self ): ''' ''' # disable the next button in simple mode if self.isSimpleMode(): self.workflow().goBackToOriginStepUponSuccess = False self.buttonBoxHints = self.NextButtonHidden slicer.modules.emsegmentsimplemode = True slicer.modules.emsegmentsimplestep2 = self else: slicer.modules.emsegmentsimplemode = False slicer.modules.emsegmentsimplestep2 = None self.__layout = super( EMSegmentDefineInputChannelsStep, self ).createUserInterface() # the input channels inputChannelGroupBox = qt.QGroupBox() inputChannelGroupBox.setTitle( 'Input Datasets' ) inputChannelGroupBox.toolTip = 'Please configure the datasets which should be segmented.' self.__layout.addWidget( inputChannelGroupBox ) inputChannelGroupBoxLayout = qt.QFormLayout( inputChannelGroupBox ) self.__inputChannelList = slicer.modulewidget.qSlicerEMSegmentInputChannelListWidget() self.__inputChannelList.setMRMLManager( self.mrmlManager() ) inputChannelGroupBoxLayout.addWidget( self.__inputChannelList ) # add empty row self.__layout.addRow( "", qt.QWidget() ) # registration settings input2inputChannelRegistration = qt.QGroupBox() input2inputChannelRegistration.setTitle( 'Input-to-Input Channel Registration' ) self.__layout.addWidget( input2inputChannelRegistration ) input2inputChannelRegistrationLayout = qt.QFormLayout( input2inputChannelRegistration ) self.__alignInputScansCheckBox = qt.QCheckBox() self.__alignInputScansCheckBox.toolTip = 'Toggle to align the input datasets.' input2inputChannelRegistrationLayout.addRow( 'Align input datasets:', self.__alignInputScansCheckBox ) self.__alignInputScansCheckBox.connect( "stateChanged(int)", self.propagateToMRML ) # add empty row self.__layout.addRow( "", qt.QWidget() ) if self.isSimpleMode(): # # dynamic frame # dynamicFrame = qt.QGroupBox() dynamicFrame.setTitle( 'Check List' ) dynamicFrame.toolTip = 'Please check anything applicable.' self.__layout.addWidget( dynamicFrame ) dynamicFrameLayout = qt.QVBoxLayout( dynamicFrame ) # .. now pass the layout to the dynamicFrame self.dynamicFrame().setLayout( dynamicFrameLayout )
def createUserInterface(self): ''' ''' # disable the next button in simple mode if self.isSimpleMode(): self.buttonBoxHints = self.NextButtonHidden self.__layout = self.__parent.createUserInterface() # the input channels inputChannelGroupBox = qt.QGroupBox() inputChannelGroupBox.setTitle('Input Channels') self.__layout.addWidget(inputChannelGroupBox) inputChannelGroupBoxLayout = qt.QFormLayout(inputChannelGroupBox) self.__inputChannelList = PythonQt.qSlicerEMSegmentModuleWidgets.qSlicerEMSegmentInputChannelListWidget( ) self.__inputChannelList.setMRMLManager(self.mrmlManager()) inputChannelGroupBoxLayout.addWidget(self.__inputChannelList) # add empty row self.__layout.addRow("", qt.QWidget()) # registration settings input2inputChannelRegistration = qt.QGroupBox() input2inputChannelRegistration.setTitle( 'Input-to-Input Channel Registration') self.__layout.addWidget(input2inputChannelRegistration) input2inputChannelRegistrationLayout = qt.QFormLayout( input2inputChannelRegistration) self.__alignInputScansCheckBox = qt.QCheckBox() input2inputChannelRegistrationLayout.addRow( 'Align input scans:', self.__alignInputScansCheckBox) self.__alignInputScansCheckBox.connect("stateChanged(int)", self.propagateToMRML) # add empty row self.__layout.addRow("", qt.QWidget()) if self.isSimpleMode(): # # dynamic frame # dynamicFrame = qt.QGroupBox() dynamicFrame.setTitle('Check List') self.__layout.addWidget(dynamicFrame) dynamicFrameLayout = qt.QVBoxLayout(dynamicFrame) # .. now pass the layout to the dynamicFrame self.dynamicFrame().setLayout(dynamicFrameLayout)
def createUserInterface( self ): ''' ''' self.__layout = super( EMSegmentQuickStep4, self ).createUserInterface() # deactivate next button since it is the last step self.buttonBoxHints = self.NextButtonDisabled # the ROI parameters voiGroupBox = qt.QGroupBox() voiGroupBox.setTitle( 'Define VOI' ) self.__layout.addWidget( voiGroupBox ) voiGroupBoxLayout = qt.QFormLayout( voiGroupBox ) self.__roiWidget = slicer.modulewidget.qMRMLAnnotationROIWidget() self.__roiWidget.toolTip = 'Select a sub-volume for segmentation. Then, only the selected area will be segmented. By default, the complete volume will be segmented.' voiGroupBoxLayout.addWidget( self.__roiWidget ) self.__roi = slicer.vtkMRMLAnnotationROINode() self.__roi.SetXYZ( [0, 0, 0] ); self.__roi.SetRadiusXYZ( 100, 100, 100 ); self.__roi.Initialize( slicer.mrmlScene ) self.__roi.AddObserver( vtk.vtkCommand.ModifiedEvent, self.updateMRMLFromROI ) self.__roiWidget.setMRMLAnnotationROINode( self.__roi ) self.__roiWidget.setDisplayClippingBox( 0 )
def createUserInterface( self ): ''' ''' self.__layout = self.__parent.createUserInterface() roiLabel = qt.QLabel( 'Select ROI:' ) self.__roiSelector = slicer.qMRMLNodeComboBox() self.__roiSelector.nodeTypes = ['vtkMRMLAnnotationROINode'] self.__roiSelector.toolTip = "ROI defining the structure of interest" self.__roiSelector.setMRMLScene(slicer.mrmlScene) self.__roiSelector.addEnabled = 1 self.__layout.addRow( roiLabel, self.__roiSelector ) self.__roiSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onROIChanged) # the ROI parameters voiGroupBox = qt.QGroupBox() voiGroupBox.setTitle( 'Define VOI' ) self.__layout.addRow( voiGroupBox ) voiGroupBoxLayout = qt.QFormLayout( voiGroupBox ) self.__roiWidget = PythonQt.qSlicerAnnotationsModuleWidgets.qMRMLAnnotationROIWidget() voiGroupBoxLayout.addRow( self.__roiWidget ) # initialize VR stuff self.__vrLogic = slicer.modules.volumerendering.logic() # self.updateWidgetFromParameters(self.parameterNode()) qt.QTimer.singleShot(0, self.killButton)
def createUserInterface( self ): ''' ''' self.__layout = super( EMSegmentDefineAtlasStep, self ).createUserInterface() infoLabel = qt.QLabel( 'It is possible to assign an individual atlas to each structure in the tree below.' ) infoLabel2 = qt.QLabel( 'For more specific segmentation, it is also possible to assign an additional \nparcellation map to each structure.' ) self.__layout.addWidget( infoLabel ) self.__layout.addWidget( infoLabel2 ) # the anatomical tree anatomicalTreeGroupBox = qt.QGroupBox() anatomicalTreeGroupBox.setTitle( 'Atlas Map' ) self.__layout.addWidget( anatomicalTreeGroupBox ) anatomicalTreeGroupBoxLayout = qt.QFormLayout( anatomicalTreeGroupBox ) self.__anatomicalTree = slicer.modulewidget.qSlicerEMSegmentAnatomicalTreeWidget() self.__anatomicalTree.structureNameEditable = False self.__anatomicalTree.labelColumnVisible = False self.__anatomicalTree.probabilityMapColumnVisible = True self.__anatomicalTree.parcellationMapColumnVisible = True self.__anatomicalTree.toolTip = 'If applicable, please assign structure-specific atlases to each anatomical structure.' self.__anatomicalTree.setSizePolicy( qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.MinimumExpanding ) anatomicalTreeGroupBoxLayout.addWidget( self.__anatomicalTree )
def createUserInterface( self ): ''' ''' self.__layout = self.__parent.createUserInterface() # the colorpicker combobox self.__colorTableComboBox = slicer.qMRMLColorTableComboBox() self.__colorTableComboBox.setMRMLScene( slicer.mrmlScene ) # get current color node from the mrmlManager currentColorNodeID = self.mrmlManager().GetColorNodeID() currentColorNode = slicer.mrmlScene.GetNodeByID( currentColorNodeID ) if currentColorNode: self.__colorTableComboBox.setCurrentNode( currentColorNode ) self.__colorTableComboBox.connect( 'currentNodeChanged(vtkMRMLNode*)', self.onColorNodeChanged ) self.__layout.addWidget( self.__colorTableComboBox ) # the anatomical tree anatomicalTreeGroupBox = qt.QGroupBox() anatomicalTreeGroupBox.setTitle( 'Anatomical Tree' ) self.__layout.addWidget( anatomicalTreeGroupBox ) anatomicalTreeGroupBoxLayout = qt.QFormLayout( anatomicalTreeGroupBox ) self.__anatomicalTree = PythonQt.qSlicerEMSegmentModuleWidgets.qSlicerEMSegmentAnatomicalTreeWidget() self.__anatomicalTree.structureNameEditable = True self.__anatomicalTree.labelColumnVisible = True self.__anatomicalTree.addDeleteSubclassesEnabled = True self.__anatomicalTree.setSizePolicy( qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.MinimumExpanding ) anatomicalTreeGroupBoxLayout.addWidget( self.__anatomicalTree )
def createUserInterface(self): ''' ''' self.__layout = super(EMSegmentQuickStep5, self).createUserInterface() infoLabel = qt.QLabel( 'The segmentation finished!\n\nThe results are displayed as labelMaps in the slice viewers.\n\n' ) infoLabel.setFont(self.getBoldFont()) self.__layout.addWidget(infoLabel) self.__top = qt.QGroupBox() self.__top.setTitle('Statistics') self.__top.toolTip = 'This table shows label statistics for the segmentation results.' self.__topLayout = qt.QVBoxLayout(self.__top) self.__layout.addWidget(self.__top) # deactivate next button since it is the last step self.buttonBoxHints = self.NextButtonDisabled # the volume node workingDataNode = self.mrmlManager().GetWorkingDataNode() if workingDataNode: # set flags in the mrml nodes workingDataNode.SetAlignedTargetNodeIsValid(1) workingDataNode.SetAlignedAtlasNodeIsValid(1) # show preprocessing output in sliceViews volumeCollection = workingDataNode.GetInputTargetNode() if volumeCollection: outputNode = volumeCollection.GetNthVolumeNode(0) labelStatisticsWidget = LabelStatisticsWidget(self.__top) labelStatisticsWidget.setup() labelStatisticsWidget.labelNode = self.mrmlManager( ).GetOutputVolumeNode() labelStatisticsWidget.grayscaleNode = outputNode labelStatisticsWidget.applyButton.visible = False labelStatisticsWidget.labelSelectorFrame.visible = False labelStatisticsWidget.grayscaleSelectorFrame.visible = False labelStatisticsWidget.saveButton.visible = False labelStatisticsWidget.grayscaleSelector.visible = False labelStatisticsWidget.labelSelector.visible = False labelStatisticsWidget.onApply() infoLabel2 = qt.QLabel( '\n\nIt is now possible to change parameters and click "Segment" again or to reset the module.' ) #infoLabel2.setFont( self.getBoldFont() ) self.__layout.addWidget(infoLabel2) resetButton = qt.QPushButton('Reset Module') resetButton.connect('clicked()', self.onResetButton) self.__layout.addWidget(resetButton)
def createUserInterface(self): ''' ''' self.__layout = super(EMSegmentQuickStep2, self).createUserInterface() # the colorpicker combobox self.__colorTableComboBox = slicer.qMRMLColorTableComboBox() self.__colorTableComboBox.setMRMLScene(slicer.mrmlScene) self.__colorTableComboBox.toolTip = 'The label colors are defined using this look-up table.' infoLabel = qt.QLabel( "Choose the look-up table for label colorization:") self.__layout.addWidget(infoLabel) # get current color node from the mrmlManager currentColorNodeID = self.mrmlManager().GetColorNodeID() currentColorNode = slicer.mrmlScene.GetNodeByID(currentColorNodeID) if currentColorNode: self.__colorTableComboBox.setCurrentNode(currentColorNode) self.__colorTableComboBox.connect('currentNodeChanged(vtkMRMLNode*)', self.onColorNodeChanged) self.__layout.addWidget(self.__colorTableComboBox) # add empty row self.__layout.addRow("", qt.QWidget()) # add empty row self.__layout.addRow("", qt.QWidget()) # add empty row self.__layout.addRow("", qt.QWidget()) # the anatomical tree anatomicalTreeGroupBox = qt.QGroupBox() anatomicalTreeGroupBox.setTitle('Anatomical Tree') self.__layout.addWidget(anatomicalTreeGroupBox) anatomicalTreeGroupBoxLayout = qt.QFormLayout(anatomicalTreeGroupBox) self.__anatomicalTree = slicer.modulewidget.qSlicerEMSegmentAnatomicalTreeWidget( ) self.__anatomicalTree.structureNameVisible = False self.__anatomicalTree.structureNameEditable = False self.__anatomicalTree.labelColumnVisible = True self.__anatomicalTree.addDeleteSubclassesEnabled = True self.__anatomicalTree.toolTip = 'Please configure a hierarchy of structures for the input datasets.' self.__anatomicalTree.setSizePolicy(qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.MinimumExpanding) anatomicalTreeGroupBoxLayout.addWidget(self.__anatomicalTree) self.__anatomicalTree.disableUpdateValueFlag = False
def createUserInterface(self): ''' ''' self.__layout = self.__parent.createUserInterface() # # dynamic frame # dynamicFrame = qt.QGroupBox() dynamicFrame.setTitle('Check List') self.__layout.addWidget(dynamicFrame) dynamicFrameLayout = qt.QVBoxLayout(dynamicFrame) # .. now pass the layout to the dynamicFrame self.dynamicFrame().setLayout(dynamicFrameLayout)
def createUserInterface(self): """ As of now, this user interface is fairly simple. If there are other methods of normalization, they could be added here. """ self.__layout = self.__parent.createUserInterface() step_label = qt.QLabel("""This step is not yet implemented.""") step_label.setWordWrap(True) self.__informationGroupBox = qt.QGroupBox() self.__informationGroupBox.setTitle('Information') self.__informationGroupBoxLayout = qt.QFormLayout( self.__informationGroupBox) self.__informationGroupBoxLayout.addRow(step_label) self.__layout.addRow(self.__informationGroupBox)
def segmentationSetup(self): #### Collapsible Button --- General Frame self.segmentationCB = ctk.ctkCollapsibleButton() self.segmentationCB.text = "ContactPositionEstimator - Segmentation" self.segmentationCB.contentsLineWidth = 1 self.layout.addWidget(self.segmentationCB) #### Collapsible Button layout self.segmentationFL = qt.QFormLayout(self.segmentationCB) #### Choose Fiducial - Section #### Select box ComboBox - self.fiducialCBox = slicer.qMRMLNodeComboBox() self.fiducialCBox.nodeTypes = (("vtkMRMLMarkupsFiducialNode"), "") self.fiducialCBox.selectNodeUponCreation = False self.fiducialCBox.addEnabled = False self.fiducialCBox.removeEnabled = False self.fiducialCBox.noneEnabled = True self.fiducialCBox.setMRMLScene(slicer.mrmlScene) self.fiducialCBox.setToolTip("Select a fiducial list") #### Add fiducial to the Collapsible Button self.segmentationFL.addRow("Fiducial List", self.fiducialCBox) #### Connect the fiducial list to the self.fiducialCBox.connect('currentNodeChanged(bool)', self.onfiducialCBox) #### Configure Segmentation - Section ### Read from files the list of the modules with open(slicer.modules.ContactPositionEstimatorInstance. electrodeTypesPath) as data_file: # models is a dictionary with the name of electrode type is the key self.models = json.load(data_file) #### Create the caption table for the configuration self.tableCaption = ["Name", "Type/Model", "TP", "cEP"] self.tableHsize = [80, 180, 50, 50] self.captionGB = qt.QGroupBox(self.segmentationCB) self.captionBL = qt.QHBoxLayout(self.captionGB) self.captionBL.setMargin(1) for i in (xrange(len(self.tableCaption))): a = qt.QLabel(self.tableCaption[i], self.captionGB) a.setMaximumWidth(self.tableHsize[i]) a.setMaximumHeight(20) a.setStyleSheet("qproperty-alignment: AlignCenter;") self.captionBL.addWidget(a) self.segmentationFL.addRow("", self.captionGB) self.electrodeList = []
def createUserInterface(self): ''' ''' self.__layout = super(EMSegmentDefinePreprocessingStep, self).createUserInterface() # # dynamic frame # dynamicFrame = qt.QGroupBox() dynamicFrame.setTitle('Check List') dynamicFrame.toolTip = 'Please check anything applicable.' self.__layout.addWidget(dynamicFrame) dynamicFrameLayout = qt.QVBoxLayout(dynamicFrame) # .. now pass the layout to the dynamicFrame self.dynamicFrame().setLayout(dynamicFrameLayout)
def __init__(self, name, configurationCB, models, hsize): ## target and entry point self.target = [] self.entry = [] #### Create a new GroupBOX i.e. a line self.row = qt.QGroupBox(configurationCB) self.hlayout = qt.QHBoxLayout(self.row) self.hlayout.setMargin(1) #### Create a new label self.name = qt.QLabel(name, self.row) self.name.setMaximumWidth(hsize[0]) self.name.setMaximumHeight(20) self.hlayout.addWidget(self.name) # Eletrode Length self.length = 0 #### Set the model list combo box self.model = qt.QComboBox(self.row) self.keys = list(models.keys()) self.keys.sort(reverse=True) self.model.addItems(self.keys) self.model.setMaximumWidth(hsize[1]) self.model.setMaximumHeight(20) self.model.setStyleSheet("qproperty-alignment: AlignCenter;") self.hlayout.addWidget(self.model) #### Tail Check Box self.tailCheckBox = qt.QCheckBox(self.row) self.tailCheckBox.setMaximumWidth(hsize[2]) self.tailCheckBox.setMaximumHeight(20) self.tailCheckBox.setStyleSheet("qproperty-alignment: AlignCenter;") self.hlayout.addWidget(self.tailCheckBox) ### Head CheckBox self.headCheckBox = qt.QCheckBox(self.row) self.headCheckBox.setMaximumWidth(hsize[3]) self.headCheckBox.setMaximumHeight(20) self.headCheckBox.setStyleSheet("qproperty-alignment: AlignCenter;") self.hlayout.addWidget(self.headCheckBox)
def updateLandmarkArray(self): """Rebuild the list of buttons based on current landmarks""" # reset the widget if self.landmarkGroupBox: self.landmarkGroupBox.setParent(None) self.landmarkGroupBox = qt.QGroupBox("Landmarks") self.landmarkGroupBox.setLayout(qt.QFormLayout()) # add the action buttons at the top actionButtons = qt.QHBoxLayout() self.addButton = qt.QPushButton("Add") self.addButton.connect('clicked()', self.addLandmark) actionButtons.addWidget(self.addButton) self.removeButton = qt.QPushButton("Remove") self.removeButton.connect('clicked()', self.removeLandmark) self.removeButton.enabled = False actionButtons.addWidget(self.removeButton) self.renameButton = qt.QPushButton("Rename") self.renameButton.connect('clicked()', self.renameLandmark) self.renameButton.enabled = False actionButtons.addWidget(self.renameButton) self.landmarkGroupBox.layout().addRow(actionButtons) # for now, hide these #self.addButton.hide() self.removeButton.hide() self.renameButton.hide() # make a button for each current landmark self.buttons = {} landmarks = self.logic.landmarksForVolumes(self.volumeNodes) keys = landmarks.keys() keys.sort() for landmarkName in keys: button = qt.QPushButton(landmarkName) button.connect('clicked()', lambda l=landmarkName: self.pickLandmark(l)) self.landmarkGroupBox.layout().addRow(button) self.buttons[landmarkName] = button self.landmarkArrayHolder.layout().addWidget(self.landmarkGroupBox) # observe manipulation of the landmarks self.addLandmarkObservers()
def createUserInterface(self): ''' ''' self.__layout = self.__parent.createUserInterface() # the anatomical tree anatomicalTreeGroupBox = qt.QGroupBox() anatomicalTreeGroupBox.setTitle('Atlas Map') self.__layout.addWidget(anatomicalTreeGroupBox) anatomicalTreeGroupBoxLayout = qt.QFormLayout(anatomicalTreeGroupBox) self.__anatomicalTree = PythonQt.qSlicerEMSegmentModuleWidgets.qSlicerEMSegmentAnatomicalTreeWidget( ) self.__anatomicalTree.structureNameEditable = False self.__anatomicalTree.labelColumnVisible = False self.__anatomicalTree.probabilityMapColumnVisible = True self.__anatomicalTree.parcellationMapColumnVisible = True self.__anatomicalTree.setSizePolicy(qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.MinimumExpanding) anatomicalTreeGroupBoxLayout.addWidget(self.__anatomicalTree)
def createUserInterface(self): """ This UI takes advantage of a pre-built slicer thresholding widget. """ self.__layout = self.__parent.createUserInterface() step_label = qt.QLabel( """Automatic segmentation with deep learning is not available in this demo, due to lack of computing resources. You may however create a segmentation using 3D Slicer's editor module in this step.""" ) step_label.setWordWrap(True) self.__informationGroupBox = qt.QGroupBox() self.__informationGroupBox.setTitle('Information') self.__informationGroupBoxLayout = qt.QFormLayout( self.__informationGroupBox) self.__informationGroupBoxLayout.addRow(step_label) self.__layout.addRow(self.__informationGroupBox) editorWidgetParent = slicer.qMRMLWidget() editorWidgetParent.setLayout(qt.QVBoxLayout()) editorWidgetParent.setMRMLScene(slicer.mrmlScene) self.EditorWidget = EditorWidget(parent=editorWidgetParent) self.EditorWidget.setup() self.__layout.addRow(editorWidgetParent) # self.__thresholdGroupBox = qt.QGroupBox() # self.__thresholdGroupBox.setTitle('Threshold Range') # self.__thresholdGroupBoxLayout = qt.QFormLayout(self.__thresholdGroupBox) # threshLabel = qt.QLabel('Select Intensity Range:') # threshLabel.alignment = 4 # self.__threshRange = slicer.qMRMLRangeWidget() # self.__threshRange.decimals = 0 # self.__threshRange.singleStep = 1 # self.__thresholdGroupBoxLayout.addRow(threshLabel) # self.__thresholdGroupBoxLayout.addRow(self.__threshRange) # self.__layout.addRow(self.__thresholdGroupBox) # self.__threshRange.connect('valuesChanged(double,double)', self.onThresholdChanged) qt.QTimer.singleShot(0, self.killButton)
def createUserInterface(self): """ As of now, this user interface is fairly simple. If there are other methods of normalization, they could be added here. """ self.__layout = self.__parent.createUserInterface() NormSubtractGroupBox = qt.QGroupBox() NormSubtractGroupBox.setTitle('Normalization and Subtraction Methods') self.__layout.addRow(NormSubtractGroupBox) NormSubtractGroupBoxLayout = qt.QFormLayout(NormSubtractGroupBox) self.__normalizationButton = qt.QPushButton( 'Run Gaussian Normalization') NormSubtractGroupBoxLayout.addRow(self.__normalizationButton) self.__subtractionButton = qt.QPushButton('Run Subtraction Algorithm') NormSubtractGroupBoxLayout.addRow(self.__subtractionButton) self.__normalizationButton.connect('clicked()', self.onNormalizationRequest) self.__subtractionButton.connect('clicked()', self.onSubtractionRequest)
def createUserInterface(self): """ This method uses qt to create a user interface of radio buttons to select a registration method. Note that BSpline registration is so slow and memory-consuming as to at one point break Slicer. There is an option to run it with limited memory, but this may take prohibitively long. <- NOTE this last comment was based on expert automated registration - not sure about other modules. """ self.__layout = self.__parent.createUserInterface() step_label = qt.QLabel( """This step allows you to pre-process your data as necessary for deep learning segmentation. Your data may already be preprocessed, in which case you can skip this step. Note that for proper deep learning segmentation, your data will need to be A) registered, and B) resampled into isotropic space. """) step_label.setWordWrap(True) self.__informationGroupBox = qt.QGroupBox() self.__informationGroupBox.setTitle('Information') self.__informationGroupBoxLayout = qt.QFormLayout( self.__informationGroupBox) self.__informationGroupBoxLayout.addRow(step_label) self.__layout.addRow(self.__informationGroupBox) self.__registrationCollapsibleButton = ctk.ctkCollapsibleButton() self.__registrationCollapsibleButton.text = "Registration" self.__layout.addWidget(self.__registrationCollapsibleButton) self.__registrationLayout = qt.QFormLayout( self.__registrationCollapsibleButton) # Moving/Fixed Image Registration Order Options OrderGroupBox = qt.QGroupBox() OrderGroupBox.setTitle('Registration Base Volume') self.__registrationLayout.addRow(OrderGroupBox) OrderGroupBoxLayout = qt.QFormLayout(OrderGroupBox) self.__OrderRadio1 = qt.QRadioButton("Register to T2.") self.__OrderRadio1.toolTip = "Your images will be registered to T2 space." OrderGroupBoxLayout.addRow(self.__OrderRadio1) self.__OrderRadio1.setChecked(True) self.__OrderRadio2 = qt.QRadioButton("Register to FLAIR") self.__OrderRadio2.toolTip = "Your images will be registered to FLAIR space." OrderGroupBoxLayout.addRow(self.__OrderRadio2) self.__OrderRadio3 = qt.QRadioButton("Register to post-contrast T1") self.__OrderRadio3.toolTip = "Your images will be registered to post-contrast T1 space." OrderGroupBoxLayout.addRow(self.__OrderRadio3) self.__OrderRadio4 = qt.QRadioButton("Register to pre-contrast T1") self.__OrderRadio4.toolTip = "Your images will be registered to pre-contrast T1 space." OrderGroupBoxLayout.addRow(self.__OrderRadio4) self.__orderMapping = dict( zip(self.volumeLabels, [ self.__OrderRadio1, self.__OrderRadio2, self.__OrderRadio3, self.__OrderRadio4 ])) # Registration Method Options RegistrationGroupBox = qt.QGroupBox() RegistrationGroupBox.setTitle('Registration Method') self.__registrationLayout.addRow(RegistrationGroupBox) RegistrationGroupBoxLayout = qt.QFormLayout(RegistrationGroupBox) self.__RegistrationRadio1 = qt.QRadioButton("Rigid Registration") self.__RegistrationRadio1.toolTip = """Computes a rigid registration on the pre-contrast image with respect to the post-contrast image. This will likely be the fastest registration method""" RegistrationGroupBoxLayout.addRow(self.__RegistrationRadio1) self.__RegistrationRadio2 = qt.QRadioButton("Affine Registration") self.__RegistrationRadio2.toolTip = "Computes a rigid and affine registration on the pre-contrast image with respect to the post-contrast image. This method may take longer than rigid registration, but has the ability to stretch or compress images in addition to rotation and translation." RegistrationGroupBoxLayout.addRow(self.__RegistrationRadio2) self.__RegistrationRadio2.setChecked(True) self.__RegistrationRadio3 = qt.QRadioButton("Deformable Registration") self.__RegistrationRadio3.toolTip = """Computes a BSpline Registration on the pre-contrast image with respect to the post-contrast image. This method is slowest and may be necessary for only severly distorted images.""" RegistrationGroupBoxLayout.addRow(self.__RegistrationRadio3) # Output Volume Preference OutputGroupBox = qt.QGroupBox() OutputGroupBox.setTitle('Registration Output') self.__registrationLayout.addRow(OutputGroupBox) OutputGroupBoxLayout = qt.QFormLayout(OutputGroupBox) self.__OutputRadio1 = qt.QRadioButton("Create new volume.") self.__OutputRadio1.toolTip = "A new volume will be created with the naming convention \"[pre]_reg_[post]\"." OutputGroupBoxLayout.addRow(self.__OutputRadio1) self.__OutputRadio1.setChecked(True) self.__OutputRadio2 = qt.QRadioButton("Replace existing volume.") self.__OutputRadio2.toolTip = "Your registered volume will be overwritten at the end of this step." OutputGroupBoxLayout.addRow(self.__OutputRadio2) # Registration Button and Progress Indicator RunGroupBox = qt.QGroupBox() RunGroupBox.setTitle('Run Registration') self.__registrationLayout.addRow(RunGroupBox) RunGroupBoxLayout = qt.QFormLayout(RunGroupBox) self.__registrationButton = qt.QPushButton('Run registration') self.__registrationStatus = qt.QLabel('Register scans') self.__registrationStatus.alignment = 4 # This codes for centered alignment, although I'm not sure why. RunGroupBoxLayout.addRow(self.__registrationStatus) RunGroupBoxLayout.addRow(self.__registrationButton) self.__registrationButton.connect('clicked()', self.onRegistrationRequest)
def createUserInterface(self): """ This method uses qt to create a user interface of radio buttons to select a registration method. Note that BSpline registration is so slow and memory-consuming as to at one point break Slicer. There is an option to run it with limited memory, but this may take prohibitively long. <- NOTE this last comment was based on expert automated registration - not sure about other modules. """ self.__layout = self.__parent.createUserInterface() step_label = qt.QLabel( """Select your preferred method of registration. If you have already registered your images, or no registration is required, check the option "No Registration." The moving image will be registered to the fixed image, and then resampled at the dimensions of the fixed image. Be aware that many other modules in Slicer have more complex and/or customizable registration methods, should you require more thorough registration. """) step_label.setWordWrap(True) self.__primaryGroupBox = qt.QGroupBox() self.__primaryGroupBox.setTitle('Information') self.__primaryGroupBoxLayout = qt.QFormLayout(self.__primaryGroupBox) self.__primaryGroupBoxLayout.addRow(step_label) self.__layout.addRow(self.__primaryGroupBox) # Moving/Fixed Image Registration Order Options OrderGroupBox = qt.QGroupBox() OrderGroupBox.setTitle('Registration Order') self.__layout.addRow(OrderGroupBox) OrderGroupBoxLayout = qt.QFormLayout(OrderGroupBox) self.__OrderRadio1 = qt.QRadioButton( "Register pre-contrast to post-contrast.") self.__OrderRadio1.toolTip = "Your pre-contrast image will be transformed." OrderGroupBoxLayout.addRow(self.__OrderRadio1) self.__OrderRadio1.setChecked(True) self.__OrderRadio2 = qt.QRadioButton( "Register post-contrast to pre-contrast.") self.__OrderRadio2.toolTip = "Your post-contrast image will be transformed." OrderGroupBoxLayout.addRow(self.__OrderRadio2) # Registration Method Options RegistrationGroupBox = qt.QGroupBox() RegistrationGroupBox.setTitle('Registration Method') self.__layout.addRow(RegistrationGroupBox) RegistrationGroupBoxLayout = qt.QFormLayout(RegistrationGroupBox) self.__RegistrationRadio1 = qt.QRadioButton("No Registration") self.__RegistrationRadio1.toolTip = "Performs no registration." RegistrationGroupBoxLayout.addRow(self.__RegistrationRadio1) self.__RegistrationRadio2 = qt.QRadioButton("Rigid Registration") self.__RegistrationRadio2.toolTip = """Computes a rigid registration on the pre-contrast image with respect to the post-contrast image. This will likely be the fastest registration method""" RegistrationGroupBoxLayout.addRow(self.__RegistrationRadio2) self.__RegistrationRadio3 = qt.QRadioButton("Affine Registration") self.__RegistrationRadio3.toolTip = "Computes a rigid and affine registration on the pre-contrast image with respect to the post-contrast image. This method may take longer than rigid registration, but has the ability to stretch or compress images in addition to rotation and translation." RegistrationGroupBoxLayout.addRow(self.__RegistrationRadio3) self.__RegistrationRadio3.setChecked(True) self.__RegistrationRadio4 = qt.QRadioButton("Deformable Registration") self.__RegistrationRadio4.toolTip = """Computes a BSpline Registration on the pre-contrast image with respect to the post-contrast image. This method is slowest and may be necessary for only severly distorted images.""" RegistrationGroupBoxLayout.addRow(self.__RegistrationRadio4) # Output Volume Preference OutputGroupBox = qt.QGroupBox() OutputGroupBox.setTitle('Registration Output') self.__layout.addRow(OutputGroupBox) OutputGroupBoxLayout = qt.QFormLayout(OutputGroupBox) self.__OutputRadio1 = qt.QRadioButton("Create new volume.") self.__OutputRadio1.toolTip = "A new volume will be created with the naming convention \"[pre]_reg_[post]\"." OutputGroupBoxLayout.addRow(self.__OutputRadio1) self.__OutputRadio1.setChecked(True) self.__OutputRadio2 = qt.QRadioButton("Replace existing volume.") self.__OutputRadio2.toolTip = "Your registered volume will be overwritten at the end of this step." OutputGroupBoxLayout.addRow(self.__OutputRadio2) # Registration Button and Progress Indicator RunGroupBox = qt.QGroupBox() RunGroupBox.setTitle('Run Registration') self.__layout.addRow(RunGroupBox) RunGroupBoxLayout = qt.QFormLayout(RunGroupBox) self.__registrationButton = qt.QPushButton('Run registration') self.__registrationStatus = qt.QLabel('Register scans') self.__registrationStatus.alignment = 4 # This codes for centered alignment, although I'm not sure why. RunGroupBoxLayout.addRow(self.__registrationStatus) RunGroupBoxLayout.addRow(self.__registrationButton) self.__registrationButton.connect('clicked()', self.onRegistrationRequest)
def createUserInterface( self ): self.__layout = qt.QFormLayout( self ) self.__layout.setVerticalSpacing( 5 ) # Add empty rows self.__layout.addRow( "", qt.QWidget() ) self.__layout.addRow( "", qt.QWidget() ) #label for ROI selector vertLabel = qt.QLabel( 'Vertebrae Labels:' ) font = vertLabel.font font.setBold(True) vertLabel.setFont(font) labelText = qt.QLabel("Add Labels: ") self.identify = qt.QPushButton("Click to Identify") self.identify.connect('clicked(bool)', self.addFiducials) self.identify.setMaximumWidth(170) blank = qt.QLabel(" ") blank.setMaximumWidth(30) self.vertebraeGridBox = qt.QFormLayout() self.vertebraeGridBox.addRow(vertLabel) self.vertebraeGridBox.addRow(labelText,self.identify) self.__layout.addRow(self.vertebraeGridBox) # Hide Threshold Details threshCollapsibleButton = ctk.ctkCollapsibleButton() #roiCollapsibleButton.setMaximumWidth(320) threshCollapsibleButton.text = "Bone Threshold Details" self.__layout.addWidget(threshCollapsibleButton) threshCollapsibleButton.collapsed = False # Layout threshLayout = qt.QFormLayout(threshCollapsibleButton) self.__loadThreshButton = qt.QPushButton("Show Threshold Label") threshLayout.addRow(self.__loadThreshButton) self.__loadThreshButton.connect('clicked(bool)', self.showThreshold) self.__corticalRange = slicer.qMRMLRangeWidget() self.__corticalRange.decimals = 0 self.__corticalRange.singleStep = 1 cortLabel = qt.QLabel('Choose Cortical Bone Threshold:') self.__corticalRange.connect('valuesChanged(double,double)', self.onCorticalChanged) threshLayout.addRow(cortLabel) threshLayout.addRow(self.__corticalRange) # Hide ROI Details roiCollapsibleButton = ctk.ctkCollapsibleButton() roiCollapsibleButton.text = "Advanced Options" self.__layout.addWidget(roiCollapsibleButton) roiCollapsibleButton.collapsed = True roiCollapsibleButton.visible = False # Layout roiLayout = qt.QFormLayout(roiCollapsibleButton) self.__loadLandmarksButton = qt.QPushButton("Show Crop Landmarks") roiLayout.addRow(self.__loadLandmarksButton) self.__loadLandmarksButton.connect('clicked(bool)', self.showLandmarks) #label for ROI selector roiLabel = qt.QLabel( 'Select ROI:' ) font = roiLabel.font font.setBold(True) roiLabel.setFont(font) #creates combobox and populates it with all vtkMRMLAnnotationROINodes in the scene self.__roiSelector = slicer.qMRMLNodeComboBox() self.__roiSelector.nodeTypes = ['vtkMRMLAnnotationROINode'] self.__roiSelector.toolTip = "ROI defining the structure of interest" self.__roiSelector.setMRMLScene(slicer.mrmlScene) self.__roiSelector.addEnabled = 1 #add label + combobox roiLayout.addRow( roiLabel, self.__roiSelector ) self.__roiSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onROIChanged) # the ROI parameters # GroupBox to hold ROI Widget voiGroupBox = qt.QGroupBox() voiGroupBox.setTitle( 'Define VOI' ) roiLayout.addRow( voiGroupBox ) # create form layout for GroupBox voiGroupBoxLayout = qt.QFormLayout( voiGroupBox ) # create ROI Widget and add it to the form layout of the GroupBox self.__roiWidget = PythonQt.qSlicerAnnotationsModuleWidgets.qMRMLAnnotationROIWidget() voiGroupBoxLayout.addRow( self.__roiWidget ) # Hide VR Details vrCollapsibleButton = ctk.ctkCollapsibleButton() #roiCollapsibleButton.setMaximumWidth(320) vrCollapsibleButton.text = "Rendering Details" self.__layout.addWidget(vrCollapsibleButton) vrCollapsibleButton.collapsed = True vrCollapsibleButton.visible = False # Layout vrLayout = qt.QFormLayout(vrCollapsibleButton) # the ROI parameters # GroupBox to hold ROI Widget vrGroupBox = qt.QGroupBox() vrGroupBox.setTitle( 'Define Rendering' ) vrLayout.addRow( vrGroupBox ) # create form layout for GroupBox vrGroupBoxLayout = qt.QFormLayout( vrGroupBox ) # create ROI Widget and add it to the form layout of the GroupBox self.__vrWidget = PythonQt.qSlicerVolumeRenderingModuleWidgets.qSlicerPresetComboBox() #self.__vrWidget = PythonQt.qSlicerVolumeRenderingModuleWidgets.qMRMLVolumePropertyNodeWidget() vrGroupBoxLayout.addRow( self.__vrWidget ) # initialize VR self.__vrLogic = slicer.modules.volumerendering.logic() lm = slicer.app.layoutManager() redWidget = lm.sliceWidget('Red') self.__redController = redWidget.sliceController() self.__redLogic = redWidget.sliceLogic() yellowWidget = lm.sliceWidget('Yellow') self.__yellowController = yellowWidget.sliceController() self.__yellowLogic = yellowWidget.sliceLogic() greenWidget = lm.sliceWidget('Green') self.__greenController = greenWidget.sliceController() self.__greenLogic = greenWidget.sliceLogic() qt.QTimer.singleShot(0, self.killButton)
def setup(self): """Instantiate and connect widgets ...""" self.scene = slicer.mrmlScene self.icp = vtk.vtkIterativeClosestPointTransform() # # Reload and Test area # reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # reload button # (use this during development, but remove it when delivering # your module to users) self.reloadButton = qt.QPushButton("Reload") self.reloadButton.toolTip = "Reload this module." self.reloadButton.name = "SurfaceICPRegistration Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # reload and test button # (use this during development, but remove it when delivering # your module to users) self.reloadAndTestButton = qt.QPushButton("Reload and Test") self.reloadAndTestButton.toolTip = "Reload this module and then run the self tests." reloadFormLayout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest) # # Input Surface Volume Collapsible Button # inputSurfaceCollapsibleButton = ctk.ctkCollapsibleButton() inputSurfaceCollapsibleButton.text = "Input Surface Volumes" self.layout.addWidget(inputSurfaceCollapsibleButton) inputSurfaceFormLayout = qt.QFormLayout(inputSurfaceCollapsibleButton) # # Input Surface Volume Options # self.modelSelectors = {} self.viewNames = ("Fixed Surface Volume", "Moving Surface Volume") for viewName in self.viewNames: self.modelSelectors[viewName] = slicer.qMRMLNodeComboBox() self.modelSelectors[viewName].nodeTypes = (("vtkMRMLModelNode"), "") self.modelSelectors[viewName].selectNodeUponCreation = False self.modelSelectors[viewName].addEnabled = False self.modelSelectors[viewName].removeEnabled = True self.modelSelectors[viewName].noneEnabled = True self.modelSelectors[viewName].showHidden = False self.modelSelectors[viewName].showChildNodeTypes = True self.modelSelectors[viewName].setMRMLScene(slicer.mrmlScene) self.modelSelectors[viewName].setToolTip( "Pick the %s surface volume." % viewName.lower()) inputSurfaceFormLayout.addRow("%s" % viewName, self.modelSelectors[viewName]) # # Input Inicial Transform Options # self.volumeInitialTransformSelectors = {} self.volumeInitialTransformSelectors[ "Initial Transform"] = slicer.qMRMLNodeComboBox() self.volumeInitialTransformSelectors["Initial Transform"].nodeTypes = ( ("vtkMRMLLinearTransformNode"), "") self.volumeInitialTransformSelectors[ "Initial Transform"].selectNodeUponCreation = False self.volumeInitialTransformSelectors[ "Initial Transform"].addEnabled = False self.volumeInitialTransformSelectors[ "Initial Transform"].removeEnabled = True self.volumeInitialTransformSelectors[ "Initial Transform"].noneEnabled = True self.volumeInitialTransformSelectors[ "Initial Transform"].showHidden = False self.volumeInitialTransformSelectors[ "Initial Transform"].showChildNodeTypes = True self.volumeInitialTransformSelectors["Initial Transform"].setMRMLScene( slicer.mrmlScene) self.volumeInitialTransformSelectors["Initial Transform"].setToolTip( "Pick the initial Transform file") inputSurfaceFormLayout.addRow( "(Optional) Initial Transform", self.volumeInitialTransformSelectors["Initial Transform"]) # # Input Registration Parameters Collapsible Button # inputRegistrationParametersCollapsibleButton = ctk.ctkCollapsibleButton( ) inputRegistrationParametersCollapsibleButton.text = "Input Registration Parameters" self.layout.addWidget(inputRegistrationParametersCollapsibleButton) inputRegistrationParametersFormLayout = qt.QFormLayout( inputRegistrationParametersCollapsibleButton) # # Landmark Transform Mode TYPE SELECTION # - allows selection of the active registration type to display # self.landmarkTransformTypeBox = qt.QGroupBox("Landmark Transform Mode") self.landmarkTransformTypeBox.setLayout(qt.QFormLayout()) self.landmarkTransformTypeButtons = {} self.landmarkTransformTypes = ("RigidBody", "Similarity", "Affine") for landmarkTransformType in self.landmarkTransformTypes: self.landmarkTransformTypeButtons[ landmarkTransformType] = qt.QRadioButton() self.landmarkTransformTypeButtons[ landmarkTransformType].text = landmarkTransformType self.landmarkTransformTypeButtons[ landmarkTransformType].setToolTip( "Pick the type of registration") self.landmarkTransformTypeButtons[landmarkTransformType].connect( "clicked()", lambda t=landmarkTransformType: self.onLandmarkTrandformType(t )) self.landmarkTransformTypeBox.layout().addWidget( self.landmarkTransformTypeButtons[landmarkTransformType]) inputRegistrationParametersFormLayout.addWidget( self.landmarkTransformTypeBox) # # Mean Distance Mode TYPE SELECTION # self.meanDistanceTypeBox = qt.QGroupBox("Mean Distance Mode") self.meanDistanceTypeBox.setLayout(qt.QFormLayout()) self.meanDistanceTypeButtons = {} self.meanDistanceTypes = ("RMS", "Absolute Value") inputRegistrationParametersFormLayout.addWidget( self.landmarkTransformTypeBox) for meanDistanceType in self.meanDistanceTypes: self.meanDistanceTypeButtons[meanDistanceType] = qt.QRadioButton() self.meanDistanceTypeButtons[ meanDistanceType].text = meanDistanceType self.meanDistanceTypeButtons[meanDistanceType].setToolTip( "Pick the type of registration") self.meanDistanceTypeButtons[meanDistanceType].connect( "clicked()", lambda t=meanDistanceType: self.onMeanDistanceType(t)) self.meanDistanceTypeBox.layout().addWidget( self.meanDistanceTypeButtons[meanDistanceType]) inputRegistrationParametersFormLayout.addWidget( self.meanDistanceTypeBox) # # Start by Matching Centroids Options # self.startMatchingCentroids = qt.QCheckBox() self.startMatchingCentroids.checked = True self.startMatchingCentroids.connect("toggled(bool)", self.onMatchCentroidsLinearActive) inputRegistrationParametersFormLayout.addRow( "Start by matching centroids ", self.startMatchingCentroids) # # Check Mean Distance Options # self.checkMeanDistance = qt.QCheckBox() self.checkMeanDistance.checked = True self.checkMeanDistance.connect("toggled(bool)", self.onCheckMeanDistanceActive) inputRegistrationParametersFormLayout.addRow("Check Mean Distance ", self.checkMeanDistance) # Number of Iterations numberOfIterations = ctk.ctkSliderWidget() numberOfIterations.connect('valueChanged(double)', self.numberOfIterationsValueChanged) numberOfIterations.decimals = 0 numberOfIterations.minimum = 50 numberOfIterations.maximum = 80000 numberOfIterations.value = 50 inputRegistrationParametersFormLayout.addRow("Number of Iterations:", numberOfIterations) # Number of Landmarks numberOfLandmarks = ctk.ctkSliderWidget() numberOfLandmarks.connect('valueChanged(double)', self.numberOfLandmarksValueChanged) numberOfLandmarks.decimals = 0 numberOfLandmarks.minimum = 0 numberOfLandmarks.maximum = 10000 numberOfLandmarks.value = 200 inputRegistrationParametersFormLayout.addRow("Number of Landmarks:", numberOfLandmarks) # Maximum Distance maxDistance = ctk.ctkSliderWidget() maxDistance.connect('valueChanged(double)', self.maxDistanceValueChanged) maxDistance.decimals = 4 maxDistance.minimum = 0.0001 maxDistance.maximum = 10 maxDistance.value = 0.01 inputRegistrationParametersFormLayout.addRow("Maximum Distance:", maxDistance) # # Output Surface Collapsible Button # outputSurfaceCollapsibleButton = ctk.ctkCollapsibleButton() outputSurfaceCollapsibleButton.text = "Output Files" self.layout.addWidget(outputSurfaceCollapsibleButton) outputSurfaceFormLayout = qt.QFormLayout( outputSurfaceCollapsibleButton) # # Output Surface Volume Options # self.modelOutputSurfaceSelectors = {} self.modelOutputSurfaceSelectors[ "Output Surface Volume"] = slicer.qMRMLNodeComboBox() self.modelOutputSurfaceSelectors["Output Surface Volume"].nodeTypes = ( ("vtkMRMLModelNode"), "") self.modelOutputSurfaceSelectors[ "Output Surface Volume"].addEnabled = True self.modelOutputSurfaceSelectors[ "Output Surface Volume"].selectNodeUponCreation = True self.modelOutputSurfaceSelectors[ "Output Surface Volume"].removeEnabled = True self.modelOutputSurfaceSelectors[ "Output Surface Volume"].noneEnabled = True self.modelOutputSurfaceSelectors[ "Output Surface Volume"].showHidden = False self.modelOutputSurfaceSelectors[ "Output Surface Volume"].showChildNodeTypes = True self.modelOutputSurfaceSelectors["Output Surface Volume"].setMRMLScene( slicer.mrmlScene) self.modelOutputSurfaceSelectors["Output Surface Volume"].setToolTip( "Pick the Output Surface Volume") outputSurfaceFormLayout.addRow( "Output Surface Volume", self.modelOutputSurfaceSelectors["Output Surface Volume"]) # # Output Transform Options # self.volumeOutputTransformSelectors = {} self.volumeOutputTransformSelectors[ "Output Transform"] = slicer.qMRMLNodeComboBox() self.volumeOutputTransformSelectors["Output Transform"].nodeTypes = (( "vtkMRMLLinearTransformNode"), "") self.volumeOutputTransformSelectors[ "Output Transform"].selectNodeUponCreation = True self.volumeOutputTransformSelectors[ "Output Transform"].addEnabled = True self.volumeOutputTransformSelectors[ "Output Transform"].removeEnabled = True self.volumeOutputTransformSelectors[ "Output Transform"].noneEnabled = True self.volumeOutputTransformSelectors[ "Output Transform"].showHidden = False self.volumeOutputTransformSelectors[ "Output Transform"].showChildNodeTypes = True self.volumeOutputTransformSelectors["Output Transform"].setMRMLScene( slicer.mrmlScene) self.volumeOutputTransformSelectors["Output Transform"].setToolTip( "Pick the Output Transform file") outputSurfaceFormLayout.addRow( "Output Transform", self.volumeOutputTransformSelectors["Output Transform"]) # # Apply Button # self.applyButton = qt.QPushButton("Run Registration") self.applyButton.toolTip = "Run the registration algorithm." self.applyButton.enabled = True outputSurfaceFormLayout.addRow(self.applyButton) # connections self.applyButton.connect('clicked(bool)', self.onApplyButton) #for selector in self.volumeSelectors.values(): # selector.connect("currentNodeChanged(vtkMRMLNode*)", self.onApplyButton) #self.volumeInitialTransformSelectors.values().connect('currentNodeChanged(vtkMRMLNode*)', self.onVolumeInitialTransformSelect) # listen to the scene #self.addObservers() # Add vertical spacer self.layout.addStretch(1)
def createUserInterface(self): ''' ''' self.__layout = self.__parent.createUserInterface() # deactivate next button since it is the last step self.buttonBoxHints = self.NextButtonDisabled # the ROI parameters voiGroupBox = qt.QGroupBox() voiGroupBox.setTitle('Define VOI') self.__layout.addWidget(voiGroupBox) voiGroupBoxLayout = qt.QFormLayout(voiGroupBox) self.__roiWidget = PythonQt.qSlicerAnnotationsModuleWidgets.qMRMLAnnotationROIWidget( ) voiGroupBoxLayout.addWidget(self.__roiWidget) self.__roi = slicer.vtkMRMLAnnotationROINode() self.__roi.SetXYZ([0, 0, 0]) self.__roi.SetRadiusXYZ(100, 100, 100) self.__roi.Initialize(slicer.mrmlScene) self.__roi.AddObserver(vtk.vtkCommand.ModifiedEvent, self.updateMRMLFromROI) self.__roiWidget.setMRMLAnnotationROINode(self.__roi) self.__roiWidget.setDisplayClippingBox(0) # # save groupbox # saveGroupBox = qt.QGroupBox() saveGroupBox.setTitle('Save') self.__layout.addWidget(saveGroupBox) saveGroupBoxLayout = qt.QFormLayout(saveGroupBox) self.__saveButton = qt.QPushButton('Create') saveGroupBoxLayout.addRow("Create Template File:", self.__saveButton) self.__saveButton.connect('clicked()', self.onSaveButtonClicked) self.__saveIntermediateResultsCheckBox = qt.QCheckBox() saveGroupBoxLayout.addRow("Save Intermediate Results:", self.__saveIntermediateResultsCheckBox) self.__saveIntermediateResultsCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__selectDirectoryButton = qt.QPushButton('Select') saveGroupBoxLayout.addRow("Select Intermediate Directory:", self.__selectDirectoryButton) self.__selectDirectoryButton.connect( 'clicked()', self.onSelectDirectoryButtonClicked) # # post processing groupbox # postProcessingGroupBox = qt.QGroupBox() postProcessingGroupBox.setTitle('Postprocessing') self.__layout.addWidget(postProcessingGroupBox) postProcessingGroupBoxLayout = qt.QFormLayout(postProcessingGroupBox) self.__subparcellationCheckBox = qt.QCheckBox() postProcessingGroupBoxLayout.addRow("Subparcellation enabled:", self.__subparcellationCheckBox) self.__subparcellationCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__minimumIslandSizeSpinBox = qt.QSpinBox() self.__minimumIslandSizeSpinBox.minimum = 0 self.__minimumIslandSizeSpinBox.maximum = 200 self.__minimumIslandSizeSpinBox.singleStep = 1 postProcessingGroupBoxLayout.addRow("Minimum island size:", self.__minimumIslandSizeSpinBox) self.__minimumIslandSizeSpinBox.connect('stateChanged(int)', self.propagateToMRML) self.__twoDIslandNeighborhoodCheckBox = qt.QCheckBox() postProcessingGroupBoxLayout.addRow( "2D Island Neighborhood:", self.__twoDIslandNeighborhoodCheckBox) self.__twoDIslandNeighborhoodCheckBox.connect('stateChanged(int)', self.propagateToMRML) # # Misc. groupbox # miscGroupBox = qt.QGroupBox() miscGroupBox.setTitle('Misc.') self.__layout.addWidget(miscGroupBox) miscGroupBoxLayout = qt.QFormLayout(miscGroupBox) self.__multithreadingCheckBox = qt.QCheckBox() miscGroupBoxLayout.addRow("Multi-threading enabled:", self.__multithreadingCheckBox) self.__multithreadingCheckBox.connect('stateChanged(int)', self.propagateToMRML)
def createUserInterface(self): ''' ''' self.__layout = super(EMSegmentEditNodeBasedParametersStep, self).createUserInterface() self.__top = qt.QWidget() self.__topLayout = qt.QHBoxLayout(self.__top) # the anatomical tree self.__anatomicalTreeGroupBox = qt.QGroupBox() self.__anatomicalTreeGroupBox.setTitle('Anatomical Tree') self.__topLayout.addWidget(self.__anatomicalTreeGroupBox) self.__anatomicalTreeGroupBoxLayout = qt.QFormLayout( self.__anatomicalTreeGroupBox) self.__anatomicalTree = slicer.modulewidget.qSlicerEMSegmentAnatomicalTreeWidget( ) self.__anatomicalTree.structureNameEditable = False self.__anatomicalTree.labelColumnVisible = False self.__anatomicalTree.probabilityMapColumnVisible = False self.__anatomicalTree.classWeightColumnVisible = False self.__anatomicalTree.updateClassWeightColumnVisible = False self.__anatomicalTree.atlasWeightColumnVisible = False self.__anatomicalTree.alphaColumnVisible = False self.__anatomicalTree.displayAlphaCheckBoxVisible = False self.__anatomicalTree.connect('currentTreeNodeChanged(vtkMRMLNode*)', self.onTreeSelectionChanged) self.__anatomicalTree.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self.__anatomicalTree.toolTip = 'Select an anatomical structure to configure the probablity in relation to other structures on the same level.' self.__anatomicalTree.setMinimumHeight(200) self.__anatomicalTreeGroupBoxLayout.addWidget(self.__anatomicalTree) # # overview of class weights panel # self.__overviewBox = qt.QGroupBox() self.__overviewBox.title = 'Overview of Class Weights' self.__overviewBox.toolTip = 'These are your guesses of probability relations between structures. Which structure takes how much percentage of the volume?' self.__overviewBoxLayout = qt.QVBoxLayout(self.__overviewBox) self.__topLayout.addWidget(self.__overviewBox) self.__layout.addWidget(self.__top) self.__tabWidget = qt.QTabWidget() self.__layout.addWidget(self.__tabWidget) # # basicPage # self.__basicPage = qt.QWidget() self.__basicPageLayout = qt.QHBoxLayout(self.__basicPage) self.__basicPageLeft = qt.QWidget() self.__basicPageRight = qt.QWidget() self.__basicPageLayoutLeft = qt.QFormLayout(self.__basicPageLeft) self.__basicPageLayoutRight = qt.QFormLayout(self.__basicPageRight) self.__basicPageLayout.addWidget(self.__basicPageLeft) self.__basicPageLayout.addWidget(self.__basicPageRight) self.__classLabel = qt.QLabel("XX") self.__basicPageLayoutLeft.addRow("Class:", self.__classLabel) self.__classWeightSpinBox = qt.QDoubleSpinBox() self.__classWeightSpinBox.minimum = 0 self.__classWeightSpinBox.maximum = 1 self.__classWeightSpinBox.singleStep = 0.01 self.__classWeightSpinBox.toolTip = 'Configure the class weight for the selected structure.' self.__basicPageLayoutLeft.addRow("Class Weight:", self.__classWeightSpinBox) self.__classWeightSpinBox.connect('valueChanged(double)', self.propagateToMRML) self.__atlasWeightSpinBox = qt.QDoubleSpinBox() self.__atlasWeightSpinBox.minimum = 0 self.__atlasWeightSpinBox.maximum = 1 self.__atlasWeightSpinBox.singleStep = 0.01 self.__atlasWeightSpinBox.toolTip = 'Configure the atlas weight for the selected structure.' self.__basicPageLayoutLeft.addRow("Atlas Weight:", self.__atlasWeightSpinBox) self.__atlasWeightSpinBox.connect('valueChanged(double)', self.propagateToMRML) self.__mfaWeightSpinBox = qt.QDoubleSpinBox() self.__mfaWeightSpinBox.minimum = 0 self.__mfaWeightSpinBox.maximum = 1 self.__mfaWeightSpinBox.singleStep = 0.01 self.__mfaWeightSpinBox.toolTip = 'Configure the MFA weight for the selected class.' self.__basicPageLayoutLeft.addRow("MFA Weight:", self.__mfaWeightSpinBox) self.__mfaWeightSpinBox.connect('valueChanged(double)', self.propagateToMRML) self.__dummyLabel6 = qt.QLabel(" ") self.__basicPageLayoutRight.addRow(" ", self.__dummyLabel6) self.__dummyLabel9 = qt.QLabel(" ") self.__basicPageLayoutRight.addRow(" ", self.__dummyLabel9) self.__inputChannelWeightsBox = qt.QGroupBox() self.__inputChannelWeightsBox.title = 'Dataset Channel Weights' self.__inputChannelWeightsBox.toolTip = 'Configure different weights for each input dataset.' self.__inputChannelWeightsBoxLayout = qt.QFormLayout( self.__inputChannelWeightsBox) self.__basicPageLayoutRight.addWidget(self.__inputChannelWeightsBox) # # stoppingConditionsPage # self.__stoppingConditionsPage = qt.QWidget() self.__stoppingConditionsPageLayout = qt.QHBoxLayout( self.__stoppingConditionsPage) self.__stoppingConditionsPageLeft = qt.QWidget() self.__stoppingConditionsPageRight = qt.QWidget() self.__stoppingConditionsPageLayoutLeft = qt.QFormLayout( self.__stoppingConditionsPageLeft) self.__stoppingConditionsPageLayoutRight = qt.QFormLayout( self.__stoppingConditionsPageRight) self.__stoppingConditionsPageLayout.addWidget( self.__stoppingConditionsPageLeft) self.__stoppingConditionsPageLayout.addWidget( self.__stoppingConditionsPageRight) self.__classLabel2 = qt.QLabel("XX") self.__stoppingConditionsPageLayoutLeft.addRow("Class:", self.__classLabel2) self.__emComboBox = qt.QComboBox() self.__emComboBox.addItems(Helper.GetStoppingConditionTypes()) self.__emComboBox.toolTip = 'Configure the EM Stopping Condition for the selected class.' self.__stoppingConditionsPageLayoutLeft.addRow('EM:', self.__emComboBox) self.__emComboBox.connect('currentIndexChanged(int)', self.propagateToMRML) self.__mfaComboBox = qt.QComboBox() self.__mfaComboBox.addItems(Helper.GetStoppingConditionTypes()) self.__mfaComboBox.toolTip = 'Configure the MFA Stopping Condition for the selected class.' self.__stoppingConditionsPageLayoutLeft.addRow('MFA:', self.__mfaComboBox) self.__mfaComboBox.connect('currentIndexChanged(int)', self.propagateToMRML) self.__dummyLabel = qt.QLabel(" ") self.__stoppingConditionsPageLayoutRight.addRow( " ", self.__dummyLabel) self.__emValueSpinBox = qt.QSpinBox() self.__emValueSpinBox.minimum = 0 self.__emValueSpinBox.singleStep = 1 self.__emValueSpinBox.toolTip = 'Configure the value for the EM stopping condition.' self.__stoppingConditionsPageLayoutRight.addRow( 'Iterations:', self.__emValueSpinBox) self.__emValueSpinBox.connect('valueChanged(int)', self.propagateToMRML) self.__mfaValueSpinBox = qt.QSpinBox() self.__mfaValueSpinBox.minimum = 0 self.__mfaValueSpinBox.singleStep = 1 self.__mfaValueSpinBox.toolTip = 'Configure the MFA stopping condition. More iterations result in more smoothing.' self.__stoppingConditionsPageLayoutRight.addRow( 'Iterations:', self.__mfaValueSpinBox) self.__mfaValueSpinBox.connect('valueChanged(int)', self.propagateToMRML) self.__biasSpinBox = qt.QSpinBox() self.__biasSpinBox.minimum = -1 self.__biasSpinBox.singleStep = 1 self.__biasSpinBox.toolTip = 'Enable Bias Correction: -1, turn it off: 0.' self.__stoppingConditionsPageLayoutRight.addRow( 'Bias Iterations:', self.__biasSpinBox) self.__biasSpinBox.connect('valueChanged(int)', self.propagateToMRML) # # printPage # self.__printPage = qt.QWidget() self.__printPageLayout = qt.QHBoxLayout(self.__printPage) self.__printPageLeft = qt.QWidget() self.__printPageRight = qt.QWidget() self.__printPageLayoutLeft = qt.QFormLayout(self.__printPageLeft) self.__printPageLayoutRight = qt.QFormLayout(self.__printPageRight) self.__printPageLayout.addWidget(self.__printPageLeft) self.__printPageLayout.addWidget(self.__printPageRight) self.__classLabel3 = qt.QLabel("XX") self.__printPageLayoutLeft.addRow("Class:", self.__classLabel3) self.__weightCheckBox = qt.QCheckBox() self.__printPageLayoutLeft.addRow("Weight:", self.__weightCheckBox) self.__weightCheckBox.toolTip = 'Toggle to print the weights.' self.__weightCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__qualityCheckBox = qt.QCheckBox() self.__printPageLayoutLeft.addRow("Quality:", self.__qualityCheckBox) self.__qualityCheckBox.toolTip = 'Toggle to print the quality.' self.__qualityCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__frequencySpinBox = qt.QSpinBox() self.__frequencySpinBox.minimum = 0 self.__frequencySpinBox.maximum = 20 self.__frequencySpinBox.toolTip = 'Configure the print frequency.' self.__printPageLayoutLeft.addRow("Frequency:", self.__frequencySpinBox) self.__frequencySpinBox.connect('valueChanged(int)', self.propagateToMRML) self.__biasCheckBox = qt.QCheckBox() self.__biasCheckBox.toolTip = 'Toggle to print the bias.' self.__printPageLayoutLeft.addRow("Bias:", self.__biasCheckBox) self.__biasCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__labelMapCheckBox = qt.QCheckBox() self.__labelMapCheckBox.toolTip = 'Toggle to print the label map.' self.__printPageLayoutLeft.addRow("Label Map:", self.__labelMapCheckBox) self.__labelMapCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__dummyLabel2 = qt.QLabel(" ") self.__printPageLayoutRight.addRow(" ", self.__dummyLabel2) self.__dummyLabel3 = qt.QLabel(" ") self.__printPageLayoutRight.addRow(" ", self.__dummyLabel3) self.__convergenceBox = qt.QGroupBox() self.__convergenceBox.title = 'Convergence' self.__convergenceBoxLayout = qt.QFormLayout(self.__convergenceBox) self.__printPageLayoutRight.addWidget(self.__convergenceBox) self.__convEMLabelMapCheckBox = qt.QCheckBox() self.__convEMLabelMapCheckBox.toolTip = 'Toggle to print the EM Label Map convergence.' self.__convergenceBoxLayout.addRow("EM Label Map:", self.__convEMLabelMapCheckBox) self.__convEMLabelMapCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__convEMWeightsCheckBox = qt.QCheckBox() self.__convEMWeightsCheckBox.toolTip = 'Toggle to print the EM Weights convergence.' self.__convergenceBoxLayout.addRow("EM Weights:", self.__convEMWeightsCheckBox) self.__convEMWeightsCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__convMFALabelMapCheckBox = qt.QCheckBox() self.__convEMWeightsCheckBox.toolTip = 'Toggle to print the MFA Label Map convergence.' self.__convergenceBoxLayout.addRow("MFA Label Map:", self.__convMFALabelMapCheckBox) self.__convMFALabelMapCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__convMFAWeightsCheckBox = qt.QCheckBox() self.__convMFAWeightsCheckBox.toolTip = 'Toggle to print the MFA Weights convergence.' self.__convergenceBoxLayout.addRow("MFA Weights:", self.__convMFAWeightsCheckBox) self.__convMFAWeightsCheckBox.connect('stateChanged(int)', self.propagateToMRML) # # advancedPage # self.__advancedPage = qt.QWidget() self.__advancedPageLayout = qt.QFormLayout(self.__advancedPage) self.__dummyLabel14 = qt.QLabel(" ") self.__advancedPageLayout.addWidget(self.__dummyLabel14) self.__classLabel4 = qt.QLabel("Class: XX") self.__advancedPageLayout.addWidget(self.__classLabel4) # self.__pcaParametersBox = qt.QGroupBox() # self.__pcaParametersBox.title = 'PCA Parameters' # self.__pcaParametersBoxLayout = qt.QFormLayout( self.__pcaParametersBox ) # self.__advancedPageLayout.addWidget( self.__pcaParametersBox ) # # self.__registrationParametersBox = qt.QGroupBox() # self.__registrationParametersBox.title = 'Registration Parameters' # self.__registrationParametersBoxLayout = qt.QFormLayout( self.__registrationParametersBox ) # self.__advancedPageLayout.addWidget( self.__registrationParametersBox ) self.__miscParametersBox = qt.QGroupBox() self.__miscParametersBox.title = 'Miscellaneous Parameters' self.__miscParametersBoxLayout = qt.QFormLayout( self.__miscParametersBox) self.__advancedPageLayout.addWidget(self.__miscParametersBox) self.__excludeFromEStepCheckBox = qt.QCheckBox() self.__excludeFromEStepCheckBox.toolTip = 'Toggle to exclude from Incomplete EStep.' self.__miscParametersBoxLayout.addRow("Exclude From Incomplete EStep:", self.__excludeFromEStepCheckBox) self.__excludeFromEStepCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__genBackgroundProbCheckBox = qt.QCheckBox() self.__genBackgroundProbCheckBox.toolTip = 'Toggle to detect the background value.' self.__miscParametersBoxLayout.addRow( "Generate Background Probability:", self.__genBackgroundProbCheckBox) self.__genBackgroundProbCheckBox.connect('stateChanged(int)', self.propagateToMRML) self.__meanFieldParametersBox = qt.QGroupBox() self.__meanFieldParametersBox.title = 'Mean Field Parameters' self.__meanFieldParametersBoxLayout = qt.QFormLayout( self.__meanFieldParametersBox) self.__advancedPageLayout.addWidget(self.__meanFieldParametersBox) self.__twoDNeighborhoodCheckBox = qt.QCheckBox() self.__twoDNeighborhoodCheckBox.toolTip = 'Toggle to use 2D Neighborhood.' self.__meanFieldParametersBoxLayout.addRow( "2D Neighborhood:", self.__twoDNeighborhoodCheckBox) self.__twoDNeighborhoodCheckBox.connect('stateChanged(int)', self.propagateToMRML) # self.__inhomogeneityParametersBox = qt.QGroupBox() # self.__inhomogeneityParametersBox.title = 'Inhomogeneity Parameters' # self.__inhomogeneityParametersBoxLayout = qt.QFormLayout( self.__inhomogeneityParametersBox ) # self.__advancedPageLayout.addWidget( self.__inhomogeneityParametersBox ) # ### add all tabs to the tabWidget # self.__tabWidget.addTab(self.__basicPage, "Basic") self.__tabWidget.addTab(self.__stoppingConditionsPage, "Stopping Conditions") self.__tabWidget.addTab(self.__printPage, "Print") self.__tabWidget.addTab(self.__advancedPage, "Advanced")
def createUserInterface( self ): ''' ''' self.__layout = self.__parent.createUserInterface() self.__top = qt.QWidget() self.__topLayout = qt.QHBoxLayout( self.__top ) # the anatomical tree self.__anatomicalTreeGroupBox = qt.QGroupBox() self.__anatomicalTreeGroupBox.setTitle( 'Anatomical Tree' ) self.__topLayout.addWidget( self.__anatomicalTreeGroupBox ) self.__anatomicalTreeGroupBoxLayout = qt.QFormLayout( self.__anatomicalTreeGroupBox ) self.__anatomicalTree = PythonQt.qSlicerEMSegmentModuleWidgets.qSlicerEMSegmentAnatomicalTreeWidget() self.__anatomicalTree.structureNameEditable = False self.__anatomicalTree.labelColumnVisible = False self.__anatomicalTree.probabilityMapColumnVisible = False self.__anatomicalTree.classWeightColumnVisible = False self.__anatomicalTree.updateClassWeightColumnVisible = False self.__anatomicalTree.atlasWeightColumnVisible = False self.__anatomicalTree.alphaColumnVisible = False self.__anatomicalTree.displayAlphaCheckBoxVisible = False self.__anatomicalTree.connect( 'currentTreeNodeChanged(vtkMRMLNode*)', self.onTreeSelectionChanged ) self.__anatomicalTree.setSizePolicy( qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding ) self.__anatomicalTreeGroupBoxLayout.addWidget( self.__anatomicalTree ) # # overview of class weights panel # self.__overviewBox = qt.QGroupBox() self.__overviewBox.title = 'Overview of Class Weights' self.__overviewBoxLayout = qt.QVBoxLayout( self.__overviewBox ) self.__topLayout.addWidget( self.__overviewBox ) self.__layout.addWidget( self.__top ) self.__tabWidget = qt.QTabWidget() self.__layout.addWidget( self.__tabWidget ) # # basicPage # self.__basicPage = qt.QWidget() self.__basicPageLayout = qt.QHBoxLayout( self.__basicPage ) self.__basicPageLeft = qt.QWidget() self.__basicPageRight = qt.QWidget() self.__basicPageLayoutLeft = qt.QFormLayout( self.__basicPageLeft ) self.__basicPageLayoutRight = qt.QFormLayout( self.__basicPageRight ) self.__basicPageLayout.addWidget( self.__basicPageLeft ) self.__basicPageLayout.addWidget( self.__basicPageRight ) self.__classLabel = qt.QLabel( "XX" ) self.__basicPageLayoutLeft.addRow( "Class:", self.__classLabel ) self.__classWeightSpinBox = qt.QDoubleSpinBox() self.__classWeightSpinBox.minimum = 0 self.__classWeightSpinBox.maximum = 1 self.__classWeightSpinBox.singleStep = 0.01 self.__basicPageLayoutLeft.addRow( "Class Weight:", self.__classWeightSpinBox ) self.__classWeightSpinBox.connect( 'valueChanged(double)', self.propagateToMRML ) self.__atlasWeightSpinBox = qt.QDoubleSpinBox() self.__atlasWeightSpinBox.minimum = 0 self.__atlasWeightSpinBox.maximum = 1 self.__atlasWeightSpinBox.singleStep = 0.01 self.__basicPageLayoutLeft.addRow( "Atlas Weight:", self.__atlasWeightSpinBox ) self.__atlasWeightSpinBox.connect( 'valueChanged(double)', self.propagateToMRML ) self.__mfaWeightSpinBox = qt.QDoubleSpinBox() self.__mfaWeightSpinBox.minimum = 0 self.__mfaWeightSpinBox.maximum = 1 self.__mfaWeightSpinBox.singleStep = 0.01 self.__basicPageLayoutLeft.addRow( "MFA Weight:", self.__mfaWeightSpinBox ) self.__mfaWeightSpinBox.connect( 'valueChanged(double)', self.propagateToMRML ) self.__dummyLabel6 = qt.QLabel( " " ) self.__basicPageLayoutRight.addRow( " ", self.__dummyLabel6 ) self.__dummyLabel9 = qt.QLabel( " " ) self.__basicPageLayoutRight.addRow( " ", self.__dummyLabel9 ) self.__inputChannelWeightsBox = qt.QGroupBox() self.__inputChannelWeightsBox.title = 'Input Channel Weights' self.__inputChannelWeightsBoxLayout = qt.QFormLayout( self.__inputChannelWeightsBox ) self.__basicPageLayoutRight.addWidget( self.__inputChannelWeightsBox ) # # stoppingConditionsPage # self.__stoppingConditionsPage = qt.QWidget() self.__stoppingConditionsPageLayout = qt.QHBoxLayout( self.__stoppingConditionsPage ) self.__stoppingConditionsPageLeft = qt.QWidget() self.__stoppingConditionsPageRight = qt.QWidget() self.__stoppingConditionsPageLayoutLeft = qt.QFormLayout( self.__stoppingConditionsPageLeft ) self.__stoppingConditionsPageLayoutRight = qt.QFormLayout( self.__stoppingConditionsPageRight ) self.__stoppingConditionsPageLayout.addWidget( self.__stoppingConditionsPageLeft ) self.__stoppingConditionsPageLayout.addWidget( self.__stoppingConditionsPageRight ) self.__classLabel2 = qt.QLabel( "XX" ) self.__stoppingConditionsPageLayoutLeft.addRow( "Class:", self.__classLabel2 ) self.__emComboBox = qt.QComboBox() self.__emComboBox.addItems( Helper.GetStoppingConditionTypes() ) self.__stoppingConditionsPageLayoutLeft.addRow( 'EM:', self.__emComboBox ) self.__emComboBox.connect( 'currentIndexChanged(int)', self.propagateToMRML ) self.__mfaComboBox = qt.QComboBox() self.__mfaComboBox.addItems( Helper.GetStoppingConditionTypes() ) self.__stoppingConditionsPageLayoutLeft.addRow( 'MFA:', self.__mfaComboBox ) self.__mfaComboBox.connect( 'currentIndexChanged(int)', self.propagateToMRML ) self.__dummyLabel = qt.QLabel( " " ) self.__stoppingConditionsPageLayoutRight.addRow( " ", self.__dummyLabel ) self.__dummyLabel8 = qt.QLabel( " " ) self.__stoppingConditionsPageLayoutRight.addRow( " ", self.__dummyLabel8 ) self.__emValueSpinBox = qt.QSpinBox() self.__emValueSpinBox.minimum = 0 self.__emValueSpinBox.singleStep = 1 self.__stoppingConditionsPageLayoutRight.addRow( 'Iterations:', self.__emValueSpinBox ) self.__emValueSpinBox.connect( 'valueChanged(int)', self.propagateToMRML ) self.__mfaValueSpinBox = qt.QSpinBox() self.__mfaValueSpinBox.minimum = 0 self.__mfaValueSpinBox.singleStep = 1 self.__stoppingConditionsPageLayoutRight.addRow( 'Iterations:', self.__mfaValueSpinBox ) self.__mfaValueSpinBox.connect( 'valueChanged(int)', self.propagateToMRML ) self.__biasSpinBox = qt.QSpinBox() self.__biasSpinBox.minimum = -1 self.__biasSpinBox.singleStep = 1 self.__stoppingConditionsPageLayoutRight.addRow( 'Bias Iterations:', self.__biasSpinBox ) self.__biasSpinBox.connect( 'valueChanged(int)', self.propagateToMRML ) # # printPage # self.__printPage = qt.QWidget() self.__printPageLayout = qt.QHBoxLayout( self.__printPage ) self.__printPageLeft = qt.QWidget() self.__printPageRight = qt.QWidget() self.__printPageLayoutLeft = qt.QFormLayout( self.__printPageLeft ) self.__printPageLayoutRight = qt.QFormLayout( self.__printPageRight ) self.__printPageLayout.addWidget( self.__printPageLeft ) self.__printPageLayout.addWidget( self.__printPageRight ) self.__classLabel3 = qt.QLabel( "XX" ) self.__printPageLayoutLeft.addRow( "Class:", self.__classLabel3 ) self.__weightCheckBox = qt.QCheckBox() self.__printPageLayoutLeft.addRow( "Weight:", self.__weightCheckBox ) self.__weightCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__qualityCheckBox = qt.QCheckBox() self.__printPageLayoutLeft.addRow( "Quality:", self.__qualityCheckBox ) self.__qualityCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__frequencySpinBox = qt.QSpinBox() self.__frequencySpinBox.minimum = 0 self.__frequencySpinBox.maximum = 20 self.__printPageLayoutLeft.addRow( "Frequency:", self.__frequencySpinBox ) self.__frequencySpinBox.connect( 'valueChanged(int)', self.propagateToMRML ) self.__biasCheckBox = qt.QCheckBox() self.__printPageLayoutLeft.addRow( "Bias:", self.__biasCheckBox ) self.__biasCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__labelMapCheckBox = qt.QCheckBox() self.__printPageLayoutLeft.addRow( "Label Map:", self.__labelMapCheckBox ) self.__labelMapCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__dummyLabel2 = qt.QLabel( " " ) self.__printPageLayoutRight.addRow( " ", self.__dummyLabel2 ) self.__dummyLabel3 = qt.QLabel( " " ) self.__printPageLayoutRight.addRow( " ", self.__dummyLabel3 ) self.__convergenceBox = qt.QGroupBox() self.__convergenceBox.title = 'Convergence' self.__convergenceBoxLayout = qt.QFormLayout( self.__convergenceBox ) self.__printPageLayoutRight.addWidget( self.__convergenceBox ) self.__convEMLabelMapCheckBox = qt.QCheckBox() self.__convergenceBoxLayout.addRow( "EM Label Map:", self.__convEMLabelMapCheckBox ) self.__convEMLabelMapCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__convEMWeightsCheckBox = qt.QCheckBox() self.__convergenceBoxLayout.addRow( "EM Weights:", self.__convEMWeightsCheckBox ) self.__convEMWeightsCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__convMFALabelMapCheckBox = qt.QCheckBox() self.__convergenceBoxLayout.addRow( "MFA Label Map:", self.__convMFALabelMapCheckBox ) self.__convMFALabelMapCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__convMFAWeightsCheckBox = qt.QCheckBox() self.__convergenceBoxLayout.addRow( "MFA Weights:", self.__convMFAWeightsCheckBox ) self.__convMFAWeightsCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) # # advancedPage # self.__advancedPage = qt.QWidget() self.__advancedPageLayout = qt.QFormLayout( self.__advancedPage ) self.__dummyLabel14 = qt.QLabel( " " ) self.__advancedPageLayout.addWidget( self.__dummyLabel14 ) self.__classLabel4 = qt.QLabel( "Class: XX" ) self.__advancedPageLayout.addWidget( self.__classLabel4 ) # self.__pcaParametersBox = qt.QGroupBox() # self.__pcaParametersBox.title = 'PCA Parameters' # self.__pcaParametersBoxLayout = qt.QFormLayout( self.__pcaParametersBox ) # self.__advancedPageLayout.addWidget( self.__pcaParametersBox ) # # self.__registrationParametersBox = qt.QGroupBox() # self.__registrationParametersBox.title = 'Registration Parameters' # self.__registrationParametersBoxLayout = qt.QFormLayout( self.__registrationParametersBox ) # self.__advancedPageLayout.addWidget( self.__registrationParametersBox ) self.__miscParametersBox = qt.QGroupBox() self.__miscParametersBox.title = 'Miscellaneous Parameters' self.__miscParametersBoxLayout = qt.QFormLayout( self.__miscParametersBox ) self.__advancedPageLayout.addWidget( self.__miscParametersBox ) self.__excludeFromEStepCheckBox = qt.QCheckBox() self.__miscParametersBoxLayout.addRow( "Exclude From Incomplete EStep:", self.__excludeFromEStepCheckBox ) self.__excludeFromEStepCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__genBackgroundProbCheckBox = qt.QCheckBox() self.__miscParametersBoxLayout.addRow( "Generate Background Probability:", self.__genBackgroundProbCheckBox ) self.__genBackgroundProbCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) self.__meanFieldParametersBox = qt.QGroupBox() self.__meanFieldParametersBox.title = 'Mean Field Parameters' self.__meanFieldParametersBoxLayout = qt.QFormLayout( self.__meanFieldParametersBox ) self.__advancedPageLayout.addWidget( self.__meanFieldParametersBox ) self.__twoDNeighborhoodCheckBox = qt.QCheckBox() self.__meanFieldParametersBoxLayout.addRow( "2D Neighborhood:", self.__twoDNeighborhoodCheckBox ) self.__twoDNeighborhoodCheckBox.connect( 'stateChanged(int)', self.propagateToMRML ) # self.__inhomogeneityParametersBox = qt.QGroupBox() # self.__inhomogeneityParametersBox.title = 'Inhomogeneity Parameters' # self.__inhomogeneityParametersBoxLayout = qt.QFormLayout( self.__inhomogeneityParametersBox ) # self.__advancedPageLayout.addWidget( self.__inhomogeneityParametersBox ) # ### add all tabs to the tabWidget # self.__tabWidget.addTab( self.__basicPage, "Basic" ) self.__tabWidget.addTab( self.__stoppingConditionsPage, "Stopping Conditions" ) self.__tabWidget.addTab( self.__printPage, "Print" ) self.__tabWidget.addTab( self.__advancedPage, "Advanced" )
def createUserInterface(self): self.__layout = self.__parent.createUserInterface() vText = qt.QLabel("1st Instrumented Level:") iText = qt.QLabel("# to Instrument:") aText = qt.QLabel("Approach Direction:") self.vSelector = qt.QComboBox() self.vSelector.setMaximumWidth(120) self.levels = ("C1", "C2", "C3", "C4", "C5", "C6", "C7", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", "L1", "L2", "L3", "L4", "L5", "S1") self.vSelector.addItems(self.levels) self.iSelector = qt.QComboBox() self.iSelector.setMaximumWidth(120) self.iSelector.addItems( ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']) self.aSelector = qt.QComboBox() self.aSelector.setMaximumWidth(120) self.aSelector.addItems(['Posterior', 'Anterior', 'Left', 'Right']) blank = qt.QLabel(" ") blank.setMaximumWidth(30) #self.__layout.addWidget(vText) #self.__layout.addWidget(self.vSelector) #self.__layout.addWidget(iText) #self.__layout.addWidget(self.iSelector) self.vertebraeGridBox = qt.QGridLayout() self.vertebraeGridBox.addWidget(vText, 0, 0) self.vertebraeGridBox.addWidget(self.vSelector, 1, 0) self.vertebraeGridBox.addWidget(blank, 0, 1) self.vertebraeGridBox.addWidget(iText, 0, 2) self.vertebraeGridBox.addWidget(blank, 1, 1) self.vertebraeGridBox.addWidget(self.iSelector, 1, 2) self.vertebraeGridBox.addWidget(blank, 0, 3) self.vertebraeGridBox.addWidget(aText, 0, 4) self.vertebraeGridBox.addWidget(blank, 1, 3) self.vertebraeGridBox.addWidget(self.aSelector, 1, 4) self.__layout.addRow(self.vertebraeGridBox) #self.__layout.addRow("Starting Instrumented Vertebra:",self.vSelector) #self.__layout.addRow("Number of Vertebrae to Instrument:",self.iSelector) # Hide ROI Details roiCollapsibleButton = ctk.ctkCollapsibleButton() #roiCollapsibleButton.setMaximumWidth(320) roiCollapsibleButton.text = "ROI Details" self.__layout.addWidget(roiCollapsibleButton) roiCollapsibleButton.collapsed = True # Layout roiLayout = qt.QFormLayout(roiCollapsibleButton) #label for ROI selector roiLabel = qt.QLabel('Select ROI:') font = roiLabel.font font.setBold(True) roiLabel.setFont(font) #creates combobox and populates it with all vtkMRMLAnnotationROINodes in the scene self.__roiSelector = slicer.qMRMLNodeComboBox() self.__roiSelector.nodeTypes = ['vtkMRMLAnnotationROINode'] self.__roiSelector.toolTip = "ROI defining the structure of interest" self.__roiSelector.setMRMLScene(slicer.mrmlScene) self.__roiSelector.addEnabled = 1 #add label + combobox roiLayout.addRow(roiLabel, self.__roiSelector) self.__roiSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onROIChanged) # the ROI parameters # GroupBox to hold ROI Widget voiGroupBox = qt.QGroupBox() voiGroupBox.setTitle('Define VOI') roiLayout.addRow(voiGroupBox) # create form layout for GroupBox voiGroupBoxLayout = qt.QFormLayout(voiGroupBox) # create ROI Widget and add it to the form layout of the GroupBox self.__roiWidget = PythonQt.qSlicerAnnotationsModuleWidgets.qMRMLAnnotationROIWidget( ) voiGroupBoxLayout.addRow(self.__roiWidget) # # Hide VR Details # vrCollapsibleButton = ctk.ctkCollapsibleButton() # #roiCollapsibleButton.setMaximumWidth(320) # vrCollapsibleButton.text = "Rendering Details" # self.__layout.addWidget(vrCollapsibleButton) # vrCollapsibleButton.collapsed = True # # Layout # vrLayout = qt.QFormLayout(vrCollapsibleButton) # # the ROI parameters # # GroupBox to hold ROI Widget # vrGroupBox = qt.QGroupBox() # vrGroupBox.setTitle( 'Define Rendering' ) # vrLayout.addRow( vrGroupBox ) # # create form layout for GroupBox # vrGroupBoxLayout = qt.QFormLayout( vrGroupBox ) # # create ROI Widget and add it to the form layout of the GroupBox # self.__vrWidget = PythonQt.qSlicerVolumeRenderingModuleWidgets.qSlicerPresetComboBox() # #self.__vrWidget = PythonQt.qSlicerVolumeRenderingModuleWidgets.qMRMLVolumePropertyNodeWidget() # vrGroupBoxLayout.addRow( self.__vrWidget ) # # initialize VR # self.__vrLogic = slicer.modules.volumerendering.logic() # self.updateWidgetFromParameters(self.parameterNode()) qt.QTimer.singleShot(0, self.killButton)
def createUserInterface(self): ''' ''' self.__layout = self.__parent.createUserInterface() # the anatomical tree anatomicalTreeGroupBox = qt.QGroupBox() anatomicalTreeGroupBox.setTitle('Anatomical Tree') self.__layout.addWidget(anatomicalTreeGroupBox) anatomicalTreeGroupBoxLayout = qt.QFormLayout(anatomicalTreeGroupBox) self.__anatomicalTree = PythonQt.qSlicerEMSegmentModuleWidgets.qSlicerEMSegmentAnatomicalTreeWidget( ) self.__anatomicalTree.structureNameEditable = False self.__anatomicalTree.labelColumnVisible = False self.__anatomicalTree.probabilityMapColumnVisible = False self.__anatomicalTree.classWeightColumnVisible = False self.__anatomicalTree.updateClassWeightColumnVisible = False self.__anatomicalTree.atlasWeightColumnVisible = False self.__anatomicalTree.alphaColumnVisible = False self.__anatomicalTree.displayAlphaCheckBoxVisible = False self.__anatomicalTree.setMinimumHeight(140) self.__anatomicalTree.setSizePolicy(qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.MinimumExpanding) self.__anatomicalTree.connect('currentTreeNodeChanged(vtkMRMLNode*)', self.onTreeSelectionChanged) anatomicalTreeGroupBoxLayout.addWidget(self.__anatomicalTree) self.__tabWidget = qt.QTabWidget() self.__layout.addWidget(self.__tabWidget) # # intensityDistributionPage # intensityDistributionPage = qt.QWidget() intensityDistributionPageLayout = qt.QFormLayout( intensityDistributionPage) self.__classLabel = qt.QLabel("XX") intensityDistributionPageLayout.addRow("Class:", self.__classLabel) self.__specificationComboBox = qt.QComboBox() self.__specificationComboBox.addItems(Helper.GetSpecificationTypes()) #self.__specificationComboBox.model().item( 2 ).setSelectable( False ) #self.__specificationComboBox.model().item( 2 ).setEnabled( False ) intensityDistributionPageLayout.addRow("Specification:", self.__specificationComboBox) self.__specificationComboBox.connect('currentIndexChanged(int)', self.propagateToMRML) self.__meanMatrixWidget = ctk.ctkMatrixWidget() self.__meanMatrixWidget.columnCount = 1 self.__meanMatrixWidget.rowCount = 1 self.__meanMatrixWidget.decimals = 4 self.__meanMatrixWidget.minimum = 0 self.__meanMatrixWidget.maximum = 1000000 intensityDistributionPageLayout.addRow("Mean:", self.__meanMatrixWidget) self.__meanMatrixWidget.connect('matrixChanged()', self.propagateToMRML) self.__logCovarianceMatrixWidget = ctk.ctkMatrixWidget() self.__logCovarianceMatrixWidget.columnCount = 1 self.__logCovarianceMatrixWidget.rowCount = 1 self.__logCovarianceMatrixWidget.decimals = 4 self.__logCovarianceMatrixWidget.minimum = 0 self.__logCovarianceMatrixWidget.maximum = 1000000 intensityDistributionPageLayout.addRow( "Log Covariance:", self.__logCovarianceMatrixWidget) self.__logCovarianceMatrixWidget.connect('matrixChanged()', self.propagateToMRML) self.__resetDistributionButton = qt.QPushButton() self.__resetDistributionButton.text = "Reset Distribution" intensityDistributionPageLayout.addRow(self.__resetDistributionButton) self.__resetDistributionButton.connect('clicked()', self.resetDistribution) # # manualSamplingPage # manualSamplingPage = qt.QWidget() manualSamplingPageLayout = qt.QFormLayout(manualSamplingPage) self.__classLabel2 = qt.QLabel("Class: XX") manualSamplingPageLayout.addWidget(self.__classLabel2) self.__infoLabel = qt.QLabel( "left mouse Click in a slice window to pick a sample") manualSamplingPageLayout.addWidget(self.__infoLabel) self.__manualSampleTable = qt.QTableWidget() manualSamplingPageLayout.addWidget(self.__manualSampleTable) self.__tabWidget.addTab(intensityDistributionPage, "Intensity Distribution") self.__tabWidget.addTab(manualSamplingPage, "Manual Sampling") self.__plotDistributionButton = qt.QPushButton() self.__plotDistributionButton.text = "Plot Distribution" self.__layout.addRow(self.__plotDistributionButton) self.__plotDistributionButton.connect('clicked()', self.plotDistribution)
def createUserInterface(self): """ This method uses qt to create a user interface. qMRMLNodeComboBox is a drop down menu for picking MRML files. MRML files have to be added to a "scene," i.e. the main Slicer container, hence setMRMLScene. """ self.__layout = self.__parent.createUserInterface() image_label = qt.QLabel('Test label') image = qt.QPixmap( 'C:/Users/azb22/Documents/GitHub/Public_qtim_tools/SlicerGBMWizard/GBMWizard/GBMWizard_Lib/VolumeSelect.png' ) image_label.setPixmap(image) image_label.alignment = 4 self.__layout.addRow(image_label) step_label = qt.QLabel( 'This module requires four MRI volumes for GBM cases. Please select pre- and post-contrast T1 images, a T2 image, and a FLAIR image from a single patient visit. The ability to use multiple cases will be added in future versions.' ) step_label.setWordWrap(True) self.__informationGroupBox = qt.QGroupBox() self.__informationGroupBox.setTitle('Information') self.__informationGroupBoxLayout = qt.QFormLayout( self.__informationGroupBox) self.__volumeSelectionGroupBox = qt.QGroupBox() self.__volumeSelectionGroupBox.setTitle('Volume Selection') self.__volumeSelectionGroupBoxLayout = qt.QFormLayout( self.__volumeSelectionGroupBox) t1PreScanLabel = qt.QLabel('Pre-Contrast T1 Image:') self.__t1PreVolumeSelector = slicer.qMRMLNodeComboBox() self.__t1PreVolumeSelector.toolTip = "Select a pre-contrast T1 image." self.__t1PreVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__t1PreVolumeSelector.setMRMLScene(slicer.mrmlScene) self.__t1PreVolumeSelector.addEnabled = 0 t1PostScanLabel = qt.QLabel('Post-Contrast T1 Image:') self.__t1PostVolumeSelector = slicer.qMRMLNodeComboBox() self.__t1PostVolumeSelector.toolTip = "Select a post-contrast T1 image." self.__t1PostVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__t1PostVolumeSelector.setMRMLScene(slicer.mrmlScene) self.__t1PostVolumeSelector.addEnabled = 0 t2ScanLabel = qt.QLabel('T2 Image:') self.__t2VolumeSelector = slicer.qMRMLNodeComboBox() self.__t2VolumeSelector.toolTip = "Select a T2 image." self.__t2VolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__t2VolumeSelector.setMRMLScene(slicer.mrmlScene) self.__t2VolumeSelector.addEnabled = 0 flairScanLabel = qt.QLabel('FLAIR Image:') self.__flairVolumeSelector = slicer.qMRMLNodeComboBox() self.__flairVolumeSelector.toolTip = "Select a FLAIR image." self.__flairVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__flairVolumeSelector.setMRMLScene(slicer.mrmlScene) self.__flairVolumeSelector.addEnabled = 0 self.__layout.addRow(self.__informationGroupBox) self.__informationGroupBoxLayout.addRow(step_label) self.__layout.addRow(self.__volumeSelectionGroupBox) self.__volumeSelectionGroupBoxLayout.addRow(t1PreScanLabel, self.__t1PreVolumeSelector) self.__volumeSelectionGroupBoxLayout.addRow( t1PostScanLabel, self.__t1PostVolumeSelector) self.__volumeSelectionGroupBoxLayout.addRow(t2ScanLabel, self.__t2VolumeSelector) self.__volumeSelectionGroupBoxLayout.addRow(flairScanLabel, self.__flairVolumeSelector) self.volumeNodes = [ self.__t1PostVolumeSelector.currentNode(), self.__t1PostVolumeSelector.currentNode(), self.__t2VolumeSelector.currentNode(), self.__flairVolumeSelector.currentNode() ] self.updateWidgetFromParameters(self.parameterNode()) # This timer is a trick to wait for buttons to load BEFORE deleting them. qt.QTimer.singleShot(0, self.killButton)