Order o Rotation Euler3D

Dear All,

If I do a Registration of Euler3D. The result transform has a Rotation and a Translation.
Which is the first operation in Rotation. Is in X? Or is in Z?

Thanks,

Luís Gonçalves

Hello @Luis_Carlos_Carneiro,

The order of rotations in the Euler3DTransform depends on user selection, it is either ZYX or ZXY. To see which one, call the GetComputeZYX of the Euler3DTransform.

1 Like

I use SimpleITK

sitk.GetComputeZYX(sitk.Euler3DTransform)

gives

AttributeError: module ‘SimpleITK’ has no attribute ‘GetComputeZYX’


How to use this function in SimpleITK?

import SimpleITK as sitk
tx = sitk.Euler3DTransform()
tx.GetComputeZYX()

False. Suppose that is ZYX?

Thanks.

If GetComputeZYX() returns false, then the order is ZXY.

And the data provided by the transform? The data provided for rotation, what the order?
RotationX RotationY RotationZ XShift Yshift ZShift ?

From the docs:

The serialization of the optimizable parameters is an array of 6 elements. The first 3 represents three euler angle of rotation respectively about the X, Y and Z axis. The last 3 parameters defines the translation in each dimension.

The serialization of the fixed parameters is an array of 3 elements defining the center of rotation.

I am doing the rotations of the transform the following way. Can you please tell if some angles are computed reversed? What I mean if some rotations are reversed.

Z Axe

    sincosf(dados2[1],&sin1,&cos1);
    new_x = x1f*cos1 + y1f*sin1;
    new_y = -x1f*sin1 + y1f*cos1;
    new_z = z1f;

    x1f=new_x;
    y1f=new_y;
    z1f=new_z;

X Axe

    sincosf(dados2[3],&sin1,&cos1);
    new_z = -y1f*sin1 + z1f*cos1;    
    new_y = y1f*cos1 + z1f*sin1;
    new_x= x1f;

Y Axe

    sincosf(dados2[2],&sin1,&cos1);
    z1f=new_z*cos1 + new_x*sin1;
    y1f=new_y;
    x1f=-new_z*sin1+ new_x*cos1;

What is dados2? You indexing of that array does not seem consistent. Shouldn’t X correspond to 0, Y to 1, and Z to 2? Also your order of variables (zyx) make the formula seem weird.

Yes, I changed the order. 1 is Z , 2 is Y and 3 is X.

The order is ZXY. Is the order of the transform.

Remember:

“If GetComputeZYX() returns false, then the order is ZXY.”

Why are you doing it manually? Euler3DTransform provides GetMatrix(), and TransformPoint() methods. The point of a library is to provide this sort of stuff, so you don’t have to do it yourself.

I am doing all by my self. Only relying in ITK registration. Even the generated images have different size from ITK. Playing with the centers of rotations.

I do the registration with smaller images and apply the transform to the bigger images.

I need help on this. Thanks.

If you don’t wan to use ITK, why not “steal” the code from ITK?

I want to improve the features of ITK. Not steal. I will always use ITK registration. I have ethics.

The word steal was under quotation marks. I meant, why not re-use the relevant part of code from ITK, if you don’t want to use ITK transforms module for whatever you are doing. ITK is open source, licensed under Apache 2.0, so using its code in other projects is allowed. Even if those projects are commercial in nature.

I have no time to explore ITK code. Perhaps consultation, not more.