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

Kishore Mosaliganti kishoreraom at gmail.com
Wed Mar 10 15:25:27 EST 2010


Hi Michiel,

Based on my understanding (may not be correct), the Euler3D angles are
rotations about the x,y and z axis respectively. These angles are what you
got from the registration algorithm as rx, ry, rz.

In http://en.wikipedia.org/wiki/Rotation_matrix, if you scroll down to the
section on "Rotation matrix given an axis and an angle", you will find the
formula for finding 3 matrices Rx(rx), Ry(ry), Ry(rz). Basically, you are
rotating about u = [1,0,0], [0,1,0] and [0,0,1] respectively.

The final rotation matrix is the product R = Rx . Ry. Rz which is what you
need to enter into the transform.


Kishore

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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100310/e4b9c8e5/attachment-0001.htm>


More information about the Insight-users mailing list