Thanks Fucang.<br><br>-Kurt<br><br><div><span class="gmail_quote">On 3/1/07, <b class="gmail_sendername">jiafucang</b> <<a href="mailto:jiafucang@anketech.com">jiafucang@anketech.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div><font color="#000000" face="Verdana" size="2">Hi, Kurt,</font></div>
<div><font color="#000000" face="Verdana" size="2"></font> </div>
<div><font face="Verdana" size="2"><font color="#000000">This is a bug </font><a href="http://www.itk.org/Bug/bug.php?op=show&bugid=3311&pos=17" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
<font color="#000000">http://www.itk.org/Bug/bug.php?op=show&bugid=3311&pos=17</font></a></font></div>
<div><font color="#000000" face="Verdana" size="2"></font> </div>
<div><font color="#000000" face="Verdana" size="2">Hope that helps!</font></div>
<div><font color="#000000" face="Verdana" size="2"></font> </div>
<div><font color="#000000" face="Verdana" size="2">Fucang</font></div>
<div><font face="Verdana" size="2">
<hr>
</font></div>
<div><font face="Verdana"><font size="2"><strong>发件人:</strong> kurt
Zhao</font></font></div>
<div><font face="Verdana"><font size="2"><strong>发送时间:</strong>
2007-03-01 09:02:17</font></font></div>
<div><font face="Verdana"><font size="2"><strong>收件人:</strong>
<a href="mailto:insight-users@itk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">insight-users@itk.org</a></font></font></div>
<div><font face="Verdana"><font size="2"><strong>抄送:</strong> </font></font></div>
<div><font face="Verdana"><font size="2"><strong>主题:</strong> [Insight-users]
AnatomicalOrientation and OrientImageFilter</font></font></div><div><span class="e" id="q_1110c0916b78a1cd_1">
<div><font face="Verdana" size="2"></font> </div>
<div><font face="Verdana" size="2">Hi guys,<br><br>I am trying to convert the
AnatomicalOrientation of a 3D MRI from RPI to RSA using OrientImageFilter.
<br><br><br>However, the entry "AnatomicalOrientation" in the header of the
output *mha file is always RPI. itkSNAP was not able to interpret the anatomical
orientation as RSA either. <br><br>so my question is:<br><br>1. is it a bug in
OrientImageFilter?<br><br>2. How to verify the AnatomicalOrientation of a *.nii
or *.mha file? should I look at the header of meta data? or load them into
Slicer3 or SNAP? <br><br>The data can be accessed at <a href="http://www.duke.edu/%7Ekurtzhao/RPI.zip" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.duke.edu/~kurtzhao/RPI.zip</a><br>The
code is enclosed:<br><br>Thanks a lot!<br>-Kurt<br><br><br>#include
<iostream><br><br><br>#include <metaCommand.h><br>#include
<itkImageFileWriter.h><br>#include
<itkImageFileReader.h><br>#include <itkAnalyzeImageIO.h><br>#include
<itkNiftiImageIO.h><br>#include <itkOrientImageFilter.h
><br>#include <itkSpatialOrientation.h><br><br><br><br>int main(int
argc, char **argv)<br> {<br><br> /** <br> * Typedefs and
test reading to determine correct image types.<br> *
*******************************************************************
<br> */<br><br> /** Initial image type. */<br> const
unsigned int Dimension = 3;<br> //typedef
float PixelType;<br> typedef short PixelType;<br><br> /** Some
typedef's. */<br> typedef itk::Image< PixelType, Dimension
> ImageType; <br> typedef
itk::ImageFileReader< ImageType >
ReaderType;<br> typedef
itk::ImageIOBase
ImageIOBaseType;<br><br> ReaderType::Pointer reader =
ReaderType::New();<br><br> itk::AnalyzeImageIO::Pointer io =
itk::AnalyzeImageIO::New(); <br><br> //reader -> SetImageIO ( io )
;<br> /** Setup the Reader. */<br> std::string inputFileName;
<br> //inputFileName = "C:/data/formatConversion/c1002a3T1.hdr";<br>
inputFileName = "C:/data/formatConversion/RPI.mha"; <br><br>
reader->SetFileName( inputFileName.c_str() );<br><br> /** Generate all
information. <br> reader->GenerateOutputInformation();<br><br>
ImageIOBaseType::Pointer testImageIOBase = testReader->GetImageIO();
<br><br> unsigned int inputDimension =
testImageIOBase->GetNumberOfDimensions();<br> unsigned int
numberOfComponents = testImageIOBase->GetNumberOfComponents();<br>
std::string inputPixelComponentType =
testImageIOBase->GetComponentTypeAsString( <br>
testImageIOBase->GetComponentType() );<br>
std::cout<<inputPixelComponentType<<std::endl;<br> std::string
pixelType = testImageIOBase->GetPixelTypeAsString(<br>
testImageIOBase->GetPixelType() ); <br>
std::cout<<pixelType<<std::endl;<br><br> std::string
outputPixelComponentType = inputPixelComponentType;<br> */<br><br>
try <br> {<br> reader -> Update ( )
;<br> }<br> catch( itk::ExceptionObject
& err ) <br> {<br>
std::cerr << "ExceptionObject caught !" <<
std::endl;<br> std::cerr << err <<
std::endl;<br> return EXIT_FAILURE;<br>
}<br><br> typedef itk::OrientImageFilter<ImageType,ImageType>
OrienterType; <br> OrienterType::Pointer orienter =
OrienterType::New();<br> orienter->UseImageDirectionOn();<br>
//orienter->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LPS);
<br>
orienter->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RSA);
<br>
//orienter->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RPI);
<br> orienter->SetInput( reader -> GetOutput ( ) );<br> try
<br> {<br>
orienter->Update();<br> }<br> catch(
itk::ExceptionObject & err )<br>
{<br> std::cerr << "ExceptionObject caught
!" << std::endl;<br> std::cerr << err
<< std::endl;<br> return EXIT_FAILURE;
<br> }<br><br> typedef itk::ImageFileWriter <
ImageType > WriterType;<br><br>
WriterType::Pointer writer = WriterType::New();<br><br>
itk::NiftiImageIO::Pointer niftIio = itk::NiftiImageIO::New();<br><br>
//writer -> SetImageIO ( niftIio ) ;<br><br> std::string
outputFileName; <br><br> outputFileName =
"C:/data/formatConversion/RSA.mha";<br> //outputFileName =
"C:/data/formatConversion/LPS.mha"; <br> //outputFileName =
"C:/data/formatConversion/RPI.mha";<br><br> writer ->SetFileName(
outputFileName.c_str() );<br><br> //writer -> SetInput ( reader ->
GetOutput ( ) ) ;<br> writer -> SetInput ( orienter -> GetOutput ( )
) ; <br><br> writer -> UseCompressionOn ( ) ;<br><br> try
<br> {<br> writer -> Update ( )
;<br> }<br> catch( itk::ExceptionObject
& err )<br> {<br>
std::cerr << "ExceptionObject caught !" << std::endl;
<br> std::cerr << err <<
std::endl;<br> return EXIT_FAILURE;<br>
}<br><br> return EXIT_SUCCESS;<br> }<br></font></div></span></div></div>
</blockquote></div><br>