[ITK-users] Euler3DTransform not taking user defined Center of Rotation?

Dženan Zukić dzenanz at gmail.com
Wed Apr 19 14:36:50 EDT 2017


Hi Matias,

translation (called offset in some of the classes) and center of rotation
are different things, and taken care of differently.

Regards,
Dženan Zukić, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.)

On Wed, Apr 19, 2017 at 1:30 PM, Francois Budin <francois.budin at kitware.com>
wrote:

> Hello Matias,
>
> I created a small executable based on the code you sent me:
>
> #include <itkEuler3DTransform.h>
>
> int main(int argc, char* argv[])
> {
>   typedef itk::Euler3DTransform< double > TransformType;
> //Transform
>   TransformType::Pointer transform = TransformType::New();
> double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y,
> centro_rotacion_Z, origenX,origenY;
> gamma = atof(argv[2]);
> beta = atof(argv[3]);
> alfa = atof(argv[4]);
> centro_rotacion_X = atof(argv[5]);
> centro_rotacion_Y = atof(argv[6]);
> centro_rotacion_Z = atof(argv[7]);
> double centro[3] = { centro_rotacion_X, centro_rotacion_Y,
> centro_rotacion_Z };
> transform->SetCenter(centro);
> transform->SetRotation(gamma, beta, alfa);
> std::cout<<transform->GetCenter()<<std::endl;
> std::cout<<transform->GetMatrix()<<std::endl;
> std::cout<<transform<<std::endl;
>   return 0;
> }
>
> And the results are correct:
> ./Euler 10 20 30 40 50 60 70
> [50, 60, 70]
> 0.56923 -0.304067 0.763885
> 0.716525 -0.272165 -0.642275
> 0.403198 0.912945 0.0629472
>
> Euler3DTransform (0x1126e80)
>   RTTI typeinfo:   itk::Euler3DTransform<double>
>   Reference Count: 2
>   Modified Time: 3
>   Debug: Off
>   Object Name:
>   Observers:
>     none
>   Matrix:
>     0.56923 -0.304067 0.763885
>     0.716525 -0.272165 -0.642275
>     0.403198 0.912945 0.0629472
>   Offset: [-13.6894, 85.4629, -9.34292]
>   Center: [50, 60, 70]
>   Translation: [0, 0, 0]
>   Inverse:
>     0.56923 0.716525 0.403198
>     -0.304067 -0.272165 0.912945
>     0.763885 -0.642275 0.0629472
>   Singular: 0
>   Euler's angles: AngleX=20 AngleY=30 AngleZ=40
>   m_ComputeZYX = 0
>
>
> On Wed, Apr 19, 2017 at 11:56 AM, Matias <matimontg at gmail.com> wrote:
>
>> Thanks Francois,
>>
>> There's something strange in the matrix and Offset, this is what I get:
>>
>> Center:
>>
>> [-246.422, -149.871, 20]
>>
>> Matrix:
>> 1 0 0
>> 0 1 0
>> 0 0 1
>>
>> Offset:
>> [0, 0, 0]
>>
>> El mar., 18 de abr. de 2017 a la(s) 14:47, Francois Budin-3 [via ITK -
>> Users] <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=38131&i=0>> escribió:
>>
>>> Hello Matias,
>>>
>>> I used the Euler3DTransform in a python terminal to see if I had
>>> problems setting the center and the angle, and everything seems to work as
>>> expected:
>>>
>>> trans=itk.Euler3DTransform.D.New()
>>> trans.SetCenter([0,0,0])
>>> trans.SetRotation(10,0,0)
>>> trans.TransformPoint([0,0,0])
>>> Out[46]: itkPointD3 ([0, 0, 0])  <-expected as the transform center is
>>> [0,0,0]
>>>
>>> trans.SetCenter([10,0,0])
>>> trans.TransformPoint([0,0,0])
>>> Out[48]: itkPointD3 ([5.16482, -7.96596, 3.62828]) <-rotation not around
>>> [0,0,0] but around [10,0,0]
>>>
>>> To try to understand you problem, I would advise you to print the
>>> content of your transform to see if it is set as you expect. In my case, I
>>> get:
>>>
>>> Euler3DTransform (0x18da8a0)
>>>   RTTI typeinfo:   itk::Euler3DTransform<double>
>>>   Reference Count: 1
>>>   Modified Time: 377
>>>   Debug: Off
>>>   Object Name:
>>>   Observers:
>>>     none
>>>   Matrix:
>>>     0.483518 -0.362828 0.796596
>>>     0.796596 0.559609 -0.228631
>>>     -0.362828 0.745113 0.559609
>>>   Offset: [5.16482, -7.96596, 3.62828]
>>>   Center: [10, 0, 0]
>>>   Translation: [0, 0, 0]
>>>   Inverse:
>>>     0.483518 0.796596 -0.362828
>>>     -0.362828 0.559609 0.745113
>>>     0.796596 -0.228631 0.559609
>>>   Singular: 0
>>>   Euler's angles: AngleX=40 AngleY=10 AngleZ=10
>>>   m_ComputeZYX = 0
>>>
>>> Hope this helps,
>>> Francois
>>>
>>>
>>>
>>> On Mon, Apr 17, 2017 at 7:11 PM, Matias <[hidden email]
>>> <http:///user/SendEmail.jtp?type=node&node=38127&i=0>> wrote:
>>> Hi, I'm trying to rotate a volume and use an user defined center but no
>>> matter what value I set, it seems the rotation is always performed using
>>> the same center (not sure which, maybe a default center)? Here's the code
>>> I'm using.. am I missing something? typedef itk::Euler3DTransform< double >
>>> TransformType; //Transform TransformType::Pointer transform =
>>> TransformType::New(); double alfa, beta, gamma, centro_rotacion_X,
>>> centro_rotacion_Y, centro_rotacion_Z, origenX,origenY; gamma =
>>> atof(argv[2]); beta = atof(argv[3]); alfa = atof(argv[4]);
>>> centro_rotacion_X = atof(argv[5]); centro_rotacion_Y = atof(argv[6]);
>>> centro_rotacion_Z = atof(argv[7]); double centro[3] = { centro_rotacion_X,
>>> centro_rotacion_Y, centro_rotacion_Z }; transform->SetCenter(centro);
>>> transform->SetRotation(gamma, beta, alfa);
>>> ------------------------------
>>> View this message in context: Euler3DTransform not taking user defined
>>> Center of Rotation?
>>> <http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking-user-defined-Center-of-Rotation-tp38126.html>
>>> Sent from the ITK - Users mailing list archive
>>> <http://itk-users.7.n7.nabble.com/> at Nabble.com.
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/insight-users
>>>
>>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/insight-users
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking
>> -user-defined-Center-of-Rotation-tp38126p38127.html
>> To unsubscribe from Euler3DTransform not taking user defined Center of
>> Rotation?, click here.
>> NAML
>> <http://itk-users.7.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>> --
>> Matias
>>
>> ------------------------------
>> View this message in context: Re: [ITK-users] Euler3DTransform not
>> taking user defined Center of Rotation?
>> <http://itk-users.7.n7.nabble.com/Euler3DTransform-not-taking-user-defined-Center-of-Rotation-tp38126p38131.html>
>>
>> Sent from the ITK - Users mailing list archive
>> <http://itk-users.7.n7.nabble.com/> at Nabble.com.
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/insight-users
>>
>>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20170419/dfa8f863/attachment.html>


More information about the Insight-users mailing list