MRML nodes

  • vtkMRMLTableNode: Table node stores values that specify data point positions or bar heights in the plots.

  • vtkMRMLPlotSeriesNode: Defines a data series by referring to a table node and column name(s) for X and Y axes and labels.

    • It also defines display properties, such as plot type, color, line style.

    • Line and bar plots only require Y axis (points along X axis are equally spaced), scatter plots require two input data columns, for X and Y axes.

  • vtkMRMLPlotChartNode: Specifies which data series need to be shown in the chart.

    • Also contains global display properties for the chart, such as titles and font style.

  • vtkMRMLPlotViewNode: Specifies which chart is to be displayed in the plot view and how the user can interact with it.

    • There has to be exactly one plot view node for each plot view widget. This class can not be created or copied unless is connected with a plot view.



qMRMLPlotView objects provide dataSelected(vtkStringArray* mrmlPlotSeriesIDs, vtkCollection* selectionCol) signal that allow modules to respond to user interactions with the Plot canvas. The signal is emitted when a data point or more has been selected. Returns the series node IDs and a list of selected point IDs (as a collection of vtkIdTypeArray objects).

Python API example:

# Switch to a layout that contains a plot view to create a plot widget
layoutManager =
layoutWithPlot = slicer.modules.plots.logic().GetLayoutWithPlot(layoutManager.layout)

# Select chart in plot view
plotWidget = layoutManager.plotWidget(0)
plotViewNode = plotWidget.mrmlPlotViewNode()

# Add a PlotCharNode 
# plotViewNode.SetPlotChartNodeID(''PlotChartNode''.GetID())

# Print selected point IDs
def onDataSelected(mrmlPlotDataIDs, selectionCol):
    print("Selection changed:")
    for selectionIndex in range(mrmlPlotDataIDs.GetNumberOfValues()):
        pointIdList = []
        pointIds = selectionCol.GetItemAsObject(selectionIndex)
        for pointIndex in range(pointIds.GetNumberOfValues()):
        print("  {0}: {1}".format(mrmlPlotDataIDs.GetValue(selectionIndex), pointIdList))

# Connect the signal with a slot ''onDataSelected''
plotView = plotWidget.plotView()
plotView.connect("dataSelected(vtkStringArray*, vtkCollection*)", self.onDataSelected) 


Examples for common DICOM operations are provided in the script repository.