[Neuroimaging] DICOM Orientation and World<-->Image coordinate transformation
athanastasiou at gmail.com
Sun Sep 4 15:12:53 EDT 2016
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
My immediate reaction was to invert the transformation matrix. However, I
am getting an error that the matrix is "singular".
I suspect that this might be because direction cosines are used throughout
the matrix which means that it might not appear to be a "proper" rotation
matrix (The translation and scaling are easier dealt with) and therefore it
is not as straightforward to invert.
I am thinking about recovering the angle described by the direction cosines
and building a proper transformation matrix (with cosines and sines). But
to do this, I would like to double check the following:
First of all, does this makes sense or should the matrix have been
inverseable without problems? (And therefore, I may be going wrong
Given the data packed along with the ROIs, is it safe to assume that:
a) The center of rotation is the PatientLocation (top left corner) (And
not the center of the image)
b) The top left corner should be translated to PatientLocation (or
c) Everything must be scaled by the pixel spacing.
Also, I am puzzled by the fact that the ROIs, although obtained by one of
the standard projections, appear to have a Z variable that varies. I would
expect that the ROI points would have 2 coordinates varying (describing the
shape of the ROI) and the third possibly fixed to the slice "depth".
However, in the data I have, the Z dimension seems to vary (I have not
plotted the ROI in 3D yet to verify if it is indeed valid data). Is it
right to assume that one of the dimensions of the ROI points might simply
be invalid? (On a test image, I can recover the prescribed ROI by ignoring
Z but as I am writing code that should cover every eventuality, I thought I
might check.). Or is it that the ROI might be slightly oblique, following
the viewing plane that was set during the prescription process?
Looking forward to hearing from you
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Neuroimaging