[Neuroimaging] trouble building an affine from DICOM tags

Jeff MacInnes jeff.macinnes at gmail.com
Wed Dec 20 04:43:57 EST 2017


Hi all,
I'm trying to construct an affine matrix using info from the DICOM tags in
a set of anatomical slices, but not having much luck. I'm following along
with the documentation at
http://nipy.org/nibabel/dicom/dicom_orientation.html#dicom-affines-again
(or at least think that I am), but the affine matrix I produce doesn't seem
to reflect how the slices were actually collected.

Specifically, I have 52 slices, collected sagittally, and by plotting
individual slices, it looks like the row-index axis increases toward
Inferior, the column-index axis increases toward Posterior, and the
slice-axis increases toward the patient Left. However, when I build the
affine, and submit it to nibabel.aff2axcodes() I get ('I', 'A', 'R'). I
keep going in circles trying to determine why that's off. I put all of my
steps in a notebook at
https://github.com/jeffmacinnes/affineTests/blob/master/DICOM_affineTest.ipynb
-- any insights would be greatly appreciated.

More generally, I'm wondering how to use the affine matrix to reorder the
voxel data before I save it as a Nifti file. Ideally, I'd like to be able
to reorder and reorient the data so that the axes correspond to RAS
(instead of IPL like the current data, but really I'm curious to know how
to do this in a flexible manner for data of any orientation). However, if
the voxels are reordered to RAS, does it require setting a new affine
before saving?

Many thanks,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20171220/658d70df/attachment.html>


More information about the Neuroimaging mailing list