users > Can streamxform invert a deformation field?
Showing 1-2 of 2 posts
Results per page:
Dec 12, 2018  05:12 AM | Greg Jefferis
Can streamxform invert a deformation field?
Dear Torsten,

Can streamxform invert a deformation field? I have the impression that it cannot. In fact, here is the confirmation from cmtkDeformationField.h.

virtual bool ApplyInverse ( const Self::SpaceVectorType&, Self::SpaceVectorType&, const Types::Coordinate = 0.01 ) const
// not implemented
return false;

Following on, is an implementation of ApplyInverse for deformation fields actually feasible/sensible?

On a related note. Would it be worth throwing a slightly more dramatic error than just failing to transform the point given the current code situation? Requesting a deformation field inverse will never work right now.


Dec 14, 2018  09:12 PM | Torsten Rohlfing - Google LLC
RE: Can streamxform invert a deformation field?
Hi Greg -

Indeed, a deformation field cannot be inverted. One could potentially try to implement a numerical approximation, analogous to the one used by SplineWarpXform, but because the deformation field is potentially discountinuous, it's very unlikely a dense estimation of the inverse would ever succeed.

We could certainly change the code to terminate (or throw an exception) instead of simply returning a failure flag. While the current implementation should not generate incorrect results (the reformatting code respects the return value), it certainly may lead to cases where users see empty reformatted images and have a hard time sorting out why that happened.

Do you want me to change the code accordingly? (You're welcome to do it yourself, obviously, if you're comfortable with that.)

By the way, just for the record - if I had a deformation field and wanted to invert it, I would use the fit_spline_dfield tool to fit a B-spline warp to the deformation field, then numerically invert that.