Hi Luis,<br><br>1) I might try those methods, thank you.<br>2) and I will also check out that suggestion.<br><br>3) I got the angles using IRTK, which is a custom software program. I think these angles are in degrees,<br> whereas ITK uses Radians?<br>
I've checked the angles and they dfinately are correct.<br><br>cheers, Michael<br><br><div class="gmail_quote">2010/3/18 Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Michiel,<br>
<br>
<br>
1) Why not to simply call the itk::Euler3DTransfom methods:<br>
<br>
SetAngleX()<br>
SetAngleY()<br>
SetAngleZ()<br>
<br>
??<br>
<br>
<br>
2) If you want to see how the rotation matrix is computed from<br>
the rotation angles above, please look at the method<br>
<br>
ComputeMatrix()<br>
<br>
in lines 202-243 of<br>
<br>
Insight/Code/Common/itkEuler3DTransform.txx<br>
<br>
<br>
<br>
3) Please, note that one of the problems with Euler angles<br>
is that different implementations apply them in different<br>
order, ... and ... the order really matters.<br>
<br>
How did you get the initial three angles ?<br>
are they the result of a registration that you did with ITK ?<br>
<br>
<br>
Please let us know,<br>
<br>
<br>
Thanks<br>
<br>
<br>
Luis<br>
<br>
<br>
---------------------------------------------------------------------------------<br>
2010/3/9 michiel mentink <<a href="mailto:michael.mentink@st-hughs.ox.ac.uk">michael.mentink@st-hughs.ox.ac.uk</a>>:<br>
<div><div></div><div class="h5">><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<br>
> 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<br>
> cos theta + y sin theta<br>
> // Ry(è) x cos theta + z sin theta y -x<br>
> sin theta + z cos theta<br>
> // Rz(è) x cos theta - y sin theta y cos theta + x sin theta<br>
> 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<br>
> z...<br>
><br>
> cheers,<br>
><br>
> Michael<br>
><br>
</div></div><div><div></div><div class="h5">> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
</div></div></blockquote></div><br>