[Insight-users] Composing VersorRigid3DTransform

Luis Ibanez luis.ibanez at kitware.com
Mon Nov 15 13:40:36 EST 2004


Hi Patrick,

Thanks for pointing this out and adding your nice code example.

This is indeed a Bug.
What happens is that the VersorRigid3DTransform derives from the
Rigid3DTransform class.

There is a Compose() method defined in the Rigid3DTransform that will
take care of composing the Matrix+Translation representation of the
transform. This method, however, is not overloaded in the derived class,
the VersorRigid3DTransform.

Therefore when you invoke Compose() the internal Matrix and the
Translation get modified but the actual representation of the
Versor stays the same.


   This has been entered as Bug # 1353
       http://www.itk.org/Bug/bug.php?op=show&bugid=1353&pos=0

We will add a Compose() method to the VersorRigid3DTransform.



You may want to add your email to the "Add CC"  field in the bug record
so you will get updated regarding the status of this bug.



    Regards,


       Luis



------------------------------------
Koning, P.J.H. de (LKEB) wrote:

> Hello,
> 
> While is was working on an image registration problem, I noticed 
> something strange when I was composing several VersorRigid3DTransform 
> together. The following example shows this nicely. I create 3 transforms 
> (trans1, trans2, trans3) and set their contents to some value. You can 
> see in the output that the content of the rotation matrix and the versor 
> are in sync. After composing these 3 transforms into a fresh new 
> transform, you can see that the contents of the rotation matrix and the 
> versor are not in sync anymore.
> 
> I don't know if you would call this a bug, but I found it surprising.
> 
> Could you tell me if this is the intended functionality, or a bug.
> 
> Thanks,
> 
> Patrick de Koning
> 
> /// Example code
> typedef itk::VersorRigid3DTransform<double>    TransformType;
> typename TransformType::Pointer trans1, trans2, trans3, transTot;
> typename TransformType::VersorType versor;
> typename TransformType::OutputVectorType translation;
> trans1 = TransformType::New();
> trans2 = TransformType::New();
> trans3 = TransformType::New();
> transTot = TransformType::New();
> 
> versor.SetRotationAroundX(0.785);
> trans1->SetRotation(versor);
> 
> translation[0] = 10;
> translation[1] = 20;
> translation[2] = 30;
> trans2->SetTranslation(translation);
> 
> versor.SetRotationAroundZ(0.785);
> trans3->SetRotation(versor);
> 
> transTot->SetIdentity();
> transTot->Compose(trans1, true);
> transTot->Compose(trans2, true);
> transTot->Compose(trans3, true);
> 
> std::cerr << "Transform 1: " << std::endl << trans1 << std::endl;
> std::cerr << "Transform 2: " << std::endl << trans2 << std::endl;
> std::cerr << "Transform 3: " << std::endl << trans3 << std::endl;
> std::cerr << "TotalTransform: " << std::endl << transTot << std::endl;
> 
> /////////////////////////////////////////////////////////////
> // Output
> 
> Transform 1:
> VersorRigid3DTransform (032B8940)
>   RTTI typeinfo:   class itk::VersorRigid3DTransform<double>
>   Reference Count: 2
>   Modified Time: 23
>   Debug: Off
>   Observers:
>     none
>   Offset: 0  0  0
>   RotationMatrix: 1 0 0
> 0 0.707388 -0.706825
> 0 0.706825 0.707388
> 
>   Versor:      [ 0.382499, 0, 0, 0.923956 ]
>   Center:      0  0  0
>   Translation: 0  0  0
> 
> 
> Transform 2:
> VersorRigid3DTransform (126D8298)
>   RTTI typeinfo:   class itk::VersorRigid3DTransform<double>
>   Reference Count: 2
>   Modified Time: 27
>   Debug: Off
>   Observers:
>     none
>   Offset: 10  20  30
>   RotationMatrix: 1 0 0
> 0 1 0
> 0 0 1
> 
>   Versor:      [ 0, 0, 0, 1 ]
>   Center:      0  0  0
>   Translation: 10  20  30
> 
> 
> Transform 3:
> VersorRigid3DTransform (126CBF40)
>   RTTI typeinfo:   class itk::VersorRigid3DTransform<double>
>   Reference Count: 2
>   Modified Time: 25
>   Debug: Off
>   Observers:
>     none
>   Offset: 0  0  0
>   RotationMatrix: 0.707388 -0.706825 0
> 0.706825 0.707388 0
> 0 0 1
> 
>   Versor:      [ 0, 0, 0.382499, 0.923956 ]
>   Center:      0  0  0
>   Translation: 0  0  0
> 
> 
> TotalTransform:
> VersorRigid3DTransform (126D7810)
>   RTTI typeinfo:   class itk::VersorRigid3DTransform<double>
>   Reference Count: 2
>   Modified Time: 26
>   Debug: Off
>   Observers:
>     none
>   Offset: 10  -7.05699  35.3582
>   RotationMatrix: 0.707388 -0.706825 0
> 0.5 0.500398 -0.706825
> 0.499602 0.5 0.707388
> 
>   Versor:      [ 0, 0, 0, 1 ]
>   Center:      0  0  0
>   Translation: 0  0  0
> _______________________________________________
> 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