[Insight-users] resample filter and image origin/spacing setting

Luis Ibanez luis.ibanez at kitware.com
Wed Dec 27 14:32:17 EST 2006



Hi Matei,

You should not attempt to  change the output of filters.
You don't own those images.

If you need to change the origin and/or spacing of an
image you must use the:


     ChangeInformationImageFilter
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ChangeInformationImageFilter.html


Note that in order to rotate an image you should use
the ResampleImageFilter.


Could you please post to the list the *exact*
source code where you are using the ResampleImageFilter ?



    Thanks



       Luis



-------------------------
Matei Stroila wrote:
> Dear all,
> 
> I am trying to rotate a 2D image about its center. I don't know what
> am I doing wrong.
> 
> I use a processing pipeline (crop and dilation) that results in an image,
> dilateFilter->GetOutput() . Then, I set the origin and spacing:
> 
> GrayITKImageType::PointType origin;
>     origin[0] = 0;
>     origin[1] = 0;
> GrayITKImageType::SpacingType spacing;
>     spacing[0] = 1;
>     spacing[1] = 1;
>     dilateFilter->GetOutput()->SetOrigin(origin);
>     dilateFilter->GetOutput()->SetSpacing(spacing);
> 
> I want to rotate this image about its center but I am not able to set
> the correct transformations, although I follow the ITK User Guide.
> Even though the print out of the origin and spacing is correct, the
> rotating result is not.
> 
> On the other hand, if I write out the image and read it back with a
> reader, then everything works fine on reader->GetOutput()
> 
> What else should I (re)set, apart from origin and spacing?
> 
> Thanks so much for help,
> 
> Matei
> _______________________________________________
> 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