Getting Displacement Data for specific points

I successfully applied the following type of registration, and would like to query specific points within the image and get the corresponding displacement for each point in the image.

I have a composite outTx and can’t figure out how to extract singular point transforms through this method. I would like to eventually get the displacement in pixels for specific points throughout the image.

Any help is very much appreciated. Thank you!!

https://simpleitk.readthedocs.io/en/master/link_ImageRegistrationMethodDisplacement1_docs.html

You might need to use the inverse of the registration transform.

1 Like

@dzenanz ,
Is there a function that will allow me to pick a certain point in the fixed image, then determine the inverse transform values for the specific point?

How about invTx = outTx.GetInverseTransform(), and then use invTx.TransformPoint()?

Does TrasnformPoint() get the transform applied to the specific point (ie. translation)? I am more interested in the number than just transforming a specific point

Yes, when you transform a point, you get the transformed coordinates.

You can get translation from the transform, via outTx.GetTranslation(), see GetTranslation() docs.

2 Likes

Or do I just then need to extract the points of interest from the list of parameters?

Wonderful, I will give this a shot. Thank you so much @dzenanz !!!

So once I get the translation, these values will be in physical units, so I need to use GetSpacing() to convert to pixels correct??

You can convert physical coordinates (e.g. points) to pixel indices via TransformPhysicalPointToContinuousIndex() or TransformPhysicalPointToIndex.

@dzenanz I tried using this code, but kept getting errors at this point. Is this because my outTx is a composite transform? Is it possible to invert Composite Transforms?

Thank you!

Yes, see:

After transforming points, you should also check whether they are inside the image before trying to use their indices.