[Insight-developers] [GDCM] ITK Origin and coordinate system
Mathieu Malaterre
mathieu.malaterre at kitware.com
Tue Jan 17 13:08:01 EST 2006
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];
More information about the Insight-developers
mailing list