[Insight-users] Re: registration
Moti Freiman
freiman at cs.huji.ac.il
Tue Jan 22 12:23:12 EST 2008
Hi,
Below is some code I wrote to translate a versor rigid 3d transform to
angles (rotation about x,y,z, in radians) and translations.
You can find an explantion about these equations in:
http://isiswiki.georgetown.edu/zivy/writtenMaterial/frames.pdf
Note that this transform assume that the rotations and translations is about
the origin of the image.
Moti
//**************************** code
********************************************************************************
const TransformType::ParametersType& finalParameters =
_transform->GetParameters ();
TransformType::MatrixType rot_matrix = _transform->GetRotationMatrix ();
_finalParams[1] = atan2 (-rot_matrix[2][0], sqrt
(rot_matrix[0][0]*rot_matrix[0][0] + rot_matrix[1][0]*rot_matrix[1][0]));
//Ry
_finalParams[2] = atan2 (rot_matrix[2][0]/cos (_finalParams[1]),
rot_matrix[0][0]/cos (_finalParams[1]));//Rz
_finalParams[0] = atan2 (rot_matrix[2][1]/cos (_finalParams[1]),
rot_matrix[2][2]/cos (_finalParams[1]));//Rz
_finalParams [3] = finalParameters[3]; //Tx
_finalParams [4] = finalParameters[4]; //Ty
_finalParams [5] = finalParameters[5]; //Tz
//**************************** end of code
********************************************************************************
--
__
Moti Freiman, Ph.D Student.
Medical Image Processing and Computer-Assisted Surgery Laboratory.
School of Computer Science and Engineering.
The Hebrew University of Jerusalem Givat Ram, Jerusalem 91904, Israel
Phone: +(972)-2-658-5371 (laboratory)
WWW site: http://www.cs.huji.ac.il/~freiman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20080122/12ec2a80/attachment.htm
More information about the Insight-users
mailing list