def setup(self): ScriptedLoadableModuleWidget.setup(self) # TODO: The following lines are strictly for debug purposes, should be removed when this module is done self.developerMode = True slicer.igwidget = self self.logic = InsertionGridPlannerLogic() # Collapsible buttons self.parametersCollapsibleButton = ctk.ctkCollapsibleButton() self.parametersCollapsibleButton.text = "InsertionGridPlanner" self.layout.addWidget(self.parametersCollapsibleButton) # Layout within the collapsible button self.parametersFormLayout = qt.QFormLayout( self.parametersCollapsibleButton) # Transform Tool Tip To Reference combobox self.transformNodeGridToTargetLabel = qt.QLabel() self.transformNodeGridToTargetLabel.setText( "Grid to Target Transform: ") self.transformNodeGridToTargetSelector = slicer.qMRMLNodeComboBox() self.transformNodeGridToTargetSelector.nodeTypes = (( "vtkMRMLLinearTransformNode"), "") self.transformNodeGridToTargetSelector.noneEnabled = False self.transformNodeGridToTargetSelector.addEnabled = False self.transformNodeGridToTargetSelector.removeEnabled = False self.transformNodeGridToTargetSelector.setMRMLScene(slicer.mrmlScene) self.transformNodeGridToTargetSelector.setToolTip( "Pick the transform for going from the grid's coordinate system to the target (reference) coordinate system" ) self.parametersFormLayout.addRow( self.transformNodeGridToTargetLabel, self.transformNodeGridToTargetSelector) # Grid type self.gridPatternRectangularLabel = qt.QLabel(qt.Qt.Horizontal, None) self.gridPatternRectangularLabel.setText("Rectangular Grid") self.gridPatternRectangularRadioButton = qt.QRadioButton() self.gridPatternRectangularRadioButton.setToolTip( "Make the grid rectangular") self.gridPatternRectangularRadioButton.setChecked(True) self.parametersFormLayout.addRow( self.gridPatternRectangularLabel, self.gridPatternRectangularRadioButton) self.gridPatternTriangularLabel = qt.QLabel(qt.Qt.Horizontal, None) self.gridPatternTriangularLabel.setText("Triangular Grid") self.gridPatternTriangularRadioButton = qt.QRadioButton() self.gridPatternTriangularRadioButton.setToolTip( "Make the grid triangular") self.parametersFormLayout.addRow(self.gridPatternTriangularLabel, self.gridPatternTriangularRadioButton) # Grid size self.gridSizeLeftLabel = qt.QLabel() self.gridSizeLeftLabel.setText("Extent left (mm): ") self.gridSizeLeftSlider = slicer.qMRMLSliderWidget() self.gridSizeLeftSlider.minimum = 0 # mm self.gridSizeLeftSlider.maximum = 150 # mm self.gridSizeLeftSlider.value = 0 # mm self.gridSizeLeftSlider.setToolTip("Adjust the size of the grid") self.parametersFormLayout.addRow(self.gridSizeLeftLabel, self.gridSizeLeftSlider) self.gridSizeRightLabel = qt.QLabel() self.gridSizeRightLabel.setText("Extent right (mm): ") self.gridSizeRightSlider = slicer.qMRMLSliderWidget() self.gridSizeRightSlider.minimum = 0 # mm self.gridSizeRightSlider.maximum = 150 # mm self.gridSizeRightSlider.value = 0 # mm self.gridSizeRightSlider.setToolTip("Adjust the size of the grid") self.parametersFormLayout.addRow(self.gridSizeRightLabel, self.gridSizeRightSlider) self.gridSizeUpLabel = qt.QLabel() self.gridSizeUpLabel.setText("Extent up (mm): ") self.gridSizeUpSlider = slicer.qMRMLSliderWidget() self.gridSizeUpSlider.minimum = 0 # mm self.gridSizeUpSlider.maximum = 150 # mm self.gridSizeUpSlider.value = 0 # mm self.gridSizeUpSlider.setToolTip("Adjust the size of the grid") self.parametersFormLayout.addRow(self.gridSizeUpLabel, self.gridSizeUpSlider) self.gridSizeDownLabel = qt.QLabel() self.gridSizeDownLabel.setText("Extent down (mm): ") self.gridSizeDownSlider = slicer.qMRMLSliderWidget() self.gridSizeDownSlider.minimum = 0 # mm self.gridSizeDownSlider.maximum = 150 # mm self.gridSizeDownSlider.value = 0 # mm self.gridSizeDownSlider.setToolTip("Adjust the size of the grid") self.parametersFormLayout.addRow(self.gridSizeDownLabel, self.gridSizeDownSlider) # Grid spacing self.gridSpacingHorizontalLabel = qt.QLabel(qt.Qt.Horizontal, None) self.gridSpacingHorizontalLabel.text = "Horizontal Spacing (mm): " self.gridSpacingHorizontalSlider = slicer.qMRMLSliderWidget() self.gridSpacingHorizontalSlider.minimum = 1 # mm self.gridSpacingHorizontalSlider.maximum = 50 # mm self.gridSpacingHorizontalSlider.value = 10 # mm self.parametersFormLayout.addRow(self.gridSpacingHorizontalLabel, self.gridSpacingHorizontalSlider) self.gridSpacingVerticalLabel = qt.QLabel(qt.Qt.Horizontal, None) self.gridSpacingVerticalLabel.text = "Vertical Spacing (mm): " self.gridSpacingVerticalSlider = slicer.qMRMLSliderWidget() self.gridSpacingVerticalSlider.minimum = 1 # mm self.gridSpacingVerticalSlider.maximum = 50 # mm self.gridSpacingVerticalSlider.value = 10 # mm self.parametersFormLayout.addRow(self.gridSpacingVerticalLabel, self.gridSpacingVerticalSlider) # Grid creation self.createGridButton = qt.QPushButton() self.createGridButton.text = "Create Grid" self.createGridButton.setToolTip("Create the virtual grid guide.") self.parametersFormLayout.addRow(self.createGridButton) self.deleteGridButton = qt.QPushButton() self.deleteGridButton.text = "Delete Grid" self.deleteGridButton.setToolTip("Delete the virtual grid guide.") self.parametersFormLayout.addRow(self.deleteGridButton) # Add vertical spacer self.layout.addStretch(1) #Connections self.createGridButton.connect('clicked()', self.createGridButtonPressed) self.deleteGridButton.connect('clicked()', self.logic.deleteGrid)
def setup(self): # TODO: The following line is strictly for debug purposes, should be removed when this module is done slicer.tvwidget = self # Collapsible buttons self.parametersCollapsibleButton = ctk.ctkCollapsibleButton() self.parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(self.parametersCollapsibleButton) # Layout within the collapsible button self.parametersFormLayout = qt.QFormLayout(self.parametersCollapsibleButton) # Transform combobox self.transformLabel = qt.QLabel() self.transformLabel.setText("toolCameraToToolTransform: ") self.transformSelector = slicer.qMRMLNodeComboBox() self.transformSelector.nodeTypes = ( ("vtkMRMLLinearTransformNode"), "" ) self.transformSelector.noneEnabled = False self.transformSelector.addEnabled = False self.transformSelector.removeEnabled = False self.transformSelector.setMRMLScene( slicer.mrmlScene ) self.transformSelector.setToolTip("Pick the transform that the camera should follow, e.g. 'cauteryCameraToCauteryTransform'") self.parametersFormLayout.addRow(self.transformLabel, self.transformSelector) # Camera combobox self.cameraLabel = qt.QLabel() self.cameraLabel.setText("Scene Camera: ") self.cameraSelector = slicer.qMRMLNodeComboBox() self.cameraSelector.nodeTypes = ( ("vtkMRMLCameraNode"), "" ) self.cameraSelector.noneEnabled = False self.cameraSelector.addEnabled = False self.cameraSelector.removeEnabled = False self.cameraSelector.setMRMLScene( slicer.mrmlScene ) self.cameraSelector.setToolTip("Pick the camera which should be moved, e.g. 'Default Scene Camera'") self.parametersFormLayout.addRow(self.cameraLabel, self.cameraSelector) # "Camera Control" Collapsible self.cameraControlCollapsibleButton = ctk.ctkCollapsibleButton() self.cameraControlCollapsibleButton.text = "Camera Control" self.layout.addWidget(self.cameraControlCollapsibleButton) # Layout within the collapsible button self.cameraControlFormLayout = qt.QFormLayout(self.cameraControlCollapsibleButton) # "Degrees of Freedom" Collapsible button self.degreesOfFreedomCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.degreesOfFreedomCollapsibleButton.title = "Degrees of Freedom" self.cameraControlFormLayout.addRow(self.degreesOfFreedomCollapsibleButton) # Layout within the collapsible button self.degreesOfFreedomFormLayout = qt.QFormLayout(self.degreesOfFreedomCollapsibleButton) # A series of radio buttons for changing the degrees of freedom self.degreesOfFreedom3Label = qt.QLabel(qt.Qt.Horizontal,None) self.degreesOfFreedom3Label.setText("3DOF: ") self.degreesOfFreedom3RadioButton = qt.QRadioButton() self.degreesOfFreedom3RadioButton.setToolTip("The camera will always look at the target model (or if unselected will act like 5DOF)") self.degreesOfFreedomFormLayout.addRow(self.degreesOfFreedom3Label,self.degreesOfFreedom3RadioButton) self.degreesOfFreedom5Label = qt.QLabel(qt.Qt.Horizontal,None) self.degreesOfFreedom5Label.setText("5DOF: ") self.degreesOfFreedom5RadioButton = qt.QRadioButton() self.degreesOfFreedom5RadioButton.setToolTip("The camera will always be oriented with the selected 'up direction'") self.degreesOfFreedomFormLayout.addRow(self.degreesOfFreedom5Label,self.degreesOfFreedom5RadioButton) self.degreesOfFreedom6Label = qt.QLabel(qt.Qt.Horizontal,None) self.degreesOfFreedom6Label.setText("6DOF: ") self.degreesOfFreedom6RadioButton = qt.QRadioButton() self.degreesOfFreedom6RadioButton.setToolTip("The camera will be virtually attached to the tool, and rotate together with it") self.degreesOfFreedom6RadioButton.setChecked(True) self.degreesOfFreedomFormLayout.addRow(self.degreesOfFreedom6Label,self.degreesOfFreedom6RadioButton) # "Up Direction" Collapsible button self.upDirectionCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.upDirectionCollapsibleButton.title = "Up Direction" self.upDirectionCollapsibleButton.setVisible(False) self.cameraControlFormLayout.addRow(self.upDirectionCollapsibleButton) # Layout within the collapsible button self.upDirectionFormLayout = qt.QFormLayout(self.upDirectionCollapsibleButton) # Radio buttons for each of the anatomical directions self.upDirectionAnteriorLabel = qt.QLabel(qt.Qt.Horizontal,None) self.upDirectionAnteriorLabel.setText("Anterior: ") self.upDirectionAnteriorRadioButton = qt.QRadioButton() self.upDirectionAnteriorRadioButton.setChecked(True) self.upDirectionFormLayout.addRow(self.upDirectionAnteriorLabel,self.upDirectionAnteriorRadioButton) self.upDirectionPosteriorLabel = qt.QLabel(qt.Qt.Horizontal,None) self.upDirectionPosteriorLabel.setText("Posterior: ") self.upDirectionPosteriorRadioButton = qt.QRadioButton() self.upDirectionFormLayout.addRow(self.upDirectionPosteriorLabel,self.upDirectionPosteriorRadioButton) self.upDirectionRightLabel = qt.QLabel(qt.Qt.Horizontal,None) self.upDirectionRightLabel.setText("Right: ") self.upDirectionRightRadioButton = qt.QRadioButton() self.upDirectionFormLayout.addRow(self.upDirectionRightLabel,self.upDirectionRightRadioButton) self.upDirectionLeftLabel = qt.QLabel(qt.Qt.Horizontal,None) self.upDirectionLeftLabel.setText("Left: ") self.upDirectionLeftRadioButton = qt.QRadioButton() self.upDirectionFormLayout.addRow(self.upDirectionLeftLabel,self.upDirectionLeftRadioButton) self.upDirectionSuperiorLabel = qt.QLabel(qt.Qt.Horizontal,None) self.upDirectionSuperiorLabel.setText("Superior: ") self.upDirectionSuperiorRadioButton = qt.QRadioButton() self.upDirectionFormLayout.addRow(self.upDirectionSuperiorLabel,self.upDirectionSuperiorRadioButton) self.upDirectionInferiorLabel = qt.QLabel(qt.Qt.Horizontal,None) self.upDirectionInferiorLabel.setText("Inferior: ") self.upDirectionInferiorRadioButton = qt.QRadioButton() self.upDirectionFormLayout.addRow(self.upDirectionInferiorLabel,self.upDirectionInferiorRadioButton) # "Target Model" Collapsible button self.targetModelCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.targetModelCollapsibleButton.title = "Target Model" self.targetModelCollapsibleButton.setVisible(False) self.cameraControlFormLayout.addRow(self.targetModelCollapsibleButton) # Layout within the collapsible button self.targetModelFormLayout = qt.QFormLayout(self.targetModelCollapsibleButton) # Selection of the target model self.targetModelLabel = qt.QLabel(qt.Qt.Horizontal,None) self.targetModelLabel.text = "Target model: " self.targetModelSelector = slicer.qMRMLNodeComboBox() self.targetModelSelector.nodeTypes = ( ("vtkMRMLModelNode"), "" ) self.targetModelSelector.noneEnabled = False self.targetModelSelector.addEnabled = False self.targetModelSelector.removeEnabled = False self.targetModelSelector.setMRMLScene( slicer.mrmlScene ) self.targetModelSelector.setToolTip("This model be the center of rotation using 3DOF Viewpoint (e.g. tumour)") self.targetModelFormLayout.addRow(self.targetModelLabel,self.targetModelSelector) # "Zoom" Collapsible button self.zoomCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.zoomCollapsibleButton.title = "Zoom" self.cameraControlFormLayout.addRow(self.zoomCollapsibleButton) # Layout within the collapsible button self.zoomFormLayout = qt.QFormLayout(self.zoomCollapsibleButton) # Camera viewing angle (perspective projection only) self.cameraViewAngleLabel = qt.QLabel(qt.Qt.Horizontal,None) self.cameraViewAngleLabel.setText("View angle (degrees): ") self.cameraViewAngleSlider = slicer.qMRMLSliderWidget() self.cameraViewAngleSlider.minimum = self.cameraViewAngleMinDeg self.cameraViewAngleSlider.maximum = self.cameraViewAngleMaxDeg self.cameraViewAngleSlider.value = self.sliderViewAngleDefaultDeg self.cameraViewAngleSlider.singleStep = self.sliderSingleStepValue self.cameraViewAngleSlider.pageStep = self.sliderPageStepValue self.cameraViewAngleSlider.setToolTip("Make the current viewing target look larger/smaller.") self.zoomFormLayout.addRow(self.cameraViewAngleLabel,self.cameraViewAngleSlider) # Camera parallel scale (parallel projection only) self.cameraParallelScaleLabel = qt.QLabel(qt.Qt.Horizontal,None) self.cameraParallelScaleLabel.setText("View scale: ") self.cameraParallelScaleLabel.setVisible(False) self.cameraParallelScaleSlider = slicer.qMRMLSliderWidget() self.cameraParallelScaleSlider.minimum = self.cameraParallelScaleMinDeg self.cameraParallelScaleSlider.maximum = self.cameraParallelScaleMaxDeg self.cameraParallelScaleSlider.value = self.sliderParallelScaleDefaultDeg self.cameraParallelScaleSlider.singleStep = self.sliderSingleStepValue self.cameraParallelScaleSlider.pageStep = self.sliderPageStepValue self.cameraParallelScaleSlider.setToolTip("Make the current viewing target look larger/smaller.") self.cameraParallelScaleSlider.setVisible(False) self.zoomFormLayout.addRow(self.cameraParallelScaleLabel,self.cameraParallelScaleSlider) # "Translation" Collapsible self.translationCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.translationCollapsibleButton.title = "Translation" self.cameraControlFormLayout.addRow(self.translationCollapsibleButton) # Layout within the collapsible button self.translationFormLayout = qt.QFormLayout(self.translationCollapsibleButton) self.cameraXPosLabel = qt.QLabel(qt.Qt.Horizontal,None) self.cameraXPosLabel.text = "Left/Right (mm): " self.cameraXPosSlider = slicer.qMRMLSliderWidget() self.cameraXPosSlider.minimum = self.sliderTranslationMinMm self.cameraXPosSlider.maximum = self.sliderTranslationMaxMm self.cameraXPosSlider.value = self.sliderTranslationDefaultMm self.cameraXPosSlider.singleStep = self.sliderSingleStepValue self.cameraXPosSlider.pageStep = self.sliderPageStepValue self.translationFormLayout.addRow(self.cameraXPosLabel,self.cameraXPosSlider) self.cameraYPosLabel = qt.QLabel(qt.Qt.Horizontal,None) self.cameraYPosLabel.setText("Down/Up (mm): ") self.cameraYPosSlider = slicer.qMRMLSliderWidget() self.cameraYPosSlider.minimum = self.sliderTranslationMinMm self.cameraYPosSlider.maximum = self.sliderTranslationMaxMm self.cameraYPosSlider.value = self.sliderTranslationDefaultMm self.cameraYPosSlider.singleStep = self.sliderSingleStepValue self.cameraYPosSlider.pageStep = self.sliderPageStepValue self.translationFormLayout.addRow(self.cameraYPosLabel,self.cameraYPosSlider) self.cameraZPosLabel = qt.QLabel(qt.Qt.Horizontal,None) self.cameraZPosLabel.setText("Front/Back (mm): ") self.cameraZPosSlider = slicer.qMRMLSliderWidget() self.cameraZPosSlider.minimum = self.sliderTranslationMinMm self.cameraZPosSlider.maximum = self.sliderTranslationMaxMm self.cameraZPosSlider.value = self.sliderTranslationDefaultMm self.cameraZPosSlider.singleStep = self.sliderSingleStepValue self.cameraZPosSlider.pageStep = self.sliderPageStepValue self.translationFormLayout.addRow(self.cameraZPosLabel,self.cameraZPosSlider) # "Model Visibility" Collapsible self.modelVisibilityCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.modelVisibilityCollapsibleButton.title = "Model Visibility" self.cameraControlFormLayout.addRow(self.modelVisibilityCollapsibleButton) # Layout within the collapsible button self.modelVisibilityFormLayout = qt.QFormLayout(self.modelVisibilityCollapsibleButton) self.modelOnlyViewpointOnLabel = qt.QLabel(qt.Qt.Horizontal,None) self.modelOnlyViewpointOnLabel.text = "Model visible only for Viewpoint on: " self.modelOnlyViewpointOnSelector = slicer.qMRMLNodeComboBox() self.modelOnlyViewpointOnSelector.nodeTypes = ( ("vtkMRMLModelNode"), "" ) self.modelOnlyViewpointOnSelector.noneEnabled = True self.modelOnlyViewpointOnSelector.addEnabled = False self.modelOnlyViewpointOnSelector.removeEnabled = False self.modelOnlyViewpointOnSelector.setMRMLScene( slicer.mrmlScene ) self.modelOnlyViewpointOnSelector.setToolTip("This model be visible if Viewpoint mode is enabled, and invisible otherwise") self.modelVisibilityFormLayout.addRow(self.modelOnlyViewpointOnLabel,self.modelOnlyViewpointOnSelector) self.modelOnlyViewpointOffLabel = qt.QLabel(qt.Qt.Horizontal,None) self.modelOnlyViewpointOffLabel.text = "Model visible only for Viewpoint off: " self.modelOnlyViewpointOffSelector = slicer.qMRMLNodeComboBox() self.modelOnlyViewpointOffSelector.nodeTypes = ( ("vtkMRMLModelNode"), "" ) self.modelOnlyViewpointOffSelector.noneEnabled = True self.modelOnlyViewpointOffSelector.addEnabled = False self.modelOnlyViewpointOffSelector.removeEnabled = False self.modelOnlyViewpointOffSelector.setMRMLScene( slicer.mrmlScene ) self.modelOnlyViewpointOffSelector.setToolTip("This model be visible if Viewpoint Mode is disabled, and invisible otherwise") self.modelVisibilityFormLayout.addRow(self.modelOnlyViewpointOffLabel,self.modelOnlyViewpointOffSelector) # Camera parallel projection checkbox self.cameraParallelProjectionLabel = qt.QLabel() self.cameraParallelProjectionLabel.setText("Parallel Projection") self.cameraParallelProjectionCheckbox = qt.QCheckBox() self.cameraParallelProjectionCheckbox.setCheckState(0) self.cameraParallelProjectionCheckbox.setToolTip("If checked, render with parallel projection (box-shaped view). Otherwise render with perspective projection (cone-shaped view).") self.cameraControlFormLayout.addRow(self.cameraParallelProjectionLabel,self.cameraParallelProjectionCheckbox) # "Toggle Tool Point of View" button self.enableViewpointButton = qt.QPushButton() self.enableViewpointButton.setToolTip("The camera will continuously update its position so that it follows the tool.") self.enableViewpointButton.setText(self.enableViewpointButtonTextState0) self.cameraControlFormLayout.addRow(self.enableViewpointButton) #Connections self.enableViewpointButton.connect('clicked()', self.enableViewpointButtonPressed) self.cameraParallelProjectionCheckbox.connect('stateChanged(int)', self.toggleCameraParallelProjectionCheckboxPressed) self.cameraViewAngleSlider.connect('valueChanged(double)', self.logic.SetCameraViewAngleDeg) self.cameraParallelScaleSlider.connect('valueChanged(double)', self.logic.SetCameraParallelScale) self.cameraXPosSlider.connect('valueChanged(double)', self.logic.SetCameraXPosMm) self.cameraYPosSlider.connect('valueChanged(double)', self.logic.SetCameraYPosMm) self.cameraZPosSlider.connect('valueChanged(double)', self.logic.SetCameraZPosMm) self.upDirectionAnteriorRadioButton.connect('clicked()', self.changeUpToAnterior) self.upDirectionPosteriorRadioButton.connect('clicked()', self.changeUpToPosterior) self.upDirectionLeftRadioButton.connect('clicked()', self.changeUpToLeft) self.upDirectionRightRadioButton.connect('clicked()', self.changeUpToRight) self.upDirectionSuperiorRadioButton.connect('clicked()', self.changeUpToSuperior) self.upDirectionInferiorRadioButton.connect('clicked()', self.changeUpToInferior) self.degreesOfFreedom3RadioButton.connect('clicked()', self.changeInterfaceTo3DOFMode) self.degreesOfFreedom5RadioButton.connect('clicked()', self.changeInterfaceTo5DOFMode) self.degreesOfFreedom6RadioButton.connect('clicked()', self.changeInterfaceTo6DOFMode) # Add vertical spacer self.layout.addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # TODO: The following lines are strictly for debug purposes, should be removed when this module is done self.developerMode = True slicer.igwidget = self self.logic = InsertionGridPlannerLogic() # Collapsible buttons self.parametersCollapsibleButton = ctk.ctkCollapsibleButton() self.parametersCollapsibleButton.text = "InsertionGridPlanner" self.layout.addWidget(self.parametersCollapsibleButton) # Layout within the collapsible button self.parametersFormLayout = qt.QFormLayout(self.parametersCollapsibleButton) # Transform Tool Tip To Reference combobox self.transformNodeGridToTargetLabel = qt.QLabel() self.transformNodeGridToTargetLabel.setText("Grid to Target Transform: ") self.transformNodeGridToTargetSelector = slicer.qMRMLNodeComboBox() self.transformNodeGridToTargetSelector.nodeTypes = ( ("vtkMRMLLinearTransformNode"), "" ) self.transformNodeGridToTargetSelector.noneEnabled = False self.transformNodeGridToTargetSelector.addEnabled = False self.transformNodeGridToTargetSelector.removeEnabled = False self.transformNodeGridToTargetSelector.setMRMLScene( slicer.mrmlScene ) self.transformNodeGridToTargetSelector.setToolTip("Pick the transform for going from the grid's coordinate system to the target (reference) coordinate system") self.parametersFormLayout.addRow(self.transformNodeGridToTargetLabel, self.transformNodeGridToTargetSelector) # Grid type self.gridPatternRectangularLabel = qt.QLabel(qt.Qt.Horizontal,None) self.gridPatternRectangularLabel.setText("Rectangular Grid") self.gridPatternRectangularRadioButton = qt.QRadioButton() self.gridPatternRectangularRadioButton.setToolTip("Make the grid rectangular") self.gridPatternRectangularRadioButton.setChecked(True) self.parametersFormLayout.addRow(self.gridPatternRectangularLabel,self.gridPatternRectangularRadioButton) self.gridPatternTriangularLabel = qt.QLabel(qt.Qt.Horizontal,None) self.gridPatternTriangularLabel.setText("Triangular Grid") self.gridPatternTriangularRadioButton = qt.QRadioButton() self.gridPatternTriangularRadioButton.setToolTip("Make the grid triangular") self.parametersFormLayout.addRow(self.gridPatternTriangularLabel,self.gridPatternTriangularRadioButton) # Grid size self.gridSizeLeftLabel = qt.QLabel() self.gridSizeLeftLabel.setText("Extent left (mm): ") self.gridSizeLeftSlider = slicer.qMRMLSliderWidget() self.gridSizeLeftSlider.minimum = 0 # mm self.gridSizeLeftSlider.maximum = 150 # mm self.gridSizeLeftSlider.value = 0 # mm self.gridSizeLeftSlider.setToolTip("Adjust the size of the grid") self.parametersFormLayout.addRow(self.gridSizeLeftLabel, self.gridSizeLeftSlider) self.gridSizeRightLabel = qt.QLabel() self.gridSizeRightLabel.setText("Extent right (mm): ") self.gridSizeRightSlider = slicer.qMRMLSliderWidget() self.gridSizeRightSlider.minimum = 0 # mm self.gridSizeRightSlider.maximum = 150 # mm self.gridSizeRightSlider.value = 0 # mm self.gridSizeRightSlider.setToolTip("Adjust the size of the grid") self.parametersFormLayout.addRow(self.gridSizeRightLabel, self.gridSizeRightSlider) self.gridSizeUpLabel = qt.QLabel() self.gridSizeUpLabel.setText("Extent up (mm): ") self.gridSizeUpSlider = slicer.qMRMLSliderWidget() self.gridSizeUpSlider.minimum = 0 # mm self.gridSizeUpSlider.maximum = 150 # mm self.gridSizeUpSlider.value = 0 # mm self.gridSizeUpSlider.setToolTip("Adjust the size of the grid") self.parametersFormLayout.addRow(self.gridSizeUpLabel, self.gridSizeUpSlider) self.gridSizeDownLabel = qt.QLabel() self.gridSizeDownLabel.setText("Extent down (mm): ") self.gridSizeDownSlider = slicer.qMRMLSliderWidget() self.gridSizeDownSlider.minimum = 0 # mm self.gridSizeDownSlider.maximum = 150 # mm self.gridSizeDownSlider.value = 0 # mm self.gridSizeDownSlider.setToolTip("Adjust the size of the grid") self.parametersFormLayout.addRow(self.gridSizeDownLabel, self.gridSizeDownSlider) # Grid spacing self.gridSpacingHorizontalLabel = qt.QLabel(qt.Qt.Horizontal,None) self.gridSpacingHorizontalLabel.text = "Horizontal Spacing (mm): " self.gridSpacingHorizontalSlider = slicer.qMRMLSliderWidget() self.gridSpacingHorizontalSlider.minimum = 1 # mm self.gridSpacingHorizontalSlider.maximum = 50 # mm self.gridSpacingHorizontalSlider.value = 10 # mm self.parametersFormLayout.addRow(self.gridSpacingHorizontalLabel,self.gridSpacingHorizontalSlider) self.gridSpacingVerticalLabel = qt.QLabel(qt.Qt.Horizontal,None) self.gridSpacingVerticalLabel.text = "Vertical Spacing (mm): " self.gridSpacingVerticalSlider = slicer.qMRMLSliderWidget() self.gridSpacingVerticalSlider.minimum = 1 # mm self.gridSpacingVerticalSlider.maximum = 50 # mm self.gridSpacingVerticalSlider.value = 10 # mm self.parametersFormLayout.addRow(self.gridSpacingVerticalLabel,self.gridSpacingVerticalSlider) # Grid creation self.createGridButton = qt.QPushButton() self.createGridButton.text = "Create Grid" self.createGridButton.setToolTip("Create the virtual grid guide.") self.parametersFormLayout.addRow(self.createGridButton) self.deleteGridButton = qt.QPushButton() self.deleteGridButton.text = "Delete Grid" self.deleteGridButton.setToolTip("Delete the virtual grid guide.") self.parametersFormLayout.addRow(self.deleteGridButton) # Add vertical spacer self.layout.addStretch(1) #Connections self.createGridButton.connect('clicked()', self.createGridButtonPressed) self.deleteGridButton.connect('clicked()', self.logic.deleteGrid)
def setupNavigationPanel(self): logging.debug('setupNavigationPanel') self.sliderTranslationDefaultMm = 0 self.sliderTranslationMinMm = -500 self.sliderTranslationMaxMm = 500 self.sliderViewAngleDefaultDeg = 30 self.cameraViewAngleMinDeg = 5.0 # maximum magnification self.cameraViewAngleMaxDeg = 150.0 # minimum magnification self.sliderSingleStepValue = 1 self.sliderPageStepValue = 10 self.navigationCollapsibleButton.setProperty('collapsedHeight', 20) setButtonStyle(self.navigationCollapsibleButton, 2.0) self.navigationCollapsibleButton.text = "Navigation" self.sliceletPanelLayout.addWidget(self.navigationCollapsibleButton) self.navigationCollapsibleLayout = qt.QFormLayout( self.navigationCollapsibleButton) self.navigationCollapsibleLayout.setContentsMargins(12, 4, 4, 4) self.navigationCollapsibleLayout.setSpacing(4) self.rightCameraButton = qt.QPushButton("Setup right camera") self.rightCameraButton.setCheckable(True) setButtonStyle(self.rightCameraButton) self.leftCameraButton = qt.QPushButton("Setup left camera") self.leftCameraButton.setCheckable(True) setButtonStyle(self.leftCameraButton) hbox = qt.QHBoxLayout() hbox.addWidget(self.leftCameraButton) hbox.addWidget(self.rightCameraButton) self.navigationCollapsibleLayout.addRow(hbox) # "Camera Control" Collapsible self.zoomCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.zoomCollapsibleButton.collapsed = True self.zoomCollapsibleButton.title = "Zoom" self.navigationCollapsibleLayout.addRow(self.zoomCollapsibleButton) # Layout within the collapsible button self.zoomFormLayout = qt.QFormLayout(self.zoomCollapsibleButton) # Camera distance to focal point slider self.cameraViewAngleLabel = qt.QLabel(qt.Qt.Horizontal, None) self.cameraViewAngleLabel.setText("Field of view [degrees]: ") self.cameraViewAngleSlider = slicer.qMRMLSliderWidget() self.cameraViewAngleSlider.minimum = self.cameraViewAngleMinDeg self.cameraViewAngleSlider.maximum = self.cameraViewAngleMaxDeg self.cameraViewAngleSlider.value = self.sliderViewAngleDefaultDeg self.cameraViewAngleSlider.singleStep = self.sliderSingleStepValue self.cameraViewAngleSlider.pageStep = self.sliderPageStepValue self.cameraViewAngleSlider.setDisabled(True) self.zoomFormLayout.addRow(self.cameraViewAngleLabel, self.cameraViewAngleSlider) # "Camera Control" Collapsible self.translationCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.translationCollapsibleButton.title = "Translation" self.translationCollapsibleButton.collapsed = True self.navigationCollapsibleLayout.addRow( self.translationCollapsibleButton) # Layout within the collapsible button self.translationFormLayout = qt.QFormLayout( self.translationCollapsibleButton) self.cameraXPosLabel = qt.QLabel(qt.Qt.Horizontal, None) self.cameraXPosLabel.text = "Left/Right [mm]: " self.cameraXPosSlider = slicer.qMRMLSliderWidget() setButtonStyle(self.cameraXPosSlider) self.cameraXPosSlider.minimum = self.sliderTranslationMinMm self.cameraXPosSlider.maximum = self.sliderTranslationMaxMm self.cameraXPosSlider.value = self.sliderTranslationDefaultMm self.cameraXPosSlider.singleStep = self.sliderSingleStepValue self.cameraXPosSlider.pageStep = self.sliderPageStepValue self.cameraXPosSlider.setDisabled(True) self.translationFormLayout.addRow(self.cameraXPosLabel, self.cameraXPosSlider) self.cameraYPosLabel = qt.QLabel(qt.Qt.Horizontal, None) self.cameraYPosLabel.setText("Down/Up [mm]: ") self.cameraYPosSlider = slicer.qMRMLSliderWidget() setButtonStyle(self.cameraYPosSlider) self.cameraYPosSlider.minimum = self.sliderTranslationMinMm self.cameraYPosSlider.maximum = self.sliderTranslationMaxMm self.cameraYPosSlider.value = self.sliderTranslationDefaultMm self.cameraYPosSlider.singleStep = self.sliderSingleStepValue self.cameraYPosSlider.pageStep = self.sliderPageStepValue self.cameraYPosSlider.setDisabled(True) self.translationFormLayout.addRow(self.cameraYPosLabel, self.cameraYPosSlider) self.cameraZPosLabel = qt.QLabel(qt.Qt.Horizontal, None) self.cameraZPosLabel.setText("Front/Back [mm]: ") self.cameraZPosSlider = slicer.qMRMLSliderWidget() setButtonStyle(self.cameraZPosSlider) self.cameraZPosSlider.minimum = self.sliderTranslationMinMm self.cameraZPosSlider.maximum = self.sliderTranslationMaxMm self.cameraZPosSlider.value = self.sliderTranslationDefaultMm self.cameraZPosSlider.singleStep = self.sliderSingleStepValue self.cameraZPosSlider.pageStep = self.sliderPageStepValue self.cameraZPosSlider.setDisabled(True) self.translationFormLayout.addRow(self.cameraZPosLabel, self.cameraZPosSlider) # "Contour adjustment" Collapsible self.contourAdjustmentCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.contourAdjustmentCollapsibleButton.title = "Contour adjustment" self.contourAdjustmentCollapsibleButton.collapsed = True self.navigationCollapsibleLayout.addRow( self.contourAdjustmentCollapsibleButton) # Layout within the collapsible button self.contourAdjustmentFormLayout = qt.QFormLayout( self.contourAdjustmentCollapsibleButton) self.placeTumorPointAtCauteryTipButton = qt.QPushButton( "Mark point at cautery tip") setButtonStyle(self.placeTumorPointAtCauteryTipButton) self.contourAdjustmentFormLayout.addRow( self.placeTumorPointAtCauteryTipButton) self.deleteLastFiducialDuringNavigationButton = qt.QPushButton( "Delete last") self.deleteLastFiducialDuringNavigationButton.setIcon( qt.QIcon(":/Icons/MarkupsDelete.png")) setButtonStyle(self.deleteLastFiducialDuringNavigationButton) self.deleteLastFiducialDuringNavigationButton.setEnabled(False) self.contourAdjustmentFormLayout.addRow( self.deleteLastFiducialDuringNavigationButton)
def setupNavigationPanel(self): logging.debug("setupNavigationPanel") self.sliderTranslationDefaultMm = 0 self.sliderTranslationMinMm = -500 self.sliderTranslationMaxMm = 500 self.sliderViewAngleDefaultDeg = 30 self.cameraViewAngleMinDeg = 5.0 # maximum magnification self.cameraViewAngleMaxDeg = 150.0 # minimum magnification self.sliderSingleStepValue = 1 self.sliderPageStepValue = 10 self.navigationCollapsibleButton.setProperty("collapsedHeight", 20) setButtonStyle(self.navigationCollapsibleButton, 2.0) self.navigationCollapsibleButton.text = "Navigation" self.sliceletPanelLayout.addWidget(self.navigationCollapsibleButton) self.navigationCollapsibleLayout = qt.QFormLayout(self.navigationCollapsibleButton) self.navigationCollapsibleLayout.setContentsMargins(12, 4, 4, 4) self.navigationCollapsibleLayout.setSpacing(4) self.rightCameraButton = qt.QPushButton("Setup right camera") self.rightCameraButton.setCheckable(True) setButtonStyle(self.rightCameraButton) self.leftCameraButton = qt.QPushButton("Setup left camera") self.leftCameraButton.setCheckable(True) setButtonStyle(self.leftCameraButton) hbox = qt.QHBoxLayout() hbox.addWidget(self.leftCameraButton) hbox.addWidget(self.rightCameraButton) self.navigationCollapsibleLayout.addRow(hbox) # "Camera Control" Collapsible self.zoomCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.zoomCollapsibleButton.collapsed = True self.zoomCollapsibleButton.title = "Zoom" self.navigationCollapsibleLayout.addRow(self.zoomCollapsibleButton) # Layout within the collapsible button self.zoomFormLayout = qt.QFormLayout(self.zoomCollapsibleButton) # Camera distance to focal point slider self.cameraViewAngleLabel = qt.QLabel(qt.Qt.Horizontal, None) self.cameraViewAngleLabel.setText("Field of view [degrees]: ") self.cameraViewAngleSlider = slicer.qMRMLSliderWidget() self.cameraViewAngleSlider.minimum = self.cameraViewAngleMinDeg self.cameraViewAngleSlider.maximum = self.cameraViewAngleMaxDeg self.cameraViewAngleSlider.value = self.sliderViewAngleDefaultDeg self.cameraViewAngleSlider.singleStep = self.sliderSingleStepValue self.cameraViewAngleSlider.pageStep = self.sliderPageStepValue self.cameraViewAngleSlider.setDisabled(True) self.zoomFormLayout.addRow(self.cameraViewAngleLabel, self.cameraViewAngleSlider) # "Camera Control" Collapsible self.translationCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.translationCollapsibleButton.title = "Translation" self.translationCollapsibleButton.collapsed = True self.navigationCollapsibleLayout.addRow(self.translationCollapsibleButton) # Layout within the collapsible button self.translationFormLayout = qt.QFormLayout(self.translationCollapsibleButton) self.cameraXPosLabel = qt.QLabel(qt.Qt.Horizontal, None) self.cameraXPosLabel.text = "Left/Right [mm]: " self.cameraXPosSlider = slicer.qMRMLSliderWidget() setButtonStyle(self.cameraXPosSlider) self.cameraXPosSlider.minimum = self.sliderTranslationMinMm self.cameraXPosSlider.maximum = self.sliderTranslationMaxMm self.cameraXPosSlider.value = self.sliderTranslationDefaultMm self.cameraXPosSlider.singleStep = self.sliderSingleStepValue self.cameraXPosSlider.pageStep = self.sliderPageStepValue self.cameraXPosSlider.setDisabled(True) self.translationFormLayout.addRow(self.cameraXPosLabel, self.cameraXPosSlider) self.cameraYPosLabel = qt.QLabel(qt.Qt.Horizontal, None) self.cameraYPosLabel.setText("Down/Up [mm]: ") self.cameraYPosSlider = slicer.qMRMLSliderWidget() setButtonStyle(self.cameraYPosSlider) self.cameraYPosSlider.minimum = self.sliderTranslationMinMm self.cameraYPosSlider.maximum = self.sliderTranslationMaxMm self.cameraYPosSlider.value = self.sliderTranslationDefaultMm self.cameraYPosSlider.singleStep = self.sliderSingleStepValue self.cameraYPosSlider.pageStep = self.sliderPageStepValue self.cameraYPosSlider.setDisabled(True) self.translationFormLayout.addRow(self.cameraYPosLabel, self.cameraYPosSlider) self.cameraZPosLabel = qt.QLabel(qt.Qt.Horizontal, None) self.cameraZPosLabel.setText("Front/Back [mm]: ") self.cameraZPosSlider = slicer.qMRMLSliderWidget() setButtonStyle(self.cameraZPosSlider) self.cameraZPosSlider.minimum = self.sliderTranslationMinMm self.cameraZPosSlider.maximum = self.sliderTranslationMaxMm self.cameraZPosSlider.value = self.sliderTranslationDefaultMm self.cameraZPosSlider.singleStep = self.sliderSingleStepValue self.cameraZPosSlider.pageStep = self.sliderPageStepValue self.cameraZPosSlider.setDisabled(True) self.translationFormLayout.addRow(self.cameraZPosLabel, self.cameraZPosSlider) # "Contour adjustment" Collapsible self.contourAdjustmentCollapsibleButton = ctk.ctkCollapsibleGroupBox() self.contourAdjustmentCollapsibleButton.title = "Contour adjustment" self.contourAdjustmentCollapsibleButton.collapsed = True self.navigationCollapsibleLayout.addRow(self.contourAdjustmentCollapsibleButton) # Layout within the collapsible button self.contourAdjustmentFormLayout = qt.QFormLayout(self.contourAdjustmentCollapsibleButton) self.placeTumorPointAtCauteryTipButton = qt.QPushButton("Mark point at cautery tip") setButtonStyle(self.placeTumorPointAtCauteryTipButton) self.contourAdjustmentFormLayout.addRow(self.placeTumorPointAtCauteryTipButton) self.deleteLastFiducialDuringNavigationButton = qt.QPushButton("Delete last") self.deleteLastFiducialDuringNavigationButton.setIcon(qt.QIcon(":/Icons/MarkupsDelete.png")) setButtonStyle(self.deleteLastFiducialDuringNavigationButton) self.deleteLastFiducialDuringNavigationButton.setEnabled(False) self.contourAdjustmentFormLayout.addRow(self.deleteLastFiducialDuringNavigationButton)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # TODO: The following lines are strictly for debug purposes, should be removed when this module is done self.developerMode = True slicer.tmwidget = self self.logic = CollectFiducialsSupplementLogic() # private widget-specific things self.enableButtonState = 0; # Collapsible buttons self.parametersCollapsibleButton = ctk.ctkCollapsibleButton() self.parametersCollapsibleButton.text = "CollectFiducialsSupplement" self.layout.addWidget(self.parametersCollapsibleButton) # Layout within the collapsible button self.parametersFormLayout = qt.QFormLayout(self.parametersCollapsibleButton) # Transform Tool Tip To Reference combobox self.transformNodeSourceLabel = qt.QLabel() self.transformNodeSourceLabel.setText("Source transform node: ") self.transformNodeSourceSelector = slicer.qMRMLNodeComboBox() self.transformNodeSourceSelector.nodeTypes = ( ("vtkMRMLLinearTransformNode"), "" ) self.transformNodeSourceSelector.noneEnabled = False self.transformNodeSourceSelector.addEnabled = False self.transformNodeSourceSelector.removeEnabled = False self.transformNodeSourceSelector.setMRMLScene( slicer.mrmlScene ) self.transformNodeSourceSelector.setToolTip("Pick the transform for going from the tool's tip to the target coordinate system") self.parametersFormLayout.addRow(self.transformNodeSourceLabel, self.transformNodeSourceSelector) # Transform Target to Reference combobox self.transformNodeTargetLabel = qt.QLabel() self.transformNodeTargetLabel.setText("Target transform node: ") self.transformNodeTargetSelector = slicer.qMRMLNodeComboBox() self.transformNodeTargetSelector.nodeTypes = ( ("vtkMRMLLinearTransformNode"), "" ) self.transformNodeTargetSelector.noneEnabled = False self.transformNodeTargetSelector.addEnabled = False self.transformNodeTargetSelector.removeEnabled = False self.transformNodeTargetSelector.setMRMLScene( slicer.mrmlScene ) self.transformNodeTargetSelector.setToolTip("Pick the transform for going from the tool's tip to the target coordinate system") self.parametersFormLayout.addRow(self.transformNodeTargetLabel, self.transformNodeTargetSelector) # Point List combobox self.pointListLabel = qt.QLabel() self.pointListLabel.setText("Point list: ") self.pointListSelector = slicer.qMRMLNodeComboBox() self.pointListSelector.nodeTypes = ( ("vtkMRMLMarkupsFiducialNode"), "" ) self.pointListSelector.noneEnabled = False self.pointListSelector.addEnabled = True self.pointListSelector.removeEnabled = False self.pointListSelector.setMRMLScene( slicer.mrmlScene ) self.pointListSelector.setToolTip("Pick which fiducial list to store collected points in") self.parametersFormLayout.addRow(self.pointListLabel, self.pointListSelector) # Allow point removals self.allowPointRemovalsLabel = qt.QLabel() self.allowPointRemovalsLabel.setText("Allow point removals: ") self.allowPointRemovalsCheckbox = qt.QCheckBox() self.parametersFormLayout.addRow(self.allowPointRemovalsLabel, self.allowPointRemovalsCheckbox) # Force constant distance self.forceConstantPointDistanceLabel = qt.QLabel() self.forceConstantPointDistanceLabel.setText("Force constant point distance: ") self.forceConstantPointDistanceCheckbox = qt.QCheckBox() self.parametersFormLayout.addRow(self.forceConstantPointDistanceLabel, self.forceConstantPointDistanceCheckbox) # Point add distance minimumAddDistanceSliderMinMm = 0 minimumAddDistanceSliderMaxMm = 50 minimumAddDistanceSliderDefaultMm = 10 self.minimumAddDistanceLabel = qt.QLabel(qt.Qt.Horizontal,None) self.minimumAddDistanceLabel.text = "Minimum point add distance: " self.minimumAddDistanceSlider = slicer.qMRMLSliderWidget() self.minimumAddDistanceSlider.minimum = minimumAddDistanceSliderMinMm self.minimumAddDistanceSlider.maximum = minimumAddDistanceSliderMaxMm self.minimumAddDistanceSlider.value = minimumAddDistanceSliderDefaultMm self.parametersFormLayout.addRow(self.minimumAddDistanceLabel,self.minimumAddDistanceSlider) self.enableButton = qt.QPushButton() self.enableButton.text = "Enable Automatic Fiducial Collection" self.enableButton.setToolTip("Start the automatic collection of fiducials based on the settings") self.parametersFormLayout.addRow(self.enableButton) self.removeAllPointsButton = qt.QPushButton() self.removeAllPointsButton.text = "Remove All Points" self.removeAllPointsButton.setToolTip("Make the current fiducial list empty. This will delete all data in that list.") self.parametersFormLayout.addRow(self.removeAllPointsButton) # Add vertical spacer self.layout.addStretch(1) #Connections self.enableButton.connect('clicked()', self.enableButtonPressed) self.removeAllPointsButton.connect('clicked()', self.logic.removeAllPoints) self.minimumAddDistanceSlider.connect('valueChanged(double)', self.logic.setMinimumAddDistanceMm) self.allowPointRemovalsCheckbox.connect('clicked()', self.allowPointRemovalsCheckboxClicked) self.forceConstantPointDistanceCheckbox.connect('clicked()', self.forceConstantPointDistanceCheckboxClicked) # Add vertical spacer self.layout.addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # TODO: The following lines are strictly for debug purposes, should be removed when this module is done self.developerMode = True slicer.tmwidget = self self.logic = CollectFiducialsSupplementLogic() # private widget-specific things self.enableButtonState = 0 # Collapsible buttons self.parametersCollapsibleButton = ctk.ctkCollapsibleButton() self.parametersCollapsibleButton.text = "CollectFiducialsSupplement" self.layout.addWidget(self.parametersCollapsibleButton) # Layout within the collapsible button self.parametersFormLayout = qt.QFormLayout( self.parametersCollapsibleButton) # Transform Tool Tip To Reference combobox self.transformNodeSourceLabel = qt.QLabel() self.transformNodeSourceLabel.setText("Source transform node: ") self.transformNodeSourceSelector = slicer.qMRMLNodeComboBox() self.transformNodeSourceSelector.nodeTypes = (( "vtkMRMLLinearTransformNode"), "") self.transformNodeSourceSelector.noneEnabled = False self.transformNodeSourceSelector.addEnabled = False self.transformNodeSourceSelector.removeEnabled = False self.transformNodeSourceSelector.setMRMLScene(slicer.mrmlScene) self.transformNodeSourceSelector.setToolTip( "Pick the transform for going from the tool's tip to the target coordinate system" ) self.parametersFormLayout.addRow(self.transformNodeSourceLabel, self.transformNodeSourceSelector) # Transform Target to Reference combobox self.transformNodeTargetLabel = qt.QLabel() self.transformNodeTargetLabel.setText("Target transform node: ") self.transformNodeTargetSelector = slicer.qMRMLNodeComboBox() self.transformNodeTargetSelector.nodeTypes = (( "vtkMRMLLinearTransformNode"), "") self.transformNodeTargetSelector.noneEnabled = False self.transformNodeTargetSelector.addEnabled = False self.transformNodeTargetSelector.removeEnabled = False self.transformNodeTargetSelector.setMRMLScene(slicer.mrmlScene) self.transformNodeTargetSelector.setToolTip( "Pick the transform for going from the tool's tip to the target coordinate system" ) self.parametersFormLayout.addRow(self.transformNodeTargetLabel, self.transformNodeTargetSelector) # Point List combobox self.pointListLabel = qt.QLabel() self.pointListLabel.setText("Point list: ") self.pointListSelector = slicer.qMRMLNodeComboBox() self.pointListSelector.nodeTypes = (("vtkMRMLMarkupsFiducialNode"), "") self.pointListSelector.noneEnabled = False self.pointListSelector.addEnabled = True self.pointListSelector.removeEnabled = False self.pointListSelector.setMRMLScene(slicer.mrmlScene) self.pointListSelector.setToolTip( "Pick which fiducial list to store collected points in") self.parametersFormLayout.addRow(self.pointListLabel, self.pointListSelector) # Allow point removals self.allowPointRemovalsLabel = qt.QLabel() self.allowPointRemovalsLabel.setText("Allow point removals: ") self.allowPointRemovalsCheckbox = qt.QCheckBox() self.parametersFormLayout.addRow(self.allowPointRemovalsLabel, self.allowPointRemovalsCheckbox) # Force constant distance self.forceConstantPointDistanceLabel = qt.QLabel() self.forceConstantPointDistanceLabel.setText( "Force constant point distance: ") self.forceConstantPointDistanceCheckbox = qt.QCheckBox() self.parametersFormLayout.addRow( self.forceConstantPointDistanceLabel, self.forceConstantPointDistanceCheckbox) # Point add distance minimumAddDistanceSliderMinMm = 0 minimumAddDistanceSliderMaxMm = 50 minimumAddDistanceSliderDefaultMm = 10 self.minimumAddDistanceLabel = qt.QLabel(qt.Qt.Horizontal, None) self.minimumAddDistanceLabel.text = "Minimum point add distance: " self.minimumAddDistanceSlider = slicer.qMRMLSliderWidget() self.minimumAddDistanceSlider.minimum = minimumAddDistanceSliderMinMm self.minimumAddDistanceSlider.maximum = minimumAddDistanceSliderMaxMm self.minimumAddDistanceSlider.value = minimumAddDistanceSliderDefaultMm self.parametersFormLayout.addRow(self.minimumAddDistanceLabel, self.minimumAddDistanceSlider) self.enableButton = qt.QPushButton() self.enableButton.text = "Enable Automatic Fiducial Collection" self.enableButton.setToolTip( "Start the automatic collection of fiducials based on the settings" ) self.parametersFormLayout.addRow(self.enableButton) self.removeAllPointsButton = qt.QPushButton() self.removeAllPointsButton.text = "Remove All Points" self.removeAllPointsButton.setToolTip( "Make the current fiducial list empty. This will delete all data in that list." ) self.parametersFormLayout.addRow(self.removeAllPointsButton) # Add vertical spacer self.layout.addStretch(1) #Connections self.enableButton.connect('clicked()', self.enableButtonPressed) self.removeAllPointsButton.connect('clicked()', self.logic.removeAllPoints) self.minimumAddDistanceSlider.connect( 'valueChanged(double)', self.logic.setMinimumAddDistanceMm) self.allowPointRemovalsCheckbox.connect( 'clicked()', self.allowPointRemovalsCheckboxClicked) self.forceConstantPointDistanceCheckbox.connect( 'clicked()', self.forceConstantPointDistanceCheckboxClicked) # Add vertical spacer self.layout.addStretch(1)