[Insight-users] VersorRigid3dTransform
Karthik Krishnan
Karthik.Krishnan at kitware.com
Mon Jun 27 16:35:34 EDT 2005
Hi Martin,
Yes the transforms are indeed different.
transform->GetParameters() does not tell you the whole story though. It
prints out the translation components and the versor, but not the
center. You can try transform->Print(std::cout ) to see the center. In
fact, if you place the following line
std::cout << transform->TransformPoint( point ) << std::endl;
before and after you set the center, you will see that the transformed
point is indeed different.
It does bring up one minor point concerning transforms like the
VersorRigidTransform and other transforms that contain the center (they
derive from the MatrixOffSetTransformBase). If you were to copy the
transform parameters over into another transform, you will also need to
explicitly copy the center otherwise your new transform will be
incorrect. ie....
TransformType::Pointer finalTransform = TransformType::New();
copiedTransform->SetCenter( originalTransform->GetCenter() );
copiedTransform->SetParameters( originalTransform->GetParameters() );
Maybe this info should be put in the Doxygen ...... ? ?
Thanks
Regards
Karthik
Martin Urschler wrote:
> hi all,
>
> Can anyone explain to me why the following code does what it does?
>
> typedef itk::VersorRigid3DTransform< double > TransformType;
> TransformType::Pointer transform = TransformType::New();
> TransformType::OutputVectorType translation;
> translation[0] = 16.0;
> translation[1] = -12.0;
> translation[2] = 11.5;
> transform->SetTranslation( translation );
>
> typedef TransformType::VersorType VersorType;
> typedef VersorType::VectorType VectorType;
>
> VersorType rotation;
> VectorType axis;
>
> axis[0] = 0.0;
> axis[1] = 0.0;
> axis[2] = 1.0;
>
> const double angle = 3.14 / 4.0;
> rotation.Set( axis, angle );
> transform->SetRotation( rotation );
>
> std::cout << transform << std::endl;
> std::cout << transform->GetParameters() << std::endl;
>
> TransformType::InputPointType center;
> center[0] = 64 * fixedImage->GetSpacing()[0];
> center[1] = 64 * fixedImage->GetSpacing()[1];
> center[2] = 64 * fixedImage->GetSpacing()[2];
>
> transform->SetCenter( center );
>
> std::cout << transform << std::endl;
> std::cout << transform->GetParameters() << std::endl;
>
>
> In both cases I get the same values for the transform->GetParameters
> call. Despite the fact that two different rotation centers are used.
> I'm not sure but I think a different rotation center should have an
> effect on the transform parameters, or did I misunderstand something?
> It should provide us with a different point to start in the
> optimization of the registration.
>
> I read the chapters of the software guide that deal with these
> things... I guess I lack some understanding...
>
> thanks,
> Martin
>
>
> _______________________________________________
> 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