For the latest Slicer documentation, visit the 4.10 page.
Introduction and Acknowledgements
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.
- 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
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.
- Please use tutorial about loading and viewing data.
Panels and their use
Transform editing and application:
Transform display options:
- 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.
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)
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.