[Insight-users] Euler3D transform, how to set the rotation matrix?

Luis Ibanez luis.ibanez at kitware.com
Thu Mar 18 12:18:35 EDT 2010


Hi Michiel,


1)  Why not to simply call the itk::Euler3DTransfom methods:

             SetAngleX()
             SetAngleY()
             SetAngleZ()

                                                  ??


2) If you want to see how the rotation matrix is computed from
    the rotation angles above, please look at the method

                          ComputeMatrix()

   in lines 202-243 of

                Insight/Code/Common/itkEuler3DTransform.txx



3) Please, note that one of the problems with Euler angles
    is that different implementations apply them in different
    order, ... and ... the order really matters.

     How did you get the initial three angles ?
     are they the result of a registration that you did with ITK ?


   Please let us know,


       Thanks


              Luis


---------------------------------------------------------------------------------
2010/3/9 michiel mentink <michael.mentink at st-hughs.ox.ac.uk>:
>
> I have 3 rotation angles, that I got from a registration algorithm.
> rx = 0.0664    ry = -0.0625    rz = -0.0078
> Now I would like to apply to rotation.
>
> The Euler3D transform needs a rotation matrix. How can that matrix be
> calculated?
> This is what I've come up with so far, but it doesn't do anything:
>
>
>   typedef itk::Euler3DTransform<double>TransformType2;
>   TransformType2::Pointer transform2 =TransformType2::New();
>
> // Rotation matrix:
>
> //  Rx(θ)                x                y cos theta - z sin theta      z
> cos theta + y sin theta
> //  Ry(θ)     x cos theta + z sin theta                y                -x
> sin theta + z cos theta
> //  Rz(θ)     x cos theta - y sin theta    y cos theta + x sin theta
>         z
>
>   typedef itk::Matrix<double> MatrixType;
>   MatrixType rotMatrix;
>
>   //   column  row
>   rotMatrix[0][0] = 1;
>   rotMatrix[0][1] =  cos( atof(argv[7]) ) + sin( atof(argv[7]) );
>   rotMatrix[0][2] =  cos( atof(argv[9]) ) - sin( atof(argv[9]) );
>
>   rotMatrix[1][0] =  cos( atof(argv[7]) ) - sin( atof(argv[7]) );
>   rotMatrix[1][1] = 1;
>   rotMatrix[1][2] =  cos( atof(argv[7]) ) + sin( atof(argv[7]) );
>
>   rotMatrix[2][0] =  cos( atof(argv[7]) ) + sin( atof(argv[7]) );
>   rotMatrix[2][1] = -cos( atof(argv[7]) ) + sin( atof(argv[7]) );
>   rotMatrix[2][2] = 1;
>
>   transform->SetMatrix( rotMatrix);
>
>
> I'm not to sure about the '1' entries too, since they should by x, y, or
> z...
>
> cheers,
>
> Michael
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list