Documentation/Labs/NonlinearTransforms

From SlicerWiki
Jump to: navigation, search
Home < Documentation < Labs < NonlinearTransforms

Motivation: current state of non-linear transforms in Slicer 4.2

Slicer 4.2 has a very limited non-linear transforms support.

  • MRML nodes exist for BSpline and Grid transforms
  • There is a number of CLI modules that input and output non-linear transforms
  • There is no support for import/export of non-linear transforms
  • There is no support in Data module for applying non-linear transforms by dragging Volumes and Models
  • There is no support in Data module for hardening of non-linear transforms for Volumes and Models
  • CLI modules input and output "resampling" transform, which transforms from parent space, where linear transforms are stored as "modeling" transforms, which transforms to parent space

New features implemented in this project

  • Support for import/export of non-linear transforms
  • Support in Data module for applying non-linear transforms by dragging Volumes and Models
  • Support in Data module for hardening of non-linear transforms for Volumes and Models
  • Support for both "to parent" and "from parent" types of transforms in MRML nodes (both linear and non-linear)
  • Support for both "to world" and "from world" types of transforms in MRML nodes (both linear and non-linear)
  • Support for caching of "to parent" and "from parent" types of transforms in MRML nodes (both linear and non-linear)
  • Maintain backward compatibility with existing CLI modules

MRML API changes

vtkMRMLTransformNode

  • new method virtual vtkGeneralTransform*GetTransformFromParent()
  • new method void GetTransformFromWorld(vtkGeneralTransform* transformToWorld)
  • new flag vtkMRMLTransformNode::ReadWriteAsTransformToParent which tells storage nodes wheather to read/write transform data as from parent or to parent. The flag is implemented in vtkMRMLTransformNode to maintain backward compatibility with CLI modules that read/write non-linear transforms as “resampling” , from parent space transforms.

vtkMRMLLinearTransformNode

  • changed signature of the method virtual void GetMatrixTransformToParent(vtkMatrix4x4*)
  • new method virtual void GetMatrixTransformFromParent(vtkMatrix4x4*);
  • new method void SetAndObserveMatrixTransformFromParent(vtkMatrix4x4 *matrix);

vtkMRMLNonlinearTransformNode

  • changed signature of the method virtual void GeWarpTransformToParent(vtkWarpTransform*)
  • new method virtual void GeWarpTransformFromParent(vtkWarpTransform*);
  • new method void SetAndObserveWarpTransformFromParent(vtkWarpTransform*matrix);

Other MRML nodes

  • implemented above APIs in vtkMRMLBSplineTransformNode and vtkMRMLGridTransformNode
  • added support for applying transforms (hardening) to Volume and Model nodes

Support for dragging under non-linear transforms in Data module

  • vtkMRMLSliceLayerLogic class has been redesigned to deal with generic transforms rather than just vtkMatrix4x4
  • vtkMRMLModelDisplayableManager class has been redesigned to deal with generic transforms rather than just vtkMatrix4x4

Code branch on github

https://github.com/ayarmarkovich/Slicer/tree/xform_branch