[Insight-developers] Fwd: nifti direction cosines; bug?

Johnson, Hans J hans-johnson at uiowa.edu
Fri Feb 24 09:07:45 EST 2012


Stefan,

Upon limited quick first look, that seems suspicious.  I'll be honest though, it is unlikely that the core ITK development team will be able to address this issue quickly.

The main problem is that we don't know what your looks like, and it is really hard to diagnose this problems blindly.

I would suggest that you propose a patch that fixes the problem, and provide an example data sets that shows how the problem existed, and how it is fixed.  That way we can quickly evaluate and approve/improve/resolve your recommended solution.

Regards,

Hans


From: Stefan Klein <s.klein at erasmusmc.nl<mailto:s.klein at erasmusmc.nl>>
Date: Fri, 24 Feb 2012 15:01:30 +0100
To: ITK <insight-developers at itk.org<mailto:insight-developers at itk.org>>
Subject: [Insight-developers] Fwd: nifti direction cosines; bug?

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><mailto:s.klein at erasmusmc.nl>
To:     Insight Developers <insight-developers at itk.org><mailto: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<http://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

_______________________________________________ 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

________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120224/8a4d0723/attachment.htm>


More information about the Insight-developers mailing list