Documentation/4.4/Modules/Transforms

From Slicer Wiki
Jump to: navigation, search
Home < Documentation < 4.4 < Modules < Transforms

For the latest Slicer documentation, visit the 4.10 page.


Introduction and Acknowledgements

Author(s)/Contributor(s): Alex Yarmarkovich (Isomics, SPL), Jean-Christophe Fillion-Robin (Kitware), Julien Finet (Kitware), Andras Lasso (PerkLab, Queen's), Franklin King (PerkLab, Queen's)
Acknowledgements: This work is part of the National Alliance for Medical Image Computing (NA-MIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
Contact: Alex Yarmarkovich, <email>alexy@bwh.harvard.edu</email>
Isomics, Inc.  
Kitware, Inc.  
National Alliance for Medical Image Computing (NA-MIC)  
Neuroimage Analysis Center (NAC)  


Module Description

This module is used for creating and editing transformation matrices.
Transformation nodes are used in Slicer to define spacial relationships between different nodes (such as volumes, models, fiducials, ROI's, or other Transform nodes) or between the nodes and the global RAS space.
You can establish these relations by moving nodes from the Transformable list to the Transformed list or by dragging the nodes under the Transformation nodes in the Data module.


Features:

  • Short video demonstrating the main features: http://screencast.com/t/Z6dQVjK3m
  • Support non-linear transforms in the Transforms module: allow Apply, Harden, Invert transform
  • Transform information displayed in the Transforms module (type of transform, basic properties)
  • Transform visualization:
    • Built into the Transforms module
    • Three main modes: Glyphs (show an array of arrows, cones, spheres), Grid (show a deformed grid), or Contour (show isolines/isosurfaces for specified displacement magnitude values)
    • All transform types are supported (chains of transforms as well)
    • Visualization in the slice viewers
    • Visualization in the 3D viewers, in the specified region (region can be a slice viewer, a volume, or a ROI widget)
    • Real-time update: if the transform (or any visualization parameter) is changed then the visualization is updated immediately (interactive visualization while editing the transform)
    • Built-in colormap editor
  • MetaImage (mha), NIFTI (nii) vector volumes can be loaded as displacement field (grid) transform

Use Cases

Most frequently Transform module is used for these scenarios:

  • Manual Registration: You can insert a transformation node into your scene, and in the Data module drag a volume or a model under it,

making them children of the transformation node. After that any changes to the transformation matrix of this node will be applied to the display of children volumes and models.

  • Visualize the displacement that transforms specify: Transforms can be visualized in both 2D and 3D views, as glyphs representing the displacement vectors as arrows, cones, or spheres; regular grids that are deformed by the transform; or contours that represent lines or surfaces where the displacement magnitude has a specific value.
  • Apply transforms: You can dynamically transform a node by selecting them in the Transformable list and clicking the right arrow button. Whenever the transform changes, the transformed nodes are updated accordingly. The Harden Transform (its button is below the left arrow button) can be used for applying the transform to nodes permanently. Transforms themselves can be transformed, therefore chain of transforms can be constructed. Non-linear transforms can be concatenated too, but to to the lack of standard file format for storing concatenated inverted transforms, such composite non-linear transforms cannot be saved to file.

Tutorials

Panels and their use

Transform editing and application:

Transforms module panel
LinearTransform applied to Meningioma2
Rotations: IS 45º
Translations: LR -41mm, IS 36mm

Transform display options:

Glyph visualization (arrow, 2D): the arrow shows the displacement vector at the arrow starting point, projected to the slice
Glyph visualization (cone, 2D): the cone shows the displacement vector at the cone centerpoint, projected to the slice
Glyph visualization (sphere, 2D): the circle diameter shows the displacement vector magnitude at the circle centerpoint
Glyph visualization (arrow, 3D, slice region): the arrow shows the displacement vector at the arrow starting point
Glyph visualization (cone, 3D, annotation ROI region): the cone shows the displacement vector at the cone centerpoint
Glyph visualization (sphere, 3D, volume region, with glyph magnitude filtering): the sphere diameter shows the displacement vector magnitude at the circle centerpoint
Grid visualization (2D): shows a regular grid, deformed by the displacement vector projected to the slice
Grid visualization (3D, slice region): shows a regular grid, deformed by the displacement vector
Grid visualization (3D, annotation ROI region): shows a regular grid, deformed by the displacement vector
Contour visualization (2D): iso-lines corresponding to selected displacement magnitude values
Grid visualization (3D, volume region): iso-surfaces corresponding to selected displacement magnitude values

Parameters:

  • Transforms:
    • Active Transform: Select the transform node to display, control and edit.
  • Display - Edit>:
    • Transform Matrix: 4x4 matrix. Each element is editable on double click. Type Enter to validate change, Escape to cancel or Tab to edit the next element.
    • Translation: Apply LR, PA, and IS translational components of the transformation matrix in the RAS space (in mm). Min and Max control the lower and upper bounds of the sliders.
    • Rotation: Apply LR, PA, and IS rotation angles (degrees) in the RAS space. Rotations are concatenated.
    • Coordinate Reference: Switches between global RAS space transformation and a local one, relative to the current position and orientation.
    • Identity: Resets transformation matrix to identity matrix.
    • Invert: Inverts the transformation matrix.
  • Transformed nodes: Control what nodes uses the current transformation.
    • Transformable: List the nodes in the scene that DON'T use the transform node.
    • Transformed: List the nodes in the scene that use the transform node.
    • Right arrow: Apply the current transform node to the selected nodes in Transformable list.
    • Left arrow: Remove the current transform node from the selected nodes in the Transformed list.


List of parameters generated transforming this XML file using this XSL file. To update the URL of the XML file, edit this page.


Similar Modules

References

N/A

Information for Developers

Key MRML nodes

How to programmatically apply a transform to a transformable node:

vtkNew<vtkMRMLLinearTransformNode> transformNode;
scene->AddNode(transformNode.GetPointer());
...
vtkNew<vtkMatrix4x4> matrix;
...
transform->SetMatrixTransformToParent( matrix.GetPointer() );
...
vtkMRMLVolumeNode* transformableNode = ...; // or vtkMRMLModelNode*...
transformableNode->SetAndObserveTransformNodeID( transformNode->GetID() );

Because a transform node is also a transformable node, it is possible to concatenate transforms with each others:

vtkMRMLLinearTransformNode* transformNode = ...;
vtkMRMLLinearTransformNode* transformNode2 = ...;
transformNode2->SetAndObserveTransformNodeID( transformNode->GetID() );
...
transformable->SetAndObserveTransformNodeID( transformNode2->GetID() );

How to export the transform to as a displacement field (in a vector field volume)?

transformNode=slicer.util.getNode('LinearTransform_3')
referenceVolumeNode=slicer.util.getNode('MRHead')
slicer.modules.transforms.logic().CreateDisplacementVolumeFromTransform(transformNode, referenceVolumeNode, False)

How to visualize the displacement magnitude as a color volume?

transformNode=slicer.util.getNode('LinearTransform_3')
referenceVolumeNode=slicer.util.getNode('MRHead')
slicer.modules.transforms.logic().CreateDisplacementVolumeFromTransform(transformNode, referenceVolumeNode, True)

Events

When a transform node is observed by a transformable node, vtkMRMLTransformableNode::TransformModifiedEvent is fired on the transformable node at observation time. Anytime a transform is modified, vtkCommand::ModifiedEvent is fired on the transform node and vtkMRMLTransformableNode::TransformModifiedEvent is fired on the transformable node.