[Insight-users] direction cosines and nifti

Dennis Jen dsjen at nmr.mgh.harvard.edu
Thu Feb 1 14:39:59 EST 2007


Hi,
  I'm reading in a nifti file and the direction cosines set in the image 
object aren't as I expected.  I looked in the itkNiftiImageIO source and 
the sform/qform is first read and then the closest canonical directions 
are set as the direction cosines, rather than the actual direction.  For 
example, if I have a voxel spacings of 2mm and sform matrix of:

    -1.9864  -0.0841  -0.2176   129.2511
    0.0650  -1.9911   0.1768   130.7259
    -0.2240   0.1685   1.9803   -59.4758
    0.0000   0.0000   0.0000     1.0000

and I expected my directions to be:

    x: -0.9932, 0.0325,-0.1120
    y: -0.0421, -0.9956, 0.0843
    z: -0.1088, 0.0884, 0.9901

Instead they're set to be:

    x: 1, 0, 0
    y: 0, 1, 0
    z: 0, 0, 1

  The setting of the directions seems to be pretty explicit, rather than 
buggy side effect, and I was wondering if anyone could enlighten me as 
to why this is done.
  Thanks,
    Dennis
 


More information about the Insight-users mailing list