I have a similar problem as the OP here but I’m attempting to use the
TransformPoint() function from SimpleITK with a
DisplacementFieldTransform instead of an affine transform.
I have a moving image with a set of vertices that define a mask. After applying SimpleITK’s SymmetricForcesDemonsRegistration I have a transform to go from one image to another and I want to use the transform to find the new locations of mask vertices in the fixed image.
Moving Image (Image with set mask vertices)
Fixed Image (Image to find new location of mask vertices in)
Moving image after applying SymmetricForcesDemonsRegistration
Is there a way to use
TransformPoint() to find the new vertices based on
It looks like the transformed vertices are the inverse of the original transformation but I am unsure how to rectify that.
Original mask vertices and centroids
Incorrect mask vertices and centroids after applying
- I have tried OP’s original suggestion of computing the inverse transform with
GetInverse()which throws an error saying that the inverse could not be created.
- I have also tried
sitk.DisplacementFieldTransformto generate the inverse with no luck either.
- I also generated an image with the vertices highlighted and then warped that image using the SimpleITK resampler to execute the transform. This successfully produced the right vertices however, it introduced other issues when I attempted to extract the vertices from the image. Using
TransformPoint()would be the simplest and easiest if I can get it to work.
Any suggestions would be greatly appreciated.