Search code examples
simpleitk

BSplineTransform.GetInverse() throws sitk::ERROR: Unable to create inverse


I calculated a B-spline transform in Python using the method described in the docs, and trying to invert it using bspline.GetInverse(). This causes the following error:

Traceback (most recent call last):

...

  File "/home/ml/PycharmProjects/venv36_general/lib/python3.6/site-packages/SimpleITK/SimpleITK.py", line 5236, in GetInverse
    return _SimpleITK.Transform_GetInverse(self)
RuntimeError: Exception thrown in SimpleITK Transform_GetInverse: /tmp/SimpleITK/Code/Common/src/sitkTransform.cxx:622:
sitk::ERROR: Unable to create inverse!

Anything that can be done to get the inverse?


Solution

  • Here's a thread on the ITK discourse about the inverse of a BSpline transform:

    https://discourse.itk.org/t/inverse-of-bspline-transform/496/2

    It is not implemented in ITK, but they describe a way to achieve an inverse via a deformation field.