[Insight-users] changing image orientation

Patrik Brynolfsson patrik.brynolfsson at gmail.com
Fri Sep 25 02:32:39 EDT 2009


I have used this filter before, but I always wondered why you have to use a
filter to change properties like orientation, origin and spacing, especially
when there are methods for changing them in the image object itself. Can
someone perhaps clear this up for me?
Thanks!

2009/9/24 Luis Ibanez <luis.ibanez at kitware.com>

>
> Hi Shoosh,
>
>  This is not the correct way of modifying the orientation of an image.
>
>
> In general you should never attempt to change the content of an image
> that is the output of a filter or a reader.
>
> The correct way of changin the orientation of an image is to use the
>
>
>    itkChangeInformationFilter
>
>
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1ChangeInformationImageFilter.html
>
> Call on it
>
>   ChangeDirectionOn()
>
> and
>
>    SetOutputDirection( newdirection)
>
>
>
>   Regards,
>
>
>
>        Luis
>
>
>
>
> -----------------------
> shoosh moosh wrote:
>
>> How do I change the orientation of a 3D image.  This is the code segment I
>> have but I get the following error:
>>
>> std::cout<< "Direction is " << reader1->GetOutput()->GetDirection()
>> <<std::endl ;
>> reader1->GetOutput()->SetDirection(0, {1,0,0} );
>> reader1->GetOutput()->SetDirection(1, {0,-1,0} );
>> reader1->GetOutput()->SetDirection(2, {0,-1,0} );
>> std::cout<< "New direction is " << reader1->GetOutput()->GetDirection()
>> <<std::endl ;
>>
>>
>> [100%] Building CXX object CMakeFiles/rsf.dir/rsf.o
>> /home/shoosh/Desktop/CSF/rsf/rsf.cxx: In function ‘int main(int, char**)’:
>> /home/shoosh/Desktop/CSF/rsf/rsf.cxx:105: error: expected
>> primary-expression before ‘{’ token
>> /home/shoosh/Desktop/CSF/rsf/rsf.cxx:106: error: expected
>> primary-expression before ‘{’ token
>> /home/shoosh/Desktop/CSF/rsf/rsf.cxx:107: error: expected
>> primary-expression before ‘{’ token
>> make[2]: *** [CMakeFiles/rsf.dir/rsf. o] Error 1
>> make[1]: *** [CMakeFiles/rsf.dir/all] Error 2
>> make: *** [all] Error 2
>>
>>
>> ------------------------------------------------------------------------
>> See all the ways you can stay connected to friends and family <
>> http://www.microsoft.com/windows/windowslive/default.aspx>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> 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://www.itk.org/mailman/listinfo/insight-users
>>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>



-- 
Patrik Brynolfsson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090925/bf0c35d0/attachment-0001.htm>


More information about the Insight-users mailing list