[Insight-users] changing image orientation

Luis Ibanez luis.ibanez at kitware.com
Thu Sep 24 12:41:11 EDT 2009


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


More information about the Insight-users mailing list