[Insight-users] Convert Rigid3DTransform To VersorRigid3DTransform
Hans Johnson
hans-johnson at uiowa.edu
Tue Dec 16 22:20:52 EST 2008
Hello All,
I have a program that generates rho, phi, theta rotation euler angles, and I
can easily generate the rotation matrix for creating the Rigid3DTransform.
I now need to convert Rigid3DTransform to VersorRigid3DTransform so that I
can initialize a mutual information registration with it.
Could anyone provide some advice on how to perform this conversion?
Thanks,
Hans
PS: The following code does not work.
===========================
typedef itk::Rigid3DTransform<double> RigidTransformType;
typedef itk::VersorRigid3DTransform<double> VersorTransformType;
VersorTransformType::Pointer
ConvertToVersorRigid3D(RigidTransformType::Pointer RT)
{
VersorTransformType::Pointer VT=VersorTransformType::New();
VT->SetFixedParameters(RT->GetFixedParameters());
itk::Matrix<double,3,3> R=RT->GetRotationMatrix();
RigidTransformType::TranslationType T=RT->GetTranslation();
VersorTransformType::ParametersType p;
p.SetSize(6);
itk::Versor<double> v;
v.Set(R);
//Get the first 3 elements of the versor;
p[0]=v.GetRight()[0];
p[1]=v.GetRight()[1];
p[2]=v.GetRight()[2];
p[3]=T[0];
p[4]=T[1];
p[5]=T[2];
VT->SetParameters(p);
return VT;
}
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081216/9fa1f8be/attachment.htm>
More information about the Insight-users
mailing list