Registration in one Rotation parameters of the transform not doing well

Dear All,

I am using the following example for my own purposes (but with Similarity3DTransform) :

When I do the registration of two analogous images, the angles of the transform (Similarity3DTransform) gives as had not registred. Where I can change the script to do that rotation parameter right? Seems that the script is such that the registration is not done in one angle.

Another question, when I use the metric Mutual Information the scaling parameter comes 0.98XXX and with the metric MSE the scaling parameter comes 1.02XXX. The Mutual Information one seems Ok. How you explain that?


Luis Gonçalves

Dear All,

The right scale of the image is 0.99XX. Because it is made, in the registration, first the scale a next rotation and translation compensation did not gave good results.

I am getting good results doing a registration on Rotation+Translation and next a registration on Scale+Rotation+Translation. In the second registration the Rotation and Translation is almost not compensated as it was already compensated in the first registration.

Are there some way to do a single registration and define to compensate first the Rotation and Translation and next the Scale instead of Scale First?


Luis Gonçalves

You could use composite transform. Do rigid first, then similarity. Example.

I am working with SimpleITK (Python). I need an example in Python.


Luis Gonçalves

The following code:

composite_transform = sitk.Transform(3,sitk.sitkComposite)


interact(display_images, fixed_image_z=(0,fixed_image.GetSize()[2]-1), moving_image_z= (0,moving_image2.GetSize()[2]-1), fixed_npa = fixed(sitk.GetArrayViewFromImage(fixed_image)),

initial_transform = sitk.CenteredTransformInitializer(fixed_image,moving_image2, composite_transform, sitk.CenteredTransformInitializerFilter.GEOMETRY)

is giving the following error:

Exception thrown in SimpleITK CenteredTransformInitializer: D:\a\1\sitk\Code\BasicFilters\src\sitkCenteredTransformInitializerFilter.cxx:147:

sitk::ERROR: Error converting input transform to required transform type with center.

Error in the last line.

Can someone please give a solution?


Luis Gonçalves

@blowekamp or @zivy might have some suggestions.

Hello @Luis_Carlos_Carneiro,

The error you are getting is due to the fact that a composite transform can contain all transformation types and hence may not have a transform type with center which is required by the initializer (e.g. BSplineTransform).

As @dzenanz nicely suggested, one option of performing a multi-stage registration where you increase the degrees of freedom at each stage is to use a composite transform. Please note that with the upcoming release of SimpleITK 2.0 the generic Transform will no longer represent a CompositeTransform, we now have an explicit class called CompositeTransform. You can install the latest pre-release build and see the transformation notebook for usage examples.

Now in your case, you can simplify this and do not need to use the CompositeTransform:

  1. initial_transform = sitk.CenteredTransformInitializer(fixed_image,moving_image2, sitk.Euler3DTransform(), sitk.CenteredTransformInitializerFilter.GEOMETRY).
  2. Run the registration using the initial_transform (SetInitialTransform possibly with inPlace=True).
  3. Create a Similarity3DTransform from the Euler3DTransform obtained in the previous step (see the transformations notebook section titled “Rigid to Similarity [3D]”).
  4. Run the registration using the similarity transform you created as the initial transform, compute in place.
1 Like

Problem solved.

Describing the cause of the problem and the solution should be helpful for posterity.

1 Like

I was doing the rotation Z->Y->X instead of X->Y->Z. But there space for better results. All cases improved a lot but not yet perfect.