[Insight-developers] [GDCM] ITK Origin and coordinate system

Peter Cech pcech at vision.ee.ethz.ch
Tue Jan 17 14:42:52 EST 2006


Hi all,

I tend to agree with Mathieu. Here is my reasoning:

Global ITK frame - PointType, in milimeters, used by registration framework
Local image frame - IndexType/ContinuousIndexType, in pixels, relative
	to global ITK frame
DICOM frame - DICOM slice's origin and orientation are specified by this
	frame

Directional cosines together with origin define a local image frame. Lets
have a look how OrientedImage converts between PointType and
ContinuousIndexType in method TransformPhysicalPointToContinuousIndex:

  cvector = m_PhysicalPointToIndex * (point - this->m_Origin);

And inverse transform in TransformContinuousIndexToPhysicalPoint:

  point = this->m_Origin + m_IndexToPhysicalPoint * cvector;

>From these, origin is clearly in global itk frame coordinates and
therefore it should not be transformed by direction cosines.

When it comes to DICOM, it has it's own (global) frame and origin of
dicom image data is relative to this frame. As before, direction cosines
only influence local DICOM image frame, not the origin (well, origin is
the origin of local frame).

In my understanding, rowDirection/columnDirection/sliceDirection are
direction cosines defining local DICOM frame, therefore they should not
transform origin. If origin has to be transformed, it should be
a transformation transforming DICOM frame to global ITK frame.

Please correct me if I'm wrong somewhere.

Peter Cech

On Tue, Jan 17, 2006 at 13:52:48 -0500, Lorensen, William E (GE, Research) wrote:
> My interpretation is the same as Leila's. I read that the origin is always in LPS. I think it needs to be transformed into the ITK coordinate farem.
> 
> 
> -----Original Message-----
> From: Leila baghdadi [mailto:baghdadi at sickkids.ca]
> Sent: Tuesday, January 17, 2006 1:29 PM
> To: Mathieu Malaterre
> Cc: insight-developers at itk.org; Gordon Kindlmann; Lorensen, William E
> (GE, Research); Vince Magnotta
> Subject: Re: [Insight-developers] [GDCM] ITK Origin and coordinate
> system
> 
> 
> Hey petit frere,
> 
> I think you are right about the origin being a fixed point, i.e, for the
> header information,
> but once you apply the direction cosines to the image (i.e, right before
> visualization), shouldn't the origin be resampled as well?
> 
> Leila
> 
> On Tue, 2006-01-17 at 13:08 -0500, Mathieu Malaterre wrote:
> > Bill,
> > 
> > 	We are having a discussion with Gordon about a problem regarding the 
> > Origin of an itkImage read from a DICOM file. A while ago you put this 
> > code into itkGDCMImageIO(*). After discussion with Luis we came to the 
> > conclusion that the Origin is a fixed point. If you want to compute a 
> > point then yes you need to use the direction cosine and refer to the 
> > origin. But the origin should not change, right ?
> > 
> > Comments welcome,
> > Mathieu
> > 
> > 
> > (*)
> >    // DICOM specifies its origin in LPS coordinate, regardless of how
> >    // the data is acquired. itk's origin must be in the same
> >    // coordinate system as the data. This code transforms the DICOM
> >    // origin into the itk origin. The itk origin is computed by
> >    // multiplying the inverse(transpose) of the direction cosine times
> >    // the dicom origin.
> >    vnl_vector<double> itkOrigin(3), dicomOrigin(3);
> >    vnl_matrix<double> dicomDirection(3,3);
> >    dicomOrigin[0] = header.GetXOrigin();
> >    dicomOrigin[1] = header.GetYOrigin();
> >    dicomOrigin[2] = header.GetZOrigin();
> >    for (unsigned int ii = 0; ii < 3; ii++)
> >      {
> >      dicomDirection[0][ii] = rowDirection[ii];
> >      dicomDirection[1][ii] = columnDirection[ii];
> >      dicomDirection[2][ii] = sliceDirection[ii];
> >      }
> >    itkOrigin = dicomDirection * dicomOrigin;
> >    m_Origin[0] = itkOrigin[0];
> >    m_Origin[1] = itkOrigin[1];
> >    m_Origin[2] = itkOrigin[2];
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers at itk.org
> > http://www.itk.org/mailman/listinfo/insight-developers
> -- 
> Leila baghdadi <baghdadi at sickkids.ca>
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers


More information about the Insight-developers mailing list