users > Can streamxform invert a deformation field?
Showing 1-2 of 2 posts
Dec 12, 2018 01:12 PM | 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.
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.
Best,
Greg.
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;
}
{
// 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.
Best,
Greg.
Dec 15, 2018 05:12 AM | Torsten Rohlfing
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.
Best,
Torsten
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.
Best,
Torsten