How to use the slicer.qMRMLNodeComboBox function in slicer

To help you get started, we’ve selected a few slicer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SlicerRt / SlicerRT / PlmVectorFieldAnalysis / PlmVectorFieldAnalysis.py View on Github external
# Apply Button
    self.applyButton = qt.QPushButton("Apply")
    self.applyButton.toolTip = "Run the algorithm."
    self.applyButton.enabled = True
    self.layout.addWidget(self.applyButton)
    
    ### Output Area
    outputCollapsibleButton = ctk.ctkCollapsibleButton()
    outputCollapsibleButton.text = "Output"
    self.layout.addWidget(outputCollapsibleButton)

    # Layout within the dummy collapsible button
    outputFormLayout = qt.QFormLayout(outputCollapsibleButton)

    # Jacobian image (mrml output)
    self.outputJacobian = slicer.qMRMLNodeComboBox()
    self.outputJacobian.nodeTypes = ["vtkMRMLScalarVolumeNode"]
    self.outputJacobian.setMRMLScene( slicer.mrmlScene )
    self.outputJacobian.addEnabled = True
    self.outputJacobian.renameEnabled = True
    #self.outputJacobian.layout().addWidget(self.outputSelector)
    self.outputJacobian.setToolTip( "Output image of Jacobian matrix.vtkSlicerPlastimatchModuleLogicPython" )
    outputFormLayout.addRow("Jacobian image: ", self.outputJacobian)

    # output directory selector
#    self.outputDirectory = ctk.ctkDirectoryButton()
#    self.outputDirectory.directory = qt.QDir.homePath()
#    outputFormLayout.addRow("Output Directory: ", self.outputDirectory)
    
    # output statistics
    buttonLayout = qt.QHBoxLayout()
    self.minJacobian = qt.QLineEdit()
github SlicerHeart / SlicerHeart / CardiacDeviceSimulator / CardiacDeviceSimulatorUtils / DevicePositioningWidget.py View on Github external
self.vesselSegmentSelector.setToolTip("Select vessel lumen (blood) segment. The segment must be a solid, filled "
                                          "model of the blood (not a shell).")
    lay.addRow("Vessel lumen: ", self.vesselSegmentSelector)
    self.vesselSegmentSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onVesselLumenSegmentSelectionChanged)
    self.vesselSegmentSelector.connect("currentSegmentChanged(QString)", self.onVesselLumenSegmentSelectionChanged)

    # Button to position device at closest centerline point
    self.processVesselSegmentButton = qt.QPushButton("Detect vessel centerline")
    self.processVesselSegmentButton.setToolTip("Extract centerline and lumen surface from vessel segment")
    lay.addRow(self.processVesselSegmentButton)
    self.processVesselSegmentButton.connect('clicked(bool)', self.onProcessVesselSegmentClicked)
    self.processVesselSegmentButton.enabled = bool(self.vesselSegmentSelector.currentSegmentID())


    # Centerline curve node selector
    self.centerlineNodeSelector = slicer.qMRMLNodeComboBox()
    self.centerlineNodeSelector.nodeTypes = ["vtkMRMLMarkupsCurveNode"]
    self.centerlineNodeSelector.setNodeTypeLabel("Centerline", "vtkMRMLMarkupsCurveNode")
    self.centerlineNodeSelector.baseName = "Centerline"
    self.centerlineNodeSelector.selectNodeUponCreation = False
    self.centerlineNodeSelector.addEnabled = False
    self.centerlineNodeSelector.removeEnabled = False
    self.centerlineNodeSelector.noneEnabled = True
    self.centerlineNodeSelector.showHidden = True
    self.centerlineNodeSelector.renameEnabled = True
    self.centerlineNodeSelector.setMRMLScene(slicer.mrmlScene)
    self.centerlineNodeSelector.setToolTip("Select a curve to be used for positioning the device")
    lay.addRow("Centerline: ", self.centerlineNodeSelector)
    self.centerlineNodeSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                             self.onCenterlineNodeSelectionChanged)

    # Button to position device at closest centerline point
github SlicerIGT / SlicerIGT / Scoliosis / SlicerExtension / PostureAssessmentToolkit / StandardizeLandmarks / StandardizeLandmarks.py View on Github external
self.DataCollapsibleButton = ctk.ctkCollapsibleButton()
    self.DataCollapsibleButton.text = "Data Selection"
    self.layout.addWidget(self.DataCollapsibleButton)
    self.DataInterfaceLayout = qt.QGridLayout(self.DataCollapsibleButton)
    self.DataInterfaceLayout.setHorizontalSpacing(12)
    
    # Checkbox to indicate whether to operate on all MarkupsNodes, or to select one
    self.ModifyAllNodesCheckBox = qt.QCheckBox()
    self.ModifyAllNodesCheckBox.checked = 0
    self.ModifyAllNodesCheckBox.toolTip = "Check if you want to operate on all MarkupsNodes in the scene, uncheck if you want to select one"
    self.DataInterfaceLayout.addWidget(qt.QLabel("All Nodes?"), 0, 0, 1, 1)
    self.DataInterfaceLayout.addWidget(self.ModifyAllNodesCheckBox, 0, 1, 1, 1)
    
    # Single node ComboBox selector
    self.SingleNodeSelector = slicer.qMRMLNodeComboBox()
    self.SingleNodeSelector.nodeTypes = ["vtkMRMLMarkupsFiducialNode",]
    self.SingleNodeSelector.enabled = True
    self.SingleNodeSelector.selectNodeUponCreation = True
    self.SingleNodeSelector.addEnabled = False
    self.SingleNodeSelector.removeEnabled = False
    self.SingleNodeSelector.noneEnabled = True
    self.SingleNodeSelector.showHidden = False
    self.SingleNodeSelector.showChildNodeTypes = False
    self.SingleNodeSelector.setMRMLScene( slicer.mrmlScene )
    self.SingleNodeSelector.setToolTip( "Pick the input to the algorithm." )
    self.DataInterfaceLayout.addWidget(qt.QLabel("Node selector"), 0, 2, 1, 1)
    self.DataInterfaceLayout.addWidget(self.SingleNodeSelector, 0, 3, 1, 1)
    
    #
    # Operations Interface
    #
github SlicerRt / SlicerRT / PlmMismatchError / PlmMismatchError.py View on Github external
self.fixedLandmarks.addEnabled = False
    self.fixedLandmarks.removeEnabled = False
    self.fixedLandmarks.noneEnabled = True
    self.fixedLandmarks.showHidden = False
    self.fixedLandmarks.renameEnabled = True
    self.fixedLandmarks.setMRMLScene( slicer.mrmlScene )
    self.fixedLandmarks.setToolTip( "Landmarks on fixed image." )
    inputFormLayout.addRow("Fixed landmarks: ", self.fixedLandmarks)

    # fixed landmarks (directory input)
    self.fixedLandmarksDirectory = ctk.ctkDirectoryButton()
    self.fixedLandmarksDirectory.directory = qt.QDir.homePath()
    inputFormLayout.addRow("", self.fixedLandmarksDirectory)

    # moving landmarks (mrml input)
    self.movingLandmarks = slicer.qMRMLNodeComboBox()
    self.movingLandmarks.nodeTypes = ["vtkMRMLMarkupsFiducialNode"]
    self.movingLandmarks.selectNodeUponCreation = True
    self.movingLandmarks.addEnabled = False
    self.movingLandmarks.removeEnabled = False
    self.movingLandmarks.noneEnabled = True
    self.movingLandmarks.showHidden = False
    self.movingLandmarks.showChildNodeTypes = False
    self.movingLandmarks.setMRMLScene( slicer.mrmlScene )
    self.movingLandmarks.setToolTip( "Landmarks on moving image." )
    inputFormLayout.addRow("Moving landmarks: ", self.movingLandmarks)

    self.view = qt.QTableView()
    self.view.sortingEnabled = True
    self.parent.layout().addWidget(self.view)

    # moving landmarks (directory input)
github SlicerRt / SlicerRT / DicomSroExport / DicomSroExport.py View on Github external
self.fixedMRMLSelector.addEnabled = False
    self.fixedMRMLSelector.removeEnabled = False
    self.fixedMRMLSelector.noneEnabled = False
    self.fixedMRMLSelector.showHidden = False
    self.fixedMRMLSelector.showChildNodeTypes = False
    self.fixedMRMLSelector.setMRMLScene( slicer.mrmlScene )
    self.fixedMRMLSelector.setToolTip ("Choose either an image within the MRML scene, or a directory containing a DICOM image")
    parametersFormLayout.addRow("Fixed image: ", self.fixedMRMLSelector)

    # fixed image (directory input)
    self.fixedInputDirectory = ctk.ctkDirectoryButton()
    self.fixedInputDirectory.directory = qt.QDir.homePath()
    parametersFormLayout.addRow("", self.fixedInputDirectory)

    # moving image (mrml input)
    self.movingMRMLSelector = slicer.qMRMLNodeComboBox()
    self.movingMRMLSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
    self.movingMRMLSelector.selectNodeUponCreation = True
    self.movingMRMLSelector.addEnabled = False
    self.movingMRMLSelector.removeEnabled = False
    self.movingMRMLSelector.noneEnabled = False
    self.movingMRMLSelector.showHidden = False
    self.movingMRMLSelector.showChildNodeTypes = False
    self.movingMRMLSelector.setMRMLScene( slicer.mrmlScene )
    self.fixedMRMLSelector.setToolTip ("Choose either an image within the MRML scene, or a directory containing a DICOM image")
    parametersFormLayout.addRow("Moving image: ", self.movingMRMLSelector)

    # moving image (directory input)
    self.movingInputDirectory = ctk.ctkDirectoryButton()
    self.movingInputDirectory.directory = qt.QDir.homePath()
    parametersFormLayout.addRow("", self.movingInputDirectory)
github SlicerDMRI / SlicerDMRI / Modules / Scripted / FiberBundleToLabelMap / FiberBundleToLabelMap.py View on Github external
def setup(self):
    # Instantiate and connect widgets ...

    # Collapsible button
    parametersCollapsibleButton = ctk.ctkCollapsibleButton()
    parametersCollapsibleButton.text = "Parameters"
    self.layout.addWidget(parametersCollapsibleButton)

    # Layout within the parameters collapsible button
    parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)

    # fiber
    self.fiberSelector = slicer.qMRMLNodeComboBox(parametersCollapsibleButton)
    self.fiberSelector.nodeTypes = ["vtkMRMLFiberBundleNode"]
    self.fiberSelector.selectNodeUponCreation = False
    self.fiberSelector.addEnabled = False
    self.fiberSelector.removeEnabled = False
    self.fiberSelector.noneEnabled = True
    self.fiberSelector.showHidden = False
    self.fiberSelector.showChildNodeTypes = False
    self.fiberSelector.setMRMLScene( slicer.mrmlScene )
    self.fiberSelector.setToolTip( "Pick the fiber bundle to be converted." )
    parametersFormLayout.addRow("Fiber Bundle", self.fiberSelector)

    # label map
    self.labelSelector = slicer.qMRMLNodeComboBox(parametersCollapsibleButton)
    self.labelSelector.nodeTypes = ["vtkMRMLLabelMapVolumeNode"]
    self.labelSelector.selectNodeUponCreation = False
    self.labelSelector.addEnabled = False
github SlicerIGT / SlicerIGT / Scoliosis / SlicerExtension / PostureAssessmentToolkit / PreProcessLandmarks / PreProcessLandmarks.py View on Github external
self.RepairConfigInterfaceLayout.addWidget(qt.QLabel("Imputation specificity"), 5, 0, 1, 1)
    self.RepairConfigInterfaceLayout.addWidget(self.ImputationSpecificitySlider, 5, 1, 1, 3)
    
    self.RepairConfigInterfaceLayout.addWidget(qt.QLabel(""))

    #*********Connections*********#
    
    self.kmWindowSizeSlider.connect('valueChanged(double)', self.OnkmWindowSliderChanged)
    self.PolyFitDegreeSlider.connect('valueChanged(double)', self.OnPolyFitDegreeSliderChanged)
    self.BoundaryMultiplicitySlider.connect('valueChanged(double)', self.OnBoundaryMultiplicitySliderChanged)
    self.SpecificitySlider.connect('valueChanged(double)', self.OnSpecificitySliderChanged)
    self.ImputationSpecificitySlider.connect('valueChanged(double)', self.OnImputationSpecificitySliderChanged)
    
    #*********DataDisplay*********#
    
    self.LeftSideSelector = slicer.qMRMLNodeComboBox()
    self.LeftSideSelector.nodeTypes = ["vtkMRMLMarkupsFiducialNode",]
    self.LeftSideSelector.selectNodeUponCreation = False
    self.LeftSideSelector.enabled  = False
    self.LeftSideSelector.addEnabled = False
    #self.LeftSideSelector.editEnabled = False
    self.LeftSideSelector.noneEnabled = True
    self.LeftSideSelector.removeEnabled = False
    self.LeftSideSelector.renameEnabled = False
    self.LeftSideSelector.toolTip = "Stores the left side of the patient's landmarks being repaired"
    self.LeftSideSelector.setMRMLScene(slicer.mrmlScene)

    self.RightSideSelector = slicer.qMRMLNodeComboBox()
    self.RightSideSelector.nodeTypes = ["vtkMRMLMarkupsFiducialNode",]
    self.RightSideSelector.selectNodeUponCreation = False
    self.RightSideSelector.enabled  = False
    self.RightSideSelector.addEnabled = False
github lassoan / SlicerElastix / Elastix / Elastix.py View on Github external
self.fixedVolumeSelector = slicer.qMRMLNodeComboBox()
    self.fixedVolumeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
    self.fixedVolumeSelector.selectNodeUponCreation = True
    self.fixedVolumeSelector.addEnabled = False
    self.fixedVolumeSelector.removeEnabled = False
    self.fixedVolumeSelector.noneEnabled = False
    self.fixedVolumeSelector.showHidden = False
    self.fixedVolumeSelector.showChildNodeTypes = False
    self.fixedVolumeSelector.setMRMLScene( slicer.mrmlScene )
    self.fixedVolumeSelector.setToolTip( "The moving volume will be transformed into this image space." )
    inputParametersFormLayout.addRow("Fixed volume: ", self.fixedVolumeSelector)

    #
    # moving volume selector
    #
    self.movingVolumeSelector = slicer.qMRMLNodeComboBox()
    self.movingVolumeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
    self.movingVolumeSelector.selectNodeUponCreation = True
    self.movingVolumeSelector.addEnabled = False
    self.movingVolumeSelector.removeEnabled = False
    self.movingVolumeSelector.noneEnabled = False
    self.movingVolumeSelector.showHidden = False
    self.movingVolumeSelector.showChildNodeTypes = False
    self.movingVolumeSelector.setMRMLScene( slicer.mrmlScene )
    self.movingVolumeSelector.setToolTip( "This volume will be transformed into the fixed image space" )
    inputParametersFormLayout.addRow("Moving volume: ", self.movingVolumeSelector)

    self.registrationPresetSelector = qt.QComboBox()
    for preset in self.logic.getRegistrationPresets():
      self.registrationPresetSelector.addItem("{0} ({1})".format(preset[RegistrationPresets_Modality], preset[RegistrationPresets_Content]))
    inputParametersFormLayout.addRow("Preset: ", self.registrationPresetSelector)
github SlicerHeart / SlicerHeart / CardiacDeviceSimulator / CardiacDeviceSimulatorUtils / DeviceDeformationWidget.py View on Github external
# #lay.addRow(self.createClosedSegmentsForAlreadyFittedDeviceButton)
    # self.createClosedSegmentsForAlreadyFittedDeviceButton.connect('clicked(bool)', self.onCreateClosedSegmentsForAlreadyFittedHarmonyDevice)

    lay = self.layout()

    self.handlesPerSliceSliderWidget = UIHelper.addSlider({
      "name": "Handles per slice:", "info": "Controls how many handles are generated for device deformation",
      "value": 8, "unit": "", "minimum": 4, "maximum": 12, "singleStep": 2, "pageStep": 1, "decimals": 0}, lay,
      self.onHandlesSettingsChanged)

    self.handlesSpacingSliderWidget = UIHelper.addSlider({
      "name": "Handles spacing:", "info": "Controls distance between handles", "value": 5, "unit": "mm", "minimum": 3,
      "maximum": 15, "singleStep": 1, "pageStep": 1, "decimals": 0}, lay, self.onHandlesSettingsChanged)

    # Vessel model selector
    self.vesselModelNodeSelector = slicer.qMRMLNodeComboBox()
    self.vesselModelNodeSelector.nodeTypes = ["vtkMRMLModelNode"]
    self.vesselModelNodeSelector.setNodeTypeLabel("Vessel", "vtkMRMLModelNode")
    self.vesselModelNodeSelector.baseName = "Vessel"
    self.vesselModelNodeSelector.selectNodeUponCreation = False
    self.vesselModelNodeSelector.addEnabled = False
    self.vesselModelNodeSelector.removeEnabled = False
    self.vesselModelNodeSelector.noneEnabled = True
    self.vesselModelNodeSelector.showHidden = True
    self.vesselModelNodeSelector.renameEnabled = True
    self.vesselModelNodeSelector.setMRMLScene(slicer.mrmlScene)
    self.vesselModelNodeSelector.setToolTip("select the extracted centerline model to be used for positioning the device")
    lay.addRow("Vessel model node: ", self.vesselModelNodeSelector)
    self.vesselModelNodeSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onVesselModelNodeSelectionChanged)

    # Radio button to choose whether to allow device expansion to fit vessel walls (some devices cannot be expanded beyond their native size, they can only be compressed
    self.allowDeviceExpansionToVesselWallsCheckbox = qt.QCheckBox()
github faustomilletari / TOMAAT-Slicer / TOMAAT / utils / ui.py View on Github external
for view in ['Red', 'Green', 'Yellow']:
            view_widget = slicer.app.layoutManager().sliceWidget(view)
            view_logic = view_widget.sliceLogic()

            view_logic.GetSliceCompositeNode().SetForegroundVolumeID(self.currentNodeID)
            view_logic.GetSliceCompositeNode().SetBackgroundVolumeID(self.currentNodeID)

            view_logic.GetSliceCompositeNode().SetLabelOpacity(0.5)
            view_logic.FitSliceToAll()

        sliceWidget = slicer.app.layoutManager().sliceWidget('Red')
        sliceLogic = sliceWidget.sliceLogic()
        sliceNode = sliceLogic.GetSliceNode()
        sliceNode.SetSliceVisible(True)

class MarkupsFiducialWidget(slicer.qMRMLNodeComboBox):
    def __init__(self, destination):
        super(MarkupsFiducialWidget, self).__init__()

        self.destination = destination

        self.type = 'MarkupsFiducialWidget'

        self.nodeTypes = ['vtkMRMLMarkupsFiducialNode']
        self.selectNodeUponCreation = True
        self.addEnabled = False
        self.removeEnabled = False
        self.noneEnabled = False
        self.showHidden = False
        self.showChildNodeTypes = False
        self.setMRMLScene(slicer.mrmlScene)
        self.setToolTip('Pick fiducial list')