<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi Tobias,</p>
<p>Indeed, I had a conversation with my (remote) colleague, and he
admitted that he used only the sform in his code, and did not
maintain the qform so that they match. And obviously, ITK was
using the qform. <br>
</p>
<p>Thanks for your help,</p>
<p>Cyril<br>
</p>
<br>
<div class="moz-cite-prefix">On 22/03/2017 12:06, Wood, Tobias
wrote:<br>
</div>
<blockquote
cite="mid:BACAAEB8-288F-43C1-B90B-F5298D826829@kcl.ac.uk"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Avenir Next";
panose-1:2 11 5 3 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Avenir Next";
color:windowtext;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
span.msoIns
{mso-style-type:export-only;
mso-style-name:"";
text-decoration:underline;
color:teal;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Avenir
Next"">Hi Cyril,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next"">I use NIFTI all the time, it generally works.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next"">Which transform in the header does your
collaborator use? There are (annoyingly) two in NIFTI, the
qform and the sform. ITK generally uses the qform, because
the sform can include transformations (shears) that the ITK
Image class does not support (ITK as a whole supports them,
but in a different place). The easiest way I know to check
this is with FSL’s fslhd command, which will print out both.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next"">I know there were some changes to ITK’s NIFTI
support very recently (just before Christmas if my memory
serves). Essentially, ITK now follows the NIFTI standard
exactly. One of the things the NIFTI standard specifies is
when to use the qform and when to use the sform.
Unfortunately, most other packages (and ITK previously) were
very relaxed about this and did not follow the spec, often
doing things like setting qform=sform or having an invalid
combination of qform_code/sform_code.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next"">I have a suspicion that your sforms/qforms are
messed up. In which case, the fslorient tool is your friend.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next"">On the other hand, I might be wrong entirely.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next"">Good luck,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next"">Toby<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Avenir
Next""><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On 17/03/2017,
15:46, "Insight-users on behalf of Cyril Mory" <<a
moz-do-not-send="true"
href="mailto:insight-users-bounces@itk.org">insight-users-bounces@itk.org</a>
on behalf of
<a moz-do-not-send="true"
href="mailto:cyril.mory@creatis.insa-lyon.fr">cyril.mory@creatis.insa-lyon.fr</a>>
wrote:<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<p class="MsoNormal"
style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">Thanks
for this answer.<br>
By manipulation, I essentially mean reading a 6D .nii file,
extracting sub images, and writing them to .mhd format,
hopefully keeping the correct image information throughout the
process.
<br>
I'll see if my colleague can write to a more recent format,
and otherwise follow your advice about ReadUnknownImageType.<br>
<br>
Best,<br>
Cyril<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in">On 17/03/2017
16:34, Sarthak P wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-left:.5in">For NIfTI I/O,
I'd suggest you stick to the latest tags as they up to
date regarding the latest standards.
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">What exactly
do you mean my manipulation? There is an ITK filter to
change image information (<a moz-do-not-send="true"
href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fitk.org%2FDoxygen%2Fhtml%2Fclassitk_1_1ChangeInformationImageFilter.html&data=01%7C01%7Ctobias.wood%40kcl.ac.uk%7C3654a392b8ba4569caae08d46d4cec6c%7C8370cf1416f34c16b83c724071654356%7C0&sdata=dBIaLuW9cuJJDxu%2BX0x4rWtiBGOASxpzLDv%2Fopw1BIg%3D&reserved=0">https://itk.org/Doxygen/html/classitk_1_1ChangeInformationImageFilter.html</a>)
but that only happens AFTER itk::ImageFileReader has
done its work.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Could you
possibly try to get your collaborator to write a few
images using a latest variant of ITK (preferably version
matched with yours for consistency)? If not, then
perhaps try to read the information in the header using
the example in <a moz-do-not-send="true"
href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fitk.org%2FWiki%2FITK%2FExamples%2FIO%2FReadUnknownImageType&data=01%7C01%7Ctobias.wood%40kcl.ac.uk%7C3654a392b8ba4569caae08d46d4cec6c%7C8370cf1416f34c16b83c724071654356%7C0&sdata=ljw8WLGmx8DhaWY6D4a1EGV5Jyp5QchPUvfK0Px%2Fo6Y%3D&reserved=0">https://itk.org/Wiki/ITK/Examples/IO/ReadUnknownImageType</a>
and then do comparisons between what you expect.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">All the
best,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">S<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Fri,
Mar 17, 2017 at 11:21 AM, Cyril Mory <<a
moz-do-not-send="true"
href="mailto:cyril.mory@creatis.insa-lyon.fr"
target="_blank">cyril.mory@creatis.insa-lyon.fr</a>>
wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid
#CCCCCC 1.0pt;padding:0in 0in 0in
6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal" style="margin-left:.5in">Hi ITK
users,<br>
<br>
I have recently started working with nifti files,
to collaborate with a colleague that uses this
format. But the itk::ImageFileReader does not
correctly open the nifti files I have (image size,
offset and direction matrix are wrong). I use a
recent version of ITK (commit from Feb 6 18:02:49
2017), but my colleague has his own fork from
nifti_reg, which is several years old.<br>
<br>
Two questions:<br>
- Does someone have experience in manipulating
nifti files from ITK, and if so, is it supposed to
work fine ?<br>
- Have there been important modifications in the
nifti format in the last years, which the ITK
reader would have followed, and which could cause
the issues I'm seeing when opening old ones ?<br>
<br>
Best regards,<br>
Cyril<br>
_____________________________________<br>
Powered by <a moz-do-not-send="true"
href="https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=01%7C01%7Ctobias.wood%40kcl.ac.uk%7C3654a392b8ba4569caae08d46d4cec6c%7C8370cf1416f34c16b83c724071654356%7C0&sdata=uur9nTdox7kHhrbmnKJDqM0YgQELo8xR9FsFm8arsbg%3D&reserved=0"
target="_blank">
www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a moz-do-not-send="true"
href="https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=01%7C01%7Ctobias.wood%40kcl.ac.uk%7C3654a392b8ba4569caae08d46d4cec6c%7C8370cf1416f34c16b83c724071654356%7C0&sdata=FZrXfS6b%2F7ydigP4WrlawiYQlBIEWkwky9HpMj0XGEQ%3D&reserved=0"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more
information visit:<br>
<a moz-do-not-send="true"
href="https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php&data=01%7C01%7Ctobias.wood%40kcl.ac.uk%7C3654a392b8ba4569caae08d46d4cec6c%7C8370cf1416f34c16b83c724071654356%7C0&sdata=bbVRUclgLtPG3ePXn32qJOUFcxKCfgRa%2FI%2F7Gm1qONE%3D&reserved=0"
target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK
FAQ at:<br>
<a moz-do-not-send="true"
href="https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=01%7C01%7Ctobias.wood%40kcl.ac.uk%7C3654a392b8ba4569caae08d46d4cec6c%7C8370cf1416f34c16b83c724071654356%7C0&sdata=hYirR9%2F2JGNfAmeIbWtejSZ3oOctiCjFzY3pFpI3z3I%3D&reserved=0"
target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Finsight-users&data=01%7C01%7Ctobias.wood%40kcl.ac.uk%7C3654a392b8ba4569caae08d46d4cec6c%7C8370cf1416f34c16b83c724071654356%7C0&sdata=sCWoAvSF0JewswDVZUcmjLmhAOQ8SkRtsbm48uyBC34%3D&reserved=0"
target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal" style="margin-left:.5in"><br>
<br>
<o:p></o:p></p>
</div>
</blockquote>
<br>
</body>
</html>