SimpleITK Registration


I have been trying to implement a SimpleITK registration framework to register a reference image that has no change with a deformed image (warped image).

I split the reference image up into subregions and try to register each reference subregion to the deformed image.

So far, I have implemented a Translation only registration, but would like to extend this to use Affine Transforms.
For whatever reason though, when I switch to Affine Transformations, my results are extremely wrong and make no sense.

Would someone be able to help me with moving forward with extending to Affine Registration?
Any help is much appreciated.
Thank you so much

The attached files include one singular subregion that I am trying to register, but I would ultimately like to do this for every subregion of the reference image.

Reference Image: entire reference image
Deformed Image: entire deformed image
Fixed Image: Search Region of the deformed image
Moving Image: Subregion of the reference image

Subset00.tif corresponds to area00.tif, …, etc.
DeformedImg.tif (345.5 KB)
ReferenceImg.tif (256.2 KB)
subset00_ref.tif (3.1 KB)
subset01_ref.tif (3.0 KB)
area00.tif (43.6 KB)
area01.tif (50.2 KB)


code.cpp.txt (2.7 KB)

Initial Vals:
initGuess.txt (860 Bytes)

Hello @elapins,

You can paste code directly into the forum and keep the formatting. Use the ‘preformatted text’ option in the editor, or hit CTRL+E.

I quickly looked through your code.cpp.txt
Two things, more like guesses as I didn’t try it out as of now:

  1. Your initial transform is still a sitk::TranslationTransform. For an affine, you can use AffineTransform, or if you only want to consider translation and rotation, you might want to use 2DEulerTransform.
  2. If you are including rotation in registration, you probably need to call SetOptimizerScalesFromPhysicalShift() for your registration method.

Again, these are just my first guesses. I don’t know if it fixes the issue.


Thank you so much! I had no idea I could post code within the post.

I tried adding the two things you suggested, and again it did not seem to work.