[Insight-developers] problems with MGH IO module

Richard Beare richard.beare at gmail.com
Tue Sep 24 17:15:30 EDT 2013


Hi,
I'm having problems with the MGH IO module enabled under ITK 4.5 that I'm
using to process Freesurfer data. I'm not sure who is looking after this
code.

The first problem (minor), is that the freesurfer filenames like
aparc.a2009s+aseg.mgz  seem to not pass the modules readability test.
Copying to a name without + or . seems to solve the problem.

The more serious problem is lack of origin preservation. My input has the
following, reported by mri_info:

          type: MGH
    dimensions: 256 x 256 x 256
   voxel sizes: 1.0000, 1.0000, 1.0000
          type: UCHAR (0)
           fov: 256.000
           dof: 0
        xstart: -128.0, xend: 128.0
        ystart: -128.0, yend: 128.0
        zstart: -128.0, zend: 128.0
            TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00
degrees
       nframes: 1
       PhEncDir: UNKNOWN
ras xform present
    xform info: x_r =  -1.0000, y_r =   0.0000, z_r =   0.0000, c_r =
6.7153
              : x_a =   0.0000, y_a =   0.0000, z_a =   1.0000, c_a =
12.4186
              : x_s =   0.0000, y_s =  -1.0000, z_s =   0.0000, c_s =
-8.1481

talairach xfm :
/home/rbeare/NCIdv0_scratch/ADNIMRI/Freesurfer//0720/mri/transforms/talairach.xfm
Orientation   : LIA
Primary Slice Direction: coronal

voxel to ras transform:
               -1.0000   0.0000   0.0000   134.7153
                0.0000   0.0000   1.0000  -115.5814
                0.0000  -1.0000   0.0000   119.8519
                0.0000   0.0000   0.0000     1.0000

My output is:

Volume information for /tmp/h.mgz
          type: MGH
    dimensions: 256 x 256 x 256
   voxel sizes: 1.0000, 1.0000, 1.0000
          type: INT (1)
           fov: 256.000
           dof: 1
        xstart: -128.0, xend: 128.0
        ystart: -128.0, yend: 128.0
        zstart: -128.0, zend: 128.0
            TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00
degrees
       nframes: 1
       PhEncDir: UNKNOWN
ras xform present
    xform info: x_r =  -1.0000, y_r =  -0.0000, z_r =  -0.0000, c_r =
-6.7153
              : x_a =   0.0000, y_a =   0.0000, z_a =   1.0000, c_a =
-12.4186
              : x_s =   0.0000, y_s =  -1.0000, z_s =   0.0000, c_s =
-8.1481

talairach xfm :
Orientation   : LIA
Primary Slice Direction: coronal

voxel to ras transform:
               -1.0000  -0.0000  -0.0000   121.2847
                0.0000   0.0000   1.0000  -140.4185
                0.0000  -1.0000   0.0000   119.8519
                0.0000   0.0000   0.0000     1.0000

voxel-to-ras determinant -1


The output segmentation image does not align with the original in freeview.

If I display the images within the ITK code I get the expected matrices:
input
  RequestedRegion:
    Dimension: 3
    Index: [0, 0, 0]
    Size: [256, 256, 256]
  Spacing: [1, 1, 1]
  Origin: [-134.715, 115.581, 119.852]
  Direction:
1 -5.36551e-19 0
0 -0 -1
5.36551e-19 -1 0

  IndexToPointMatrix:
1 -5.36551e-19 0
0 0 -1
5.36551e-19 -1 0

output:
  RequestedRegion:
    Dimension: 3
    Index: [0, 0, 0]
    Size: [256, 256, 256]
  Spacing: [1, 1, 1]
  Origin: [-134.715, 115.581, 119.852]
  Direction:
1 -5.36551e-19 0
0 -0 -1
5.36551e-19 -1 0

  IndexToPointMatrix:
1 -5.36551e-19 0
0 0 -1
5.36551e-19 -1 0

If I use mri_convert to convert aseg.mgz to aseg.nii.gz and convert the
processed image back to mgz, everything works as expected.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130925/1af811a7/attachment.htm>


More information about the Insight-developers mailing list