[Insight-developers] [GDCM] ITK Origin and coordinate system
Leila baghdadi
baghdadi at sickkids.ca
Tue Jan 17 13:29:14 EST 2006
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>
More information about the Insight-developers
mailing list