[Neuroimaging] DICOM Orientation and World<-->Image coordinate transformation

Matthew Brett matthew.brett at gmail.com
Mon Sep 5 19:48:48 EDT 2016


On Sun, Sep 4, 2016 at 12:12 PM, Athanasios Anastasiou
<athanastasiou at gmail.com> wrote:
> Hello everyone
> I am trying to convert between world and image coordinates and I am having
> some difficulty, particularly with inversing the transform.
> I need this specifically, as I would like to extract the pixels that have
> been prescribed (manually) by a ROI. I can access the grayscale values which
> are in some pixel space and I can access the ROI data which however is
> expressed in 'mm' and thus in world coordinates.
> As per http://nipy.org/nibabel/dicom/dicom_orientation.html I have all the
> data to construct the matrix that converts pixel to world coordinates but I
> am interested in the opposite direction (i.e. from world (ROI) to image
> (pixels)).
> My immediate reaction was to invert the transformation matrix. However, I am
> getting an error that the matrix is "singular".

Yes, inverting is what you want to do.   The error is telling you
about some error in the affine matrix.

Would you mind giving more details on where you got the entries for
your affine matrix?  What are your ImageOrientationPatient and
ImagePositionPatient fields?  I assume you got the third column of the
matrix by taking the cross-product of the first two?  What matrix do
you end up with?



More information about the Neuroimaging mailing list