Using the invert displacement field function

Dear all,

I have been using the invert button in the Transforms module to invert displacement fields which I can regrettably only derive as a forward transform. Now I am trying to replicate this inversion using ITK or SimpleITK functions, such as InverseDisplacementField, InvertDisplacementField, FixedPointInverseDisplacementField and IterativeInverseDisplacementField. However, I am never able to replicate the results I get through Slicer. If someone could explain which algorithm Slicer uses I would be most grateful.

Thanks in advance,

RK

Slicer uses VTK’s transform classes, which are far more versatile than ITK (SimpleITK):

  • you can concatenate arbitrary chain of forward/inverse transforms and VTK can apply it to objects dynamically
  • VTK transforms provide transformation on the entire 3D space (while in ITK transforms, displacement drops to 0 outside the specified domain)
  • VTK ensures displacement is smoothly converging 0 or constant outside the specified domain, which allows robust inverse computation.

If you need an inverse transform that ITK can use, you can convert the transform to a displacement field (in Transforms module / Convert section).

Thank you for your quick and comprehensive answer. I had been looking into the VTK classes but had some trouble loading the .nrrd files which my code outputs. I will look into this again and report back with the results.

R

Slicer can load a vector field into a transform node (and inside it as a VTK grid transform) from .nrrd file: in the “Add data…” dialog, choose to load it as a “Transform” (in “Description” column).