How to use the slicer.mrmlScene.AddNewNodeByClass 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 SlicerProstate / SliceTracker / SliceTracker / SliceTrackerUtils / steps / plugins / charts.py View on Github external
def _initializeChartTable(self):
    self._chartTable = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLTableNode", "Target Displacement")
github SlicerHeart / SlicerHeart / CardiacDeviceSimulator / CardiacDeviceSimulator.py View on Github external
vesselLumenModelNode = self.getVesselModelNode()
    if not vesselLumenModelNode:
      vesselLumenModelNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLModelNode', 'VesselLumenModel')
      vesselLumenModelNode.CreateDefaultDisplayNodes()
      vesselLumenModelNode.SetAndObserveTransformNodeID(vesselLumenSegmentationNode.GetTransformNodeID())
      vesselLumenModelNode.GetDisplayNode().SetOpacity(0.5)
      vesselLumenModelNode.GetDisplayNode().SliceIntersectionVisibilityOn()
      shNode.SetItemParent(shNode.GetItemByDataNode(vesselLumenModelNode), centerlineFolderShItem)
      self.setVesselModelNode(vesselLumenModelNode)
    slicer.modules.segmentations.logic().ExportSegmentToRepresentationNode(
      vesselLumenSegmentationNode.GetSegmentation().GetSegment(vesselLumenSegmentId), vesselLumenModelNode)

    # Create centerline curve
    centerlineCurveNode = self.getCenterlineNode()
    if not centerlineCurveNode:
      centerlineCurveNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsCurveNode', 'VesselCenterlineCurve')
      centerlineCurveNode.CreateDefaultDisplayNodes()
      shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
      shNode.SetItemParent(shNode.GetItemByDataNode(centerlineCurveNode), centerlineFolderShItem)
      self.setCenterlineNode(centerlineCurveNode)

    # Extract skeleton
    slicer.util.showStatusMessage("Extracting centerline, this may take a few minutes...", 3000)
    parameters = {}
    parameters["InputImageFileName"] = vesselLumenLabelMapNode.GetID()
    vesselCenterlineOutputLabelMapNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLLabelMapVolumeNode', 'VesselCenterlineLabelMapTemp')
    parameters["OutputImageFileName"] = vesselCenterlineOutputLabelMapNode.GetID()
    parameters["OutputFiducialsFileName"] = centerlineCurveNode.GetID()
    parameters["NumberOfPoints"] = 100
    centerlineExtractor = slicer.modules.extractskeleton
    qt.QApplication.setOverrideCursor(qt.Qt.WaitCursor)
    cliNode = slicer.cli.runSync(centerlineExtractor, None, parameters)
github SlicerProstate / SliceTracker / SliceTracker / SliceTrackerUtils / steps / plugins / charts.py View on Github external
def createPlot(self, color, plotNumber):
    plotSeriesNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLPlotSeriesNode", self.PLOT_NAMES[plotNumber - 1])
    plotSeriesNode.SetAndObserveTableNodeID(self._chartTable.GetID())
    plotSeriesNode.SetXColumnName(self._chartTable.GetColumnName(0))
    plotSeriesNode.SetYColumnName(self._chartTable.GetColumnName(plotNumber))
    plotSeriesNode.SetColor(color)
    plotSeriesNode.SetPlotType(slicer.vtkMRMLPlotSeriesNode.PlotTypeScatter)
    plotSeriesNode.SetMarkerStyle(4)
    plotSeriesNode.SetMarkerSize(3 * plotSeriesNode.GetLineWidth())

    self._plotSeriesNodes.append(plotSeriesNode)
    self._plotChartNode.AddAndObservePlotSeriesNodeID(plotSeriesNode.GetID())
github QIICR / QuantitativeReporting / QuantitativeReporting / QuantitativeReporting.py View on Github external
def createNewSegmentationNode(self):
    return slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode")
github SlicerProstate / SliceTracker / SliceTracker / SliceTrackerUtils / steps / plugins / segmentationValidator.py View on Github external
def _initializeSegmentationNode(self):
    self.segmentationNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode")
    self.segmentationNode.CreateDefaultDisplayNodes()
    self.segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(self.volumeNode)