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

Luis Ibanez luis.ibanez at kitware.com
Tue Jan 17 13:58:38 EST 2006


Hi Leila,


This is somehow a matter of "definition".


    If the "origin" is defined as the physical
    coordinates of the first pixel in the image,


then


    The direction cosines should not be applied to the
    origin, because this point is already in the physical
    coordinates of space.  e.g. the reference frame of
    a scanner.



The direction cosines are describing the orientation
of the axis defining the grid used for sampling the
image. In this context, the direction cosines only
affect the transformation between "index" and "physical
points", and they are useful for computing the position
of a pixel *with respect to the origin*.



At this point, we may have to go back and reconsider
if that definition of "origin" is the one that holds
for DICOM, and whether this is the one that we want
to keep for ITK or not.



    Luis



---------------------
Leila baghdadi wrote:
> 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



More information about the Insight-developers mailing list