[Insight-users] Convert Rigid3DTransform To VersorRigid3DTransform

Bill Lorensen bill.lorensen at gmail.com
Wed Dec 17 00:02:46 EST 2008


Hans,

Here's a wikipedia entry:
http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles

Bill

On Tue, Dec 16, 2008 at 10:20 PM, Hans Johnson <hans-johnson at uiowa.edu> wrote:
> 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.
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list