<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On 29 July 2014 17:22, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello Butlers,<div><br></div><div>Just because the images look the same doesn't mean the filter didn't have an effect! Does ITK-SNAP have a way to look at the orientation of the direction cosine matrix? This should be different between the two images.</div>
</div></blockquote><div><br></div><div>The matrices stay the same: For example</div><div>[-0.5 0 0 0</div><div> 0 -0.5 0 0</div><div> 0 0 0.5 1] is the same for LSP and RAI orientations.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>My understanding of that orientation filter was that it changed the direction cosines AND the order of the pixels such that they still have the same physical location. Since you are using a viewer which is aware of this information I would not expect the image to visually change.</div>
</div></blockquote><div><br></div><div>I've also checked their positions with Slicer and it yields the same interpretation. However, if what you say is true, then any visualizer should yield the same output provided that the same physical location is preserved. I still don't understand why one would not display the image with the orientation that corresponds to its specifications.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>I don't know how that orientation field in the MHA file is used... others have already chimed in on that.</div>
<div><br></div><div>Brad</div><div><br><div><div><div class="h5"><div>On Jul 29, 2014, at 10:13 AM, Butlers Home <<a href="mailto:butlershomecoffee@gmail.com" target="_blank">butlershomecoffee@gmail.com</a>> wrote:</div>
<br></div></div><blockquote type="cite"><div><div class="h5"><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>
_______________________________________________<br>Community mailing list<br><a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br><a href="http://public.kitware.com/mailman/listinfo/community" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
</blockquote></div><br></div></div></blockquote></div><br><br clear="all"><div>Best,</div>-- <br><div dir="ltr"><div>Butlers</div></div>
</div></div>