Difference between revisions of "Slicer3:Data Model"
m (Update from Wiki) |
|||
Line 28: | Line 28: | ||
* vtkMRMLStorageNode | * vtkMRMLStorageNode | ||
* vtkMRMLModelStorageNode | * vtkMRMLModelStorageNode | ||
− | |||
− | |||
* vtkMRMLVolumeNode | * vtkMRMLVolumeNode | ||
* vtkMRMLScalarVolumeNode | * vtkMRMLScalarVolumeNode | ||
* vtkMRMLVectorVolumeNode | * vtkMRMLVectorVolumeNode | ||
+ | * vtkMRMLTensorVolumeNode | ||
+ | * vtkMRMLDiffusionTensorVolumeNode | ||
+ | * vtkMRMLDiffusionWeightedVolumeNode | ||
* vtkMRMLVolumeDisplayNode | * 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. | <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. | ||
Line 39: | Line 45: | ||
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. | 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 | + | 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: |
− | * VtkSetMRMLObjectMacro | + | * vtkSetReferenceStringMacro - should be used to in the MRML node for setting the refrence ID to another node. |
− | * VtkSetAndObserveMRMLObjectMacro | + | * VtkSetMRMLObjectMacro - registers a MRML node with another vtk object. |
− | * VtkSetAndObserveMRMLObjectEventsMacro | + | * 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. | An example of using this reference/observer mechanism can be found in the implementation of vtkMRMLTransformableNode class. |
Revision as of 17:49, 26 December 2006
Home < Slicer3:Data ModelContents
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
- vtkMRMLVolumeNode
- vtkMRMLScalarVolumeNode
- vtkMRMLVectorVolumeNode
- vtkMRMLTensorVolumeNode
- vtkMRMLDiffusionTensorVolumeNode
- vtkMRMLDiffusionWeightedVolumeNode
- vtkMRMLVolumeDisplayNode
- vtkMRMLVectorVolumeDisplayNode
- vtkMRMLDiffusionTensorVolumeDisplayNode
- vtkMRMLDiffusionWeightedVolumeDisplayNode
- vtkMRMLVolumeHeaderlessStorageNode
- vtkMRMLVolumeArchetypeStorageNode
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 [| 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
- vtkPolyData
- 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