<div dir="ltr"><div><div><div><div>Hi,<br></div>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.<br><br></div>
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.<br><br></div>The more serious problem is lack of origin preservation. My input has the following, reported by mri_info:<br>
<br> type: MGH<br> dimensions: 256 x 256 x 256<br> voxel sizes: 1.0000, 1.0000, 1.0000<br> type: UCHAR (0)<br> fov: 256.000<br> dof: 0<br> xstart: -128.0, xend: 128.0<br> ystart: -128.0, yend: 128.0<br>
zstart: -128.0, zend: 128.0<br> TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees<br> nframes: 1<br> PhEncDir: UNKNOWN<br>ras xform present<br> xform info: x_r = -1.0000, y_r = 0.0000, z_r = 0.0000, c_r = 6.7153<br>
: x_a = 0.0000, y_a = 0.0000, z_a = 1.0000, c_a = 12.4186<br> : x_s = 0.0000, y_s = -1.0000, z_s = 0.0000, c_s = -8.1481<br><br>talairach xfm : /home/rbeare/NCIdv0_scratch/ADNIMRI/Freesurfer//0720/mri/transforms/talairach.xfm<br>
Orientation : LIA<br>Primary Slice Direction: coronal<br><br>voxel to ras transform:<br> -1.0000 0.0000 0.0000 134.7153<br> 0.0000 0.0000 1.0000 -115.5814<br> 0.0000 -1.0000 0.0000 119.8519<br>
0.0000 0.0000 0.0000 1.0000<br><br></div>My output is:<br><div><br>Volume information for /tmp/h.mgz<br> type: MGH<br> dimensions: 256 x 256 x 256<br> voxel sizes: 1.0000, 1.0000, 1.0000<br>
type: INT (1)<br> fov: 256.000<br> dof: 1<br> xstart: -128.0, xend: 128.0<br> ystart: -128.0, yend: 128.0<br> zstart: -128.0, zend: 128.0<br> TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees<br>
nframes: 1<br> PhEncDir: UNKNOWN<br>ras xform present<br> xform info: x_r = -1.0000, y_r = -0.0000, z_r = -0.0000, c_r = -6.7153<br> : x_a = 0.0000, y_a = 0.0000, z_a = 1.0000, c_a = -12.4186<br>
: x_s = 0.0000, y_s = -1.0000, z_s = 0.0000, c_s = -8.1481<br><br>talairach xfm :<br>Orientation : LIA<br>Primary Slice Direction: coronal<br><br>voxel to ras transform:<br> -1.0000 -0.0000 -0.0000 121.2847<br>
0.0000 0.0000 1.0000 -140.4185<br> 0.0000 -1.0000 0.0000 119.8519<br> 0.0000 0.0000 0.0000 1.0000<br><br>voxel-to-ras determinant -1<br><br><br></div><div>The output segmentation image does not align with the original in freeview.<br>
<br></div><div>If I display the images within the ITK code I get the expected matrices:<br></div><div>input<br> RequestedRegion:<br> Dimension: 3<br> Index: [0, 0, 0]<br> Size: [256, 256, 256]<br> Spacing: [1, 1, 1]<br>
Origin: [-134.715, 115.581, 119.852]<br> Direction:<br>1 -5.36551e-19 0<br>0 -0 -1<br>5.36551e-19 -1 0<br><br> IndexToPointMatrix:<br>1 -5.36551e-19 0<br>0 0 -1<br>5.36551e-19 -1 0<br><br></div><div>output:<br> RequestedRegion:<br>
Dimension: 3<br> Index: [0, 0, 0]<br> Size: [256, 256, 256]<br> Spacing: [1, 1, 1]<br> Origin: [-134.715, 115.581, 119.852]<br> Direction:<br>1 -5.36551e-19 0<br>0 -0 -1<br>5.36551e-19 -1 0<br><br> IndexToPointMatrix:<br>
1 -5.36551e-19 0<br>0 0 -1<br>5.36551e-19 -1 0<br><br></div><div>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.<br></div><div><br></div></div>