[MINC-users] Reading minc format DTI data

Yonas T. yonas.t at gmail.com
Mon Jun 21 18:24:21 EDT 2010


Hi all,

I am trying to read DTI data that is stored in minc file format (minc 1.0 I
am told). I am using PC and found this win32 binary distribution at:
http://packages.bic.mni.mcgill.ca/win32/

mincinfo gives

C:\Mywork>mincinfo dti.mnc
file: dti.mnc
image: signed__ short 0 to 4095
image dimensions: time zspace yspace xspace
    dimension name         length         step        start
    --------------                   ------            ----           -----
    time                            109         11.1            0
    zspace                        63           -2      69.2799
    yspace                       128           -2      189.266
    xspace                       128           -2          128

and using the commands

mincinfo -attvalue acquisition:bvalues dti.mnc > b_values.txt
mincinfo -attvalue acquisition:direction_x dti.mnc > grad_x.txt,
mincinfo -attvalue acquisition:direction_y dti.mnc > grad_y.txt,
mincinfo -attvalue acquisition:direction_z dti.mnc > grad_z.txt

I have found out that, my file contains b-values = 0,0,...0 10 of them,
followed by 3000, 3000,...,3000 (99 of them), gradient directions of
(0,0,0),...10 times followed by 99 entries of (x,y,z). This made me believe
my dti file contains, 109 volumes out of which 10 are b0 volumes and the
remaining 99 are DW volumes. So far so good.

Now, I would like to read ONLY the image part (no header information) and
save it as raw file so that I can read it in matlab; as my code for the
analysis of DTI is developed in matlab. Before even reading the image part,
this is what I thought: whatever routine I use to read the image, the result
raw file must have size of 109x63x128x128xsizeOfDataType bytes. So if I use
short (sizeOfDataType=2) datatype for reading, I would expect,
109x63x128x128x2 = 225,017,856 bytes. Similarly, if I use float I would
expect exactly twice size.

Here is what I found however:

minctoraw -normalize dti.mnc > ImageData.raw
Result: ImageData.raw file with size = 227,288,499 bytes  (about 216MB)

minctoraw -normalize -short dti.mnc > ImageData_Short.raw
Result: ImageData_Short.raw file with size = 227,288,499 bytes  (about
216MB)

mincextract dti.mnc > ImageDataWithExtract.raw
Result: ImageDataWithExtract.raw file with size = 2,141,244,230 bytes
(about 2GB)

mincextract -normalize -short dti.mnc > ImageDataWithExtract_Short.raw
Result: ImageDataWithExtract_Short.raw file with size = 225,473,844 bytes
(about 215MB)

So my questions,

1. As you can see from the result, I am baffled by these strangely different
results when using minctoraw versus mincextract calls. Worse, none of these
file sizes matches what I expected. That is the file size is LARGER than
what I expected (mincextract -normalize -short dti.mnc >
ImageDataWithExtract_Short.raw gives 225,473,844 bytes although I expected
225,017,856 bytes). Any idea, please?

2. I also found emma matlab toolbox that can read minc format images. Going
through line by line of the reading routines, I can see that this tool does
nothing but uses mincextract to read the minc file to a temporary file and
then takes the first N bytes (where N is the expected size) from the
temporary file and returns. That is although the temporary file is bigger,
what emma does is simply discard the extra bytes. My questions here is: does
this emma knows the extra bytes are at the end of the raw file read? Is
there any documentation for this?

3. Does the result of mincinfo seem meaningful? I am a bit surprised by "image:
signed__ short 0 to 4095" because I would think unsigned short would make
more sense to say range 0 - 4095.

Any ideas please? Or any better way to read minc format image to save it as
raw file?

Thank you for your help.


More information about the MINC-users mailing list