[Insight-users] Re: Question about Euler2DTransform

Luis Ibanez luis.ibanez at kitware.com
Tue Nov 22 09:32:45 EST 2005


Hi Albert,

Thanks for sending a more explicit description
of the problem that you are facing.

I wonder if when you interpret the effect of the
transform you are taking into account the following
facts:

1) The origin of coordinates in most images
    is located in one of the corners, and not
    in the geometrical Center of the image extent

2) Most viewer display images such as PNG, TIFF,
    JPEG with the origin on the top left, using the
    convention of computer graphics, instead of the
    Mathematical convention that is followed by ITK
    where the origin is in the bottom left corner
    of an image.


The factor (1) results in "apparent" translations
when you apply a simple rotation.  What you can do
in order to better understand the effect of this
transform is to first apply transform with

     Rotation Angle       = 45 degrees
     Translation along X  =  0 millimeter
     Translation along X  =  0 millimeter


Then visually analyze the result of the resampling
on this image.

Once you have seen this rotate image, then redo the
process, but this time with parameters:

     Rotation Angle       = 45 degrees
     Translation along X  = 40 millimeter
     Translation along X  = 40 millimeter


and compare it with the previous result. You will
find that the image obtained now is simply a
translation of the image that you got by only
rotating.

SYSTEMATIC EXPERIMENTATION is the formal way of
getting to the truth !

That's why all scientific publications must
require reproducibility !


--

You *MUST* read the ITK Software Guide


   http://www.itk.org/ItkSoftwareGuide.pdf


in particular

Section 6.9 "Geometric Transformation" in PDF page 252.


(NOTE that a new edition of the Software Guide is now online).


Reading this section, in particular the section on rotations
will help you to interpret correctly the results that you
are obtaining.

Please, also make sure that you use a decent image viewer,
such as the one in


     InsightApplications/
                  ImageViewer


Avoid using viewers that are not intended for Medical Applications,
since they will ignore parameters such as origin, pixel spacing
and the proper orientation of the images.



    Regards,


       Luis




------------------------
Albert Chitemyan wrote:
> Hi Luis
>  
> Thanks for your answer
>  
> When I say "in practice the opposite thing takes place", I mean that 
> when I use Euler2DTransform, for example, with following parameters
> angle = 0.174, Tx = 40, Ty = 40
> an image is obtained, which can't be obtained if I first rotate an image 
> by angle and then translate it by Tx, Ty. It will be obtained if I first 
> translate an image by Tx, Ty, then rotate it by angle.
> It is the thing that I can't understand.
>  
> Thanks a lot
>  
> Albert
>  
> 
> 
> */Luis Ibanez <luis.ibanez at kitware.com>/* wrote:
> 
> 
>     Hi Albert,
> 
> 
>     The Euler2DTransform derives from the Rigid2DTransform,
>     The Rigid2DTransform derives from the MatrixOffsetTransformBase,
> 
>     This can easily be seen from the Doxygen documentation
>     of the Euler2DTransform:
> 
>     http://www.itk.org/Insight/Doxygen/html/classitk_1_1Euler2DTransform.html
> 
> 
> 
>     The MatrixOffsetTransform applies always the multiplication
>     by the Matrix first, and then it adds the Offset.
> 
> 
>     The Matrix encodes Scaling, Rotation and Shearing.
>     The Offset encodes Translations.
> 
> 
>     Therefore...
> 
> 
>     Rotations are always applied first
>     Translations are applied after rotations.
> 
> 
>     ----
> 
>     When you say
> 
> 
>     "in practice the opposite thing takes place"..
> 
>     What do you mean ?
> 
> 
> 
>     Do you mean that you think that the actual ITK
>     code is doing something different ?
> 
>     Do you mean that the transform should be applied
>     in a different way.
> 
> 
>     ---
> 
> 
>     Please be more explicit with your question.
> 
> 
> 
> 
>     Thanks
> 
> 
> 
>     Luis
> 
> 
> 
>     -----------------------
>     Albert Chitemyan wrote:
>      > Hi,
>      >
>      > In ItkSoftwareGuide is written that in Euler2DTransform the
>     rotation is
>      > applied first, followed by the translation. But in practice the
>      > opposite thig takes place. How can you explain it?
>      >
>      > Albert
>      >
> 
> 
> ------------------------------------------------------------------------
> Yahoo! FareChase - Search multiple travel sites in one click. 
> <http://us.lrd.yahoo.com/_ylc=X3oDMTFqODRtdXQ4BF9TAzMyOTc1MDIEX3MDOTY2ODgxNjkEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw--/SIG=110oav78o/**http%3a//farechase.yahoo.com/> 
> 



More information about the Insight-users mailing list