How to use the slicer.mrmlScene 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 Kitware / SlicerSALT / Modules / Scripted / ShapeAnalysisToolBox / DataImporter.py View on Github external
self.filteredFilePathsList = list()
    self.tableWidgetItemDefaultFlags = qt.Qt.NoItemFlags | qt.Qt.ItemIsSelectable | qt.Qt.ItemIsEnabled
    self.displayOnClick = True

    # Table columns
    self.subjectsColumnName = 0
    self.subjectsColumnConsistency = 1
    # Note that these values change on initSegmentsTable/initSegmentsMultiTable
    self.segmentsColumnSubjectName = -1
    self.segmentsColumnSegmentName = 0
    self.segmentsColumnTopologyCurrent = 1
    self.segmentsColumnTopologyExpected = 2

    # get available color tables
    self.color_table_dict = dict()
    scene = slicer.mrmlScene
    count = scene.GetNumberOfNodes()
    for idx in range(count):
      node = scene.GetNthNode(idx)
      node_type = node.GetClassName()
      name = node.GetName()
      id = node.GetID()
      if node_type == 'vtkMRMLColorTableNode':
        self.color_table_dict[name] = id

    # Load widget from .ui file (created by Qt Designer)
    uiWidget = slicer.util.loadUI(self.resourcePath('%s.ui' % self.moduleName))
    self.layout.addWidget(uiWidget)
    self.ui = slicer.util.childWidgetVariables(uiWidget)

    # Qtabwidget
    self.ImporterTypeTabWidget = self.ui.ImporterTypeTabWidget
github SlicerProstate / SliceTracker / SliceTracker / SliceTrackerUtils / steps / plugins / segmentationValidator.py View on Github external
def setupSegmentEditor(self):
    self.segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
    self.segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
    self.segmentEditorWidget.visible = False
    self.segmentEditorWidget.setSegmentationNodeSelectorVisible(False)
    self.segmentEditorWidget.setMasterVolumeNodeSelectorVisible(False)
    self.segmentEditorWidget.setSwitchToSegmentationsButtonVisible(False)
    self.segmentEditorWidget.findChild(qt.QPushButton, "AddSegmentButton").hide()
    self.segmentEditorWidget.findChild(qt.QPushButton, "RemoveSegmentButton").hide()
    self.segmentEditorWidget.findChild(ctk.ctkMenuButton, "Show3DButton").hide()
    self.segmentEditorWidget.findChild(ctk.ctkExpandableWidget, "SegmentsTableResizableFrame").hide()
    self.segmentEditorWidget.setSizePolicy(qt.QSizePolicy.Maximum, qt.QSizePolicy.Expanding)
github QIICR / QuantitativeReporting / DICOMPlugins / DICOMSegmentationPlugin.py View on Github external
def _removeLabelNode(self, labelNode):
    dNode = labelNode.GetDisplayNode()
    if dNode is not None:
      slicer.mrmlScene.RemoveNode(dNode)
    slicer.mrmlScene.RemoveNode(labelNode)
github SlicerDMRI / SlicerDMRI / Modules / Loadable / TractographyDisplay / Testing / Python / NsgPlanTracto.py View on Github external
def __init__(self, parent = None):
    if not parent:
      self.parent = slicer.qMRMLWidget()
      self.parent.setLayout(qt.QVBoxLayout())
      self.parent.setMRMLScene(slicer.mrmlScene)
    else:
      self.parent = parent
    self.layout = self.parent.layout()
    if not parent:
      self.setup()
      self.parent.show()