<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi all,<br>
Could anybody of NiftiImageIO-developers confirm that the behaviour
described below is indeed a bug, and was not intentional?<br>
Kind regards,<br>
Stefan<br>
<br>
-------- Original Message --------
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject: </th>
<td>[Insight-developers] nifti direction cosines; bug?</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
<td>Fri, 10 Feb 2012 19:44:54 +0100</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
<td>Stefan Klein <a class="moz-txt-link-rfc2396E" href="mailto:s.klein@erasmusmc.nl"><s.klein@erasmusmc.nl></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
<td>Insight Developers <a class="moz-txt-link-rfc2396E" href="mailto:insight-developers@itk.org"><insight-developers@itk.org></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>Hi developers,
In case of an Analyze75 file, loaded by NiftiImageIO, the Direction
Cosines are not stored in the m_Direction variable. Consequently, all
Analyze files get an identity direction matrix.
The error occurs in the SetImageIOOrientationFromNifTI function. The
code first reads the orientation correctly and stores it in a local
variable called 'dir', but this variable is never stored in the member
variable m_Direction.
Here is the relevant code (ITK v4.1rc01):
void
NiftiImageIO::SetImageIOOrientationFromNIfTI(unsigned short int dims)
{
typedef SpatialOrientationAdapter OrientAdapterType;
//
// in the case of an Analyze75 file, use old analyze orient method.
if ( this->m_NiftiImage->qform_code == 0
&& this->m_NiftiImage->sform_code == 0 )
{
SpatialOrientationAdapter::DirectionType dir;
SpatialOrientationAdapter::OrientationType orient;
switch ( this->m_NiftiImage->analyze75_orient )
{
case a75_transverse_unflipped:
orient = SpatialOrientation::ITK_COORDINATE_ORIENTATION_RPI;
break;
case a75_sagittal_unflipped:
orient = SpatialOrientation::ITK_COORDINATE_ORIENTATION_PIR;
break;
// according to analyze documents, you don't see flipped
// orientation in the wild
case a75_transverse_flipped:
case a75_coronal_flipped:
case a75_sagittal_flipped:
case a75_orient_unknown:
case a75_coronal_unflipped:
orient = SpatialOrientation::ITK_COORDINATE_ORIENTATION_RIP;
break;
}
dir = OrientAdapterType().ToDirectionCosines(orient);
m_Origin[0] = 0;
if ( dims > 1 )
{
m_Origin[1] = 0;
}
if ( dims > 2 )
{
m_Origin[2] = 0;
}
return;
}
... // implementation for non-Analyze files.
}
I'm aware that Analyze75 is deprecated, and that I could use the
Deprecated/itkAnalyzeImageIO.h class, but this looks to me like a bug.
Kind regards,
Stefan
--
Stefan Klein
+31 10 7043049
<a class="moz-txt-link-freetext" href="http://www.bigr.nl/people/StefanKlein">http://www.bigr.nl/people/StefanKlein</a>
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Kitware offers ITK Training Courses, for more information visit:
<a class="moz-txt-link-freetext" href="http://kitware.com/products/protraining.html">http://kitware.com/products/protraining.html</a>
Please keep messages on-topic and check the ITK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.itk.org/mailman/listinfo/insight-developers">http://www.itk.org/mailman/listinfo/insight-developers</a>
</pre>
</body>
</html>