Get the transformation or displacement vector field with SITK

Hello everyone,

I did the registration and want to calculate TRE (target registration error) with SITK. I have the fixed image and the deformed moving image, and the landmarks.

To compute TRE, I need to get the transformation or the displacement vector field. How can I get them in SITK?

Thanks for your help,

Hello @VHK,

Please take a look at the SimpleITK tutorial advanced registration notebook, section titled Quantitative evaluation. The 65_Registration_FFD and 66_Registration_Demons notebooks from the general notebook repository may also be of interest.

Dear @zivy,

Many thanks for your answer. In Quantitative evaluation we can see how TRE is calculated. I actually know about this. As can be seen, we have to have a ‘final transformation’ to calculate TRE and I do not have this.

The point is that I use my own image registration framework, not the ones that are in SITK. So, I only have the deformed image. My question is how I can get the final transformation from the deformed image in SITK.

Hello @VHK ,

Generally speaking, the answer is you cannot do this easily (not specific to SimpleITK, just an ill posed problem given your input).

If I understand correctly the input is:

  1. fixed_image
  2. moving_image
  3. deformed_image - moving_image resampled onto the fixed image grid using an unknown final_transformation which you want to estimate.
  4. corresponding point pairs localized in fixed_image and moving_image coordinate systems.

I would recommend that you localize the target points one more time, this time on the deformed_image. Then you have point pairs that are both in the fixed_image coordinate system, those localized in the fixed_image and those localized in the deformed_image. The distance between them is the TRE, no need to know the final_transformation.

The only way to explicitly obtain the final_transformation is to redo the registration. You can either register the fixed_image to the moving_image or the deformed_image to the moving_image and then you have the final_transform. This is more problematic because it introduces errors that are associated with this second registration.


Thanks a lot! :slight_smile: