[Insight-users] metaimage reader ignores direction cosines in 2D

Rupert Brooks rupe.brooks at gmail.com
Thu Jun 28 11:45:16 EDT 2007


Hi,

The metaimage reader does not read in direction cosines for 2D images.
 Upon investigating, i found that this seems to be deliberate - there
is a specific comment in the code about reading them in 3D.  Is this a
bug/oversight or is there a reason why directions are not appropriate
in 2D (or 4D, for that matter)?

I'd like to use direction cosines in 2D, and I dont know of any
particular reason not to.  The issue seems easy enough to correct.
Has anyone seen/know of reasons for this problem, or further problems
that will result down the line if its changed?

For the record, im using ITK 3.2.  All the CVS log messages on that
file since then seem to be style related.

Rupert B.

code in question follows:

Line 457-8 , itkmetaimageio.cxx
  if(m_NumberOfDimensions == 3)
    {

<ANATOMICAL ORIENTATION STUFF HERE>

Lines 893-906, itkmetaimageio.cxx
    // Read direction cosines if the dimension of the image is 3.
    //
    const double *transformMatrix = m_MetaImage.TransformMatrix();
    vnl_vector< double > directionAxis( this->GetNumberOfDimensions() );
    for( unsigned int i=0; i < this->GetNumberOfDimensions(); i++)
      {
      for( unsigned int j=0; j < this->GetNumberOfDimensions(); j++)
        {
        directionAxis[j] = transformMatrix[i*this->GetNumberOfDimensions() + j];
        }
      this->SetDirection( i, directionAxis );
      }
    }
}

-- 
--------------------------------------------------------------
Rupert Brooks
McGill Centre for Intelligent Machines (www.cim.mcgill.ca)
Ph.D Program in Intelligent Systems
http://www.cyberus.ca/~rbrooks


More information about the Insight-users mailing list