[ITK] [ITK-users] Rotate image

Nicolas Gallego nicgallego at gmail.com
Thu Jul 3 12:52:04 EDT 2014


Hi Elena,

If I understand well your task, you have the rotation angle and translation
parameters and you would like to transform your image parallel to the
cartesian coordinate system and crop/resample it?

Conceptually then you could proceed as follows:

1. Create a rigid transformation with given angle and translation in 2D
[1]  or 3D [2]

2. Apply the transformation to your image via an interpolator and a
resampler, like illustrated in the Software Guide Section 8.2 [3]

3. The resampler interface lets you specifiy all the image information for
the output:
region( start, size)
spacing
origin
direction

Connect everything and update and that should do the job,

Pay attention to the center of rotation, the example you cite uses the
center of the image as center of rotation, that should be fine.

I would proceed like that, I am not aware of a filter to do this
automatically.

If you don't know a priori the rigid transformation parameters to apply,
then a registration algorithm can be used to estimate them.

[1] http://www.itk.org/Doxygen45/html/classitk_1_1Rigid2DTransform.html
[2] http://www.itk.org/Doxygen45/html/classitk_1_1Rigid3DTransform.html
[3] http://www.itk.org/ItkSoftwareGuide.pdf

hope that helps

Nicolás Gallego-Ortiz
Université catholique de Louvain, Belgium


2014-07-03 16:16 GMT+02:00 elena bresciani <elena.bresciani87 at gmail.com>:

> Hello guys,
>
> I need help on image rotation. I have two questions:
>
> 1 - how can I modify the code in ResampleImageFilter4.cxx to make the size
> of the output image following the rotation? More specifically: if image
> size is Size X >> Size Y and I want a 90° rotation the result (using the
> code in the example without modifications) is cropped because the new image
> has now Size Y >> Size X but in the example this is not taken into account.
> I know I could use Permute Axis but I would like to write something that
> works both for 90 and 180 degrees rotations.
>
> 2 - I would like to do something like in the scheme attached. Actually, as
> shown I've reached my goal only partially using AutoCropLabelMapFilter.
> There is a simple way of doing what I want or I have to compute the angle
> of inclination of my region of interest and rotate and crop accordingly?
> Images are not binary!
>
> Thanks in advance!
>
> Elena
>
> _____________________________________
> 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
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140703/89a25695/attachment-0002.html>
-------------- next part --------------
_____________________________________
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


More information about the Community mailing list