Documentation/4.2/Modules/Transforms

From SlicerWiki
Jump to: navigation, search
Home < Documentation < 4.2 < Modules < Transforms

For the latest Slicer documentation, visit the 4.6 page.


Introduction and 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. Information on NA-MIC can be obtained from the NA-MIC website.
Author: Alex Yarmarkovich (Isomics, SPL)
Contributors: Jean-Christophe Fillion-Robin (Kitware), Julien Finet (Kitware)
Contact: Alex Yarmarkovich,

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.


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.

  • To concatenate transforms: You can combine (affine) transforms in the Data module. Drag them onto eachother to nest. Order of nesting matters. Then right click and select "Harden Trasnform", which should move the nested one back to the top. Rename the node and save as new file.

Tutorials

Panels and their use

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

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
    • 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.


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->SetAndObserveMatrixTransformToParent( 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() );

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.