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