Slicer3:Data Model

From NAMIC Wiki
Revision as of 13:41, 18 December 2006 by Andy (talk | contribs) (Update from Wiki)
Jump to: navigation, search
Home < Slicer3:Data Model

Slicer3 MRML Overview

Slicer3 MRML Library provides API for managing medical image data types (Volumes, Models, Transforms, Fiducials, Cameras, etc). Each specific data type is represented by a MRML node. MRML Scene is a collection of MRML nodes. It’s API allows adding, deleting, reading/writing, and modifying of MRML nodes.

Slicer3 data models is implemented independent of the visualization and algorithmic components of the system.

MRML scene provides functionality to serialize and deserialize the contents in an XML structure. Each MRML node provide methods for reading and writing it’s attributes to and from XML files.

MRML scene provides Undo/Redo mechanism which is based on saving and restoring the state of MRML nodes.

For more details on MRML architecture and Undo/Redo design see Architecture Slides.

MRML Nodes

The following MRML nodes are currently supported in Slicer3:

  • vtkMRMLCameraNode
  • vtkMRMLClipModelsNode
  • vtkMRMLSliceCompositeNode
  • vtkMRMLSliceNode
  • vtkMRMLColorNode
  • vtkMRMLTransformNode
  • vtkMRMLLinearTransformNode
  • vtkMRMLTransformableNode
  • vtkMRMLFiducialListNode
  • vtkMRMLModelNode
  • vtkMRMLModelDisplayNode
  • vtkMRMLStorageNode
  • vtkMRMLModelStorageNode
  • vtkMRMLVolumeHeaderlessStorageNode
  • vtkMRMLVolumeArchetypeStorageNode
  • vtkMRMLVolumeNode
  • vtkMRMLScalarVolumeNode
  • vtkMRMLVectorVolumeNode
  • vtkMRMLVolumeDisplayNode


MRML Nodes are organized into class hierarchies. For example vtkMRMLTransformableNode is the parent class of Volume, Model, Fiducial, and Transformation nodes; vtkVolumeNode is a parent of vtkMRMLScalarVolumeNode and vtkMRMLVectorVolumeNode.

Some MRML nodes have references to other nodes. For example vtkMRMLTransformableNode has a references to it’s transformation. The Transformation node itself has reference to it’s parent Transformation node. The references are stored by node ID (a unique node identifier), for example vtkMRMLTransformableNode stores a reference to it’s Transformation node in the “TransformNodeID “ member variable and in the XML file using “transformNodeRef” attribute.

Changes in the nodes that are referenced by other nodes should propagate though these other nodes to the GUI and Logic elements that observe the changes. The propagation of modification events is done by using the vtkObserver mechanism. The observer mechanism is implemented using the vtkObserverManager class and the following macros that should be used for managing the observers on the MRML nodes:

  • VtkSetMRMLObjectMacro
  • VtkSetAndObserveMRMLObjectMacro
  • VtkSetAndObserveMRMLObjectEventsMacro

An example of using this reference/observer mechanism can be found in the implementation of vtkMRMLTransformableNode class.

References

MRML API Documentation

The detailed documentaion of MRML API can be found in [| Slicer3 Doxigen pages]

History

See Data Model notes in AHM Programming week project.

Path-based MRML proposal

Mike's proposal for a path-based MRML3 representation, based on extending the Coordinate Space Manager ideas to the entire MRML3 tree

Slicer Daemon

The goal of the Slicer Daemon project is to allow remote editing of the MRML data model by external programs over a socket.

Slicer 2.6 MRML

Data Represented in MRML in Slicer 2.6

  • Volumes
    • IJK->RAS (VTK->RAS)
    • Scalar Types
    • Multicomponent (RGB, Displacement Vector)
    • Tensor Volumes
    • Label Maps
    • Reference to Lookup Table
  • Models
    • vtkPolyData
      • Named Field Data (scalars, vectors, labels) at points and cells (FreeSurferReaders)
      • Polylines with tensor point data (DTMRI Module)
    • Color, Clipping State, Visibility, Scalar Visibility, LookupTable
  • Transforms
    • Matrix4x4
  • Lookup Tables
    • vtkLookupTable info
  • Fiducials
    • Position, Quaternion
    • Name, Selection State, Type (endoscopic, normal)
    • Glyph Size, Text Size
  • Fiducial Lists
    • Name, Slze, Color, Selection State
  • Colors
    • Name, Label#, Diffuse/Ambient/Specular
  • Model Groups
  • Application State (not to be carried to Slicer3 MRML)
  • Locator (not to be carried to Slicer3 MRML)
  • Module Specific Parameters (not to be carried to Slicer3 MRML)


Operations On MRML Scene

  • Load from File
  • Save to File
  • Traverse Nodes in Tree
  • Insert Node
  • Delete Node
  • Register Tree Observer
  • Update MRML
  • Get Transformations (e.g. IJK to World through transform tree)
  • Data Type Specific Operations
    • Get/Set Node MetaData
    • Get/Set Data (e.g. as vtkImageData)

General References on XML

A wikibook on XML: http://en.wikibooks.org/wiki/XML:_Managing_Data_Exchange

The section on ID/IDREF implementations which are similar to what we use in MRML: http://en.wikibooks.org/wiki/XML:_Managing_Data_Exchange/The_many-to-many_relationship#ID.2FIDREF