<br>I have 3 rotation angles, that I got from a registration algorithm.<br>rx = 0.0664 ry = -0.0625 rz = -0.0078<br>Now I would like to apply to rotation.<br><br>The Euler3D transform needs a rotation matrix. How can that matrix be calculated?<br>
This is what I've come up with so far, but it doesn't do anything:<br><br><br> typedef itk::Euler3DTransform<double>TransformType2;<br> TransformType2::Pointer transform2 =TransformType2::New();<br><br>// Rotation matrix:<br>
<br>// Rx(č) x y cos theta - z sin theta z cos theta + y sin theta<br>// Ry(č) x cos theta + z sin theta y -x sin theta + z cos theta<br>// Rz(č) x cos theta - y sin theta y cos theta + x sin theta z<br>
<br> typedef itk::Matrix<double> MatrixType;<br> MatrixType rotMatrix; <br><br> // column row<br> rotMatrix[0][0] = 1;<br> rotMatrix[0][1] = cos( atof(argv[7]) ) + sin( atof(argv[7]) );<br> rotMatrix[0][2] = cos( atof(argv[9]) ) - sin( atof(argv[9]) );<br>
<br> rotMatrix[1][0] = cos( atof(argv[7]) ) - sin( atof(argv[7]) );<br> rotMatrix[1][1] = 1;<br> rotMatrix[1][2] = cos( atof(argv[7]) ) + sin( atof(argv[7]) );<br><br> rotMatrix[2][0] = cos( atof(argv[7]) ) + sin( atof(argv[7]) );<br>
rotMatrix[2][1] = -cos( atof(argv[7]) ) + sin( atof(argv[7]) );<br> rotMatrix[2][2] = 1;<br><br> transform->SetMatrix( rotMatrix);<br><br><br>I'm not to sure about the '1' entries too, since they should by x, y, or z...<br>
<br>cheers,<br><br>Michael<br>