[Insight-developers] Fwd: nifti direction cosines; bug?
Stefan Klein
s.klein at erasmusmc.nl
Fri Feb 24 09:01:30 EST 2012
Hi all,
Could anybody of NiftiImageIO-developers confirm that the behaviour
described below is indeed a bug, and was not intentional?
Kind regards,
Stefan
-------- Original Message --------
Subject: [Insight-developers] nifti direction cosines; bug?
Date: Fri, 10 Feb 2012 19:44:54 +0100
From: Stefan Klein <s.klein at erasmusmc.nl>
To: Insight Developers <insight-developers at itk.org>
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
http://www.bigr.nl/people/StefanKlein
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.html
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120224/183c6795/attachment.htm>
More information about the Insight-developers
mailing list