<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta name="generator" content="Windows Mail 17.5.9600.20498">
<style data-externalstyle="true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, 
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, 
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style>
</head>
<body dir="ltr">
<div data-externalstyle="false" dir="ltr" style="font-family: 'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif';font-size:12pt;">
<div>We experienced the same issue in Slicer (see <a href="http://www.na-mic.org/Bug/view.php?id=2173" target="_parent">
http://www.na-mic.org/Bug/view.php?id=2173</a>). ITK ignores anatomical orientation in MetaIO images, while ITK properly uses anatomical orientation information in some other file formats (e.g., NRRD).</div>
<div><br>
</div>
<div>Andras<br>
</div>
<div data-signatureblock="true"><br>
</div>
<div style="padding-top: 5px; border-top-color: rgb(229, 229, 229); border-top-width: 1px; border-top-style: solid;">
<div><font face=" 'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif'" style="line-height: 15pt; letter-spacing: 0.02em; font-family: "Calibri", "Segoe UI", "Meiryo", "Microsoft YaHei UI", "Microsoft JhengHei UI", "Malgun Gothic", "sans-serif"; font-size: 12pt;"><b>From:</b> <a href="mailto:butlershomecoffee@gmail.com" target="_parent">Butlers
 Home</a><br>
<b>Sent:</b> ýTuesdayý, ýJulyý ý29ý, ý2014 ý10ý:ý13ý ýAM<br>
<b>To:</b> <a href="mailto:community@itk.org" target="_parent">community@itk.org</a></font></div>
</div>
<div><br>
</div>
<div dir="">
<div dir="ltr">
<div style="font-family: arial,sans-serif; font-size: 13px;">I would like to know how I can change the orientation of two 3D images.</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">Scenario:</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">- both images are .mha</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">- one image has RAI as the initial orientation</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">- 2nd image has LPS as the initial orientation</div>
<div style="font-family: arial,sans-serif; font-size: 13px;"><br>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">I would like to set the same orientation RAI for both images before processing them (i.e., registering them in my case). With the below mentioned code I manage to change the orientation specified
 textually in the .mha files but visually they do not change. Why is that? Is the orientation changing just within the header specifications without actually changing the visualization part? For visualization I used ITK-SNAP.</div>
<div style="font-family: arial,sans-serif; font-size: 13px;"><br>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">Here is a code snippet from what I do:</div>
<div style="font-family: arial,sans-serif; font-size: 13px;"><br>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">[...]</div>
<div style="font-family: arial,sans-serif; font-size: 13px;"><br>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">
<div>typedef itk::ImageFileReader< ImageType2 > ImageReaderType1;</div>
<div>typedef itk::ImageFileReader< ImageType1 > ImageReaderType2;</div>
<div><br>
</div>
<div>ImageReaderType1::Pointer imReader1 = ImageReaderType1::New();</div>
<div>ImageReaderType2::Pointer imReader2 = ImageReaderType2::New();</div>
<div><br>
</div>
<div>imReader1->SetFileName("im1.mha");<br>
</div>
<div>imReader2->SetFileName("im2.mha");</div>
<div><br>
</div>
<div>imReader1->Update();</div>
<div><br>
</div>
<div>// set both images to same orientation<br>
</div>
<div><br>
</div>
<div>// orientation filter for 1st image</div>
<div>itk::OrientImageFilter<ImageType1, ImageType1>::Pointer orienter1 = itk::OrientImageFilter<ImageType1, ImageType1>::New();<br>
</div>
<div>orienter1->UseImageDirectionOn();<br>
</div>
<div>orienter1->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RAI);</div>
<div>orienter1->SetInput(imReader1->GetOutput());</div>
<div>orienter1->Update();</div>
<div><br>
</div>
<div>// orientation filter for 2nd image</div>
<div>itk::OrientImageFilter<ImageType2, ImageType2>::Pointer orienter2 = itk::OrientImageFilter<ImageType2, ImageType2>::New();<br>
</div>
<div>orienter2->UseImageDirectionOn();</div>
<div>orienter2->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RAI);</div>
<div>orienter2->SetInput(imReader2->GetOutput());</div>
<div>orienter2->Update();</div>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;"><br>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">[...]</div>
<div style="font-family: arial,sans-serif; font-size: 13px;"><br>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">I tried not using the cosine-based approach, i.e., use the itk::AnalyzeImageIO class together with itk::ExposeMetaData<>() but for some unknown reason, the orientation is not determined appropriately.
 I would also prefer not using them at all because, as far as I understood, they are deprecated.</div>
<div style="font-family: arial,sans-serif; font-size: 13px;"><br>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">Thank you.</div>
<div style="font-family: arial,sans-serif; font-size: 13px;"><br>
</div>
<div style="font-family: arial,sans-serif; font-size: 13px;">Best regards,</div>
<div dir="ltr">--
<div>Butlers</div>
</div>
</div>
</div>
</div>
</body>
</html>