<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi,</div><div><br></div><div>I am having a similar issue, which may be related.</div><div><br></div><div>I have a NIfTI file, which I load using itkNIfTIImageIO.</div><div><br></div><div>By stepping into ITK, I can see that the s-form (sto_xyz) is:</div><div><br></div><div>[1, 0, 0, -90]</div><div>[0, 1, 0, -126]</div><div>[0, 0, 1, -72]</div><div>[0, 0, 0, 1]</div><div><br></div><div>However, when it read the origin and orientation of the resulting itkImage,</div><div>I get:</div><div><br></div><div>[-1, 0, 0, 90]</div><div>[0, -1, 0, 126]</div><div>[0, 0, 1, -72]</div><div>[0, 0, 0, 1]</div><div><br></div><div>This data is in the MNI-152 space. I know that the index (0, 0, 0) should be</div><div>(-90, -126, -72) mm in LPI coordinate system (NIfTI's default I believe).</div><div><br></div><div>Since I want my data in the RAI coordinate system, I then use the itkOrientImageFilter.</div><div>Assuming it converts the image from LPI to RAI, I would expect the ouput to be:</div><div>[-1, 0, 0, 90]</div><div>[0, -1, 0, 90]</div><div>[0, 0, 1, -72]</div><div>[0, 0, 0, 1]</div><div><br></div><div>But I get:</div><div>[1, 0, 0, -90]</div><div>[0, 1, 0, -90]</div><div>[0, 0, 1, -72]</div><div>[0, 0, 0, 1]</div><div><br></div><div>By the way, my image dimensions are 181 x 217 x 181.</div><div><br></div><div>I know that index (0, 0, 0) is (90, 90, -72) mm in RAI. </div><div><br></div><div>I am right that the matrix I get from ITK is not what is expected ?</div><div><br></div><div>It looks to me that the itkNIfTIImageIO is doing some transform to</div><div>the orientation matrix.</div><div><br></div><div>What would be that transformation's purpose ?</div><div><br></div><div>Thanks a lot!</div><div><br></div><div>Mathieu</div><div><br></div><div><div>____________________ <br>Mathieu Coursolle, M.Ing.<span class="Apple-tab-span" style="white-space: pre; ">                </span><br>Rogue Research Inc. </div><div><a href="http://www.rogue-research.com/">www.rogue-research.com</a><br></div><div><br></div></div><br><div><div>On 6-Apr-09, at 10:46 AM, Antoine DUCHAMPS wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi all,<br><br>I have a DWI sequence (brain) acquired with a Siemens scanner in Dicom<br>format. After converting it to NIfTI with dcm2nii<br>(<a href="http://www.sph.sc.edu/comd/rorden/mricron/dcm2nii.html">http://www.sph.sc.edu/comd/rorden/mricron/dcm2nii.html</a>) I tried to read<br>it an recover the orientation by using ITK (I've copied the code below).<br>The matrix I obtain is the following:<br><br> 0.9997 0.0000 0.0252<br> 0.0002 -1.0000 -0.0072<br>-0.0252 -0.0072 0.9997<br><br>However, the transforation matrix in the Dicom header is<br><br> 0.9997 0.0000 0.0252<br> 0.0002 1.0000 -0.0072<br>-0.0252 0.0072 0.9997<br><br>If the Dicom image orientation is LPS, this means that the image<br>orientation in NIfTI is LAS (And not RAS as I believed). Could anybody<br>clarify this please? Are there several possible orientations in NIfTI?<br>If so, how can I know the specific image orientation?<br><br>Antoine. <br><br><br>#include "itkImageFileReader.h"<br>#include "itkOrientedImage.h"<br><br>const unsigned int Dimension = 4;<br>typedef short PixelType;<br>typedef itk::OrientedImage<PixelType, Dimension> ImageType;<br>typedef ImageType::Pointer ImagePointerType;<br>typedef itk::ImageFileReader< ImageType > ReaderType;<br><br><br>int main(int argc, char* argv[])<br>{<br><span class="Apple-tab-span" style="white-space:pre">        </span><br> ImageType::Pointer image = ImageType::New();<span class="Apple-tab-span" style="white-space:pre">        </span><br><br> ReaderType::Pointer reader = ReaderType::New();<br> reader->SetFileName(argv[1]);<br> reader->Update();<br><br> image = reader -> GetOutput();<br> std::cout << image->GetDirection() << std::endl; std::cout.flush();<br><br>}<br><br>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br><br></div></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></body></html>