Difference between revisions of "Slicer3:Data Model"

From NAMIC Wiki
Jump to: navigation, search
m (Text replacement - "http://www.slicer.org/slicerWiki/index.php/" to "https://www.slicer.org/wiki/")
 
(19 intermediate revisions by 8 users not shown)
Line 1: Line 1:
= Slicer3 MRML Overview =
+
<big>'''Note:''' We are migrating this content to the slicer.org domain - <font color="orange">The newer page is [https://www.slicer.org/wiki/Slicer3:Data_Model#General_References_on_XML  here]</font></big>
 
 
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 [http://www.na-mic.org/Wiki/images/e/e3/Slicer_3-alpha-2006-04-03.ppt 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
 
* vtkMRMLVolumeNode
 
* vtkMRMLScalarVolumeNode
 
* vtkMRMLVectorVolumeNode
 
* vtkMRMLTensorVolumeNode
 
* vtkMRMLDiffusionTensorVolumeNode
 
* vtkMRMLDiffusionWeightedVolumeNode
 
* vtkMRMLVolumeDisplayNode
 
* vtkMRMLVectorVolumeDisplayNode
 
* vtkMRMLDiffusionTensorVolumeDisplayNode
 
* vtkMRMLDiffusionWeightedVolumeDisplayNode
 
* vtkMRMLVolumeHeaderlessStorageNode
 
* vtkMRMLVolumeArchetypeStorageNode
 
 
 
<br /> 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 MRML observer mechanism is implemented using the vtkObserverManager class. The following methods and macros that should be used for managing references and observers on the MRML nodes:
 
 
 
* vtkSetReferenceStringMacro - should be used to in the MRML node for setting the refrence ID to another node.
 
* VtkSetMRMLObjectMacro - registers a MRML node with another vtk object.
 
* VtkSetAndObserveMRMLObjectMacro - registers a MRML node with another vtk object and adds an observer for vtkCommand::ModifyEvent. The observer will call ProcessMRMLEvents method when node attributes are modified.
 
* VtkSetAndObserveMRMLObjectEventsMacro - registers a MRML node with another vtk object and adds an observer for a specified set of events. The observer will call ProcessMRMLEvents method when the events are generated.
 
* ProcessMRMLEvents method should be implemented on MRML nodes in order to process events from the referenced nodes.
 
* UpdateReferenceID method should be implemented on MRML nodes in order to update refrences to other nodes when the MRML scene changes their ID's.
 
* vtkMRMLScene::AddReferencedNodeID should be called in order to register refrences with the MRML scene when the node reads the reference ID from the XML mrml file.
 
 
 
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 [[http://www.na-mic.org/Slicer/Documentation/Slicer3/html/classes.html <nowiki>| Slicer3 Doxigen pages</nowiki>]]
 
 
 
== History ==
 
 
 
See Data Model notes in [[AHM_2006:ProjectsSlicerDataModel|AHM Programming week project]].
 
 
 
== Path-based MRML proposal ==
 
 
 
Mike's proposal for a [[Slicer3:MRML3_Path|path-based MRML3 representation]], based on extending the Coordinate Space Manager ideas to the entire MRML3 tree
 
 
 
== Slicer Daemon ==
 
 
 
The goal of the [[Slicer3:Slicer_Daemon|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)
 
 
 
<br />
 
 
 
== 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
 

Latest revision as of 17:37, 10 July 2017

Home < Slicer3:Data Model

Note: We are migrating this content to the slicer.org domain - The newer page is here