<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=015573512-24082007><FONT face=Arial
color=#0000ff size=2>Hi Nic,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=015573512-24082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=015573512-24082007><FONT face=Arial
color=#0000ff size=2>Here is some example code, it uses the vnl package included
with Inisght. RMat contians the 3x3 rotation matrix, while RR contains the
initialized Quaternion.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=015573512-24082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=015573512-24082007><FONT face=Arial
color=#0000ff size=2> //
Rotate!<BR> double RotX, RotY,
RotZ;<BR> RotX = InitialRotation[0] * vnl_math::pi
/ 180.0;<BR> RotY = InitialRotation[1] *
vnl_math::pi / 180.0;<BR> RotZ =
InitialRotation[2] * vnl_math::pi / 180.0;<BR>
vnl_quaternion<double> Rx(vcl_sin(RotX/2.0), 0, 0,
vcl_cos(RotX/2.0));<BR>
vnl_quaternion<double> Ry(0, vcl_sin(RotY/2.0), 0,
vcl_cos(RotY/2.0));<BR>
vnl_quaternion<double> Rz(0, 0, vcl_sin(RotZ/2.0),
vcl_cos(RotZ/2.0));</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=015573512-24082007><FONT face=Arial
color=#0000ff size=2> vnl_quaternion<double>
RR = Rx * Ry * Rz;<BR>
vnl_matrix_fixed<double,3,3> RMat =
RR.rotation_matrix_transpose();<BR></FONT></SPAN></DIV><SPAN
class=015573512-24082007></SPAN><FONT face=Arial><FONT color=#0000ff><FONT
size=2>-dan<SPAN class=015573512-24082007></SPAN></FONT></FONT></FONT><BR>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
insight-users-bounces+blezek=crd.ge.com@itk.org
[mailto:insight-users-bounces+blezek=crd.ge.com@itk.org] <B>On Behalf Of
</B>Nic<BR><B>Sent:</B> Friday, August 24, 2007 7:12 AM<BR><B>To:</B> Insight
Users<BR><B>Subject:</B> [Insight-users] Quaternions and Euler
rotations<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2> doing a 3D registration of two
stacks as in example 8.6.1 and using itkVersorRigid3DTransform, I would like
to calculate the 3 axis components and the angle of the Versor resulting
from:</FONT></DIV>
<DIV><FONT face=Arial size=2> - a rotation of a certain
angle around z-axis</FONT></DIV>
<DIV><FONT face=Arial size=2> - a 180°rotation around
y-axis</FONT></DIV>
<DIV><FONT face=Arial size=2> - no rotation around
x-axis</FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>This is because I would like to initialize my
transform before launching.</FONT></DIV>
<DIV>Does anyone have an idea how to calculate it ? </FONT><FONT face=Arial
size=2>Seems that I have to calculate Quaternions; trying to do it
actually but I not really used with..</FONT></DIV>
<DIV><FONT face=Arial size=2>Thx, nic</FONT></DIV></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BLOCKQUOTE></BODY></HTML>