Difference between revisions of "Slicer3:Data Model"

From NAMIC Wiki
Jump to: navigation, search
m (Update from Wiki)
 
m (Update from Wiki)
Line 1: Line 1:
= Status =
+
= Slicer3 MRML Overview =
  
== Feb 13, 2006 ==
+
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.
  
Alex has been converting the mrml functionality of Slicer2.6 into a new set of classes that will eventually become libMRML. These are currently being prototyped in the vtkSlicerThree Module in the slicer2 cvs head. They will be migrated to the Slicer3 svn repository in the next couple weeks once there is enough infrastructure there to support building test executables.
+
Slicer3 data models is implemented independent of the visualization and algorithmic components of the system.
  
Considerations currently being evaluated:
+
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.
  
* library dependencies
+
MRML scene provides Undo/Redo mechanism which is based on saving and restoring the state of MRML nodes.
** object structure comes from vtk
 
** volume i/o relies on vtk, itk, and vtkITK
 
** transforms will also require a mix
 
* class hierarchy for mrml (what specializations are done with subclasses versus instance variables)
 
  
<br />
+
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
 +
* vtkMRMLVolumeHeaderlessStorageNode
 +
* vtkMRMLVolumeArchetypeStorageNode
 +
* vtkMRMLVolumeNode
 +
* vtkMRMLScalarVolumeNode
 +
* vtkMRMLVectorVolumeNode
 +
* vtkMRMLVolumeDisplayNode
 +
 
 +
<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 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 [[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 ==
  
= Goals =
+
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
  
See also [[AHM_2006:ProjectsSlicerDataModel|AHM Programming week project]].
+
== Slicer Daemon ==
  
= Slicer 2.x MRML =
+
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.
  
<br />
+
= Slicer 2.6 MRML =
  
== Data Represented in MRML in Slicer 2.x ==
+
== Data Represented in MRML in Slicer 2.6 ==
  
 
* Volumes
 
* Volumes
Line 79: Line 123:
 
** Get/Set Data (e.g. as vtkImageData)
 
** Get/Set Data (e.g. as vtkImageData)
  
<br />
+
== General References on XML ==
 
 
= Desired Additional Functions Required in Slicer 3 =
 
  
* Deep Copy
+
A wikibook on XML: http://en.wikibooks.org/wiki/XML:_Managing_Data_Exchange
* Serialize/Deserialize
 
* Fine-Grained Observers (per node)
 
* Camera Nodes (view transforms in coordinate space manager)
 
* Access Modes (''all through same API, differences in "filename"'')
 
** Mrml File Representation
 
** Client/Server
 
** Access Data Tree in Core
 
* Import/Export Subtrees
 
  
= Use Cases for Slicer 3 =
+
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
 
 
* Mrml Data Model is accessed via a C++ callable API
 
* API is wrapped for inclusion with various types of calling routines
 
** ITK ImageReader/ImageWriter wrapping uses filename to select access mode, and can interact with ITK programs originally written to work with files
 
** vtkImageReader/vtkImageWriter wraps for use in VTK
 
** slicerget/slicerput style interaction to pipe data through unu filters
 
** other wrappers possible (matlab, data explorer...)
 
** Viewer Programs Observe Data Model and Generate Visualizations
 
 
 
= Path-based MRML3 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.
 
 
 
== Notes from Alex, Steve, Xiadong, Dan, Mathieu meeting(01/12/06). ==
 
 
 
This approach rely on the assumption that any Modules would provide Transforms operations, in particular Concatenation operation.
 
 
 
As of now, only VTK (compare to ITK) provide a Concatenation of Transforms. Proposal was that we create a vtkGenericTransform (subclass of vtkObject) which would contains an itkGenericTransform.
 
 
 
Also Dan/Xiadong showed us there current approach (in another project) on how to deal with a factory of transforms. This is very close to the current ImageIO factory found in ITK. Major difference are:
 
 
 
* User specify explicitely what Transform they want, instead of the CanRead mechanism.
 
* A thin wrapper around the itkTransform had to be written to handle the problem with template
 
 
 
<br />
 
 
 
== Implementation proposal of MRML to be toolkit independant ==
 
 
 
The goal is to proposed an implementation of libMRML to be toolkit independent from VTK in particular. Notes are currently gater here [[User:Mathieu/Slicer|libMRML Notes]]
 
 
 
= libMRML and the 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.
 

Revision as of 13:41, 18 December 2006

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