[MINC-users] New to MINC libraries, image dimensions are causing me trouble!

Paul Lyon paulclyon at gmail.com
Tue Apr 15 18:22:40 EDT 2008


Dear MINC Community

I am doing some research under Dr. Thiel at the JGH/MNI in the
analysis of PET scans. I have a background in software engineering
but I am struggling to get my head around using the MINC libraries
correctly, especially w.r.t. manipulating image data.

I am compling against the MINC 1.5 libraries using Cygwin on WinXP.
I have a MNC image file containing PET scan data.
The file has 4 dimensions in that the fourth dimension is time.
The mincinfo utility reveals the following information for my input file:

$ mincinfo.exe test.mnc
file: test.mnc
image: signed__ short -32000 to 32000
image dimensions: time zspace yspace xspace
    dimension name         length         step        start
    --------------         ------         ----        -----
    time                       21      unknown      unknown
    zspace                     63       -2.425      -447.26
    yspace                    128      2.05941     -130.772
    xspace                    128      2.05941     -130.772

I have slightly modified Peter Neelin's mincexample1.c source code
which comes as part of the MINC 1.5 release (under progs/) so that
it now reads and writes 4 dimensional data, rather than just 3d.
I thought this would be a useful starting point for me as I need to
read in a 4D MINC file, process it (e.g. apply Guassian filter) and
output the resulting 4D MINC file. Should be straight-forward.

The program compiles and runs happily to produce an output file of
a comparible number of bytes with the following output:

File test.mnc:
  maximum =    1147.13, minimum =   -786.393
  times   =       time: n= 21, step=         1, start=         0
  slices  =     zspace: n= 63, step=    -2.425, start=   -447.26
  rows    =     yspace: n=128, step=   2.05941, start=  -130.772
  columns =     xspace: n=128, step=   2.05941, start=  -130.772
miicv_put 21 63 128 128


I have a few probably very basic problems which I struggling to get
to the bottom of:

1. My program produces an 'empty' output file as shown here:

$ mincextract.exe out.mnc -ascii | head -n10
-786.39315877937258392
-786.39315877937258392
-786.39315877937258392
-786.39315877937258392
-786.39315877937258392
-786.39315877937258392
-786.39315877937258392
-786.39315877937258392
-786.39315877937258392
-786.39315877937258392

The file has this value throughout. Interestingly this value is the same as the
minimum value for the input file (see program output above). I have checked the
return code of the miicv_put call and it is 0. I was thinking it might be some
thing to do with datatypes, but my file contains signed shorts, which I have
updated in the code accordingly.

Where as the original has what I would expect - some noise around zero:

$ mincextract.exe test.mnc -ascii | head -n10
7.1762131193147012109e-05
7.1762131193147012109e-05
7.1762131193147012109e-05
0.0059746876000823061215
-0.0058311633376960120972
7.1762131193147012109e-05
7.1762131193147012109e-05
7.1762131193147012109e-05
0.031062120842861230818
-0.013209820173807460333

The source code which I have modified to handle the 4d file is attached.


2. Once I have this sorted out I hope to apply a FFT algorithm to the data.
   However, I am struggling to get my head around the image data that
is returned
   by my call to miicv_get(icvid, start, count, volume->data). It
seems to be one
   long contigous array, rather than data[21][63][128][128] as I would
have hoped.
   Ultimately I would like to work at a 2D slice at a time, for a give
time frame.

   Am I able to manipulate this data array directly and if so how do I index it?
   I obviously want to be efficient and don't want to call mivarget1()
repeatedly.

   The alternative is I guess to use 2D hyperslabs through a call to
miicv_get(),
   but again, I assume this would return a continous array. How would I index
   the image data in this case, perhaps using a bit of multiplication to work
   out the index e.g. [i*DIM+j] for [i][j]? I am not sure as I cannot
seem to find
   any detailed documentation or examples on this. Maybe I am missing a
   resource?

What makes this more tricky for me is that I cannot compile my code
using lccwin32 and therefore am lacking debugging facilities. If
anyone knows how to get MINC 1.5 libraries working in lccwin32 this
would be a big help. At the moment when I try to compile in this
environment the linker just crashes out on me with a windows error box
with no error message. So I am just using Cygwin, vim and gcc as my
development environment currently. Is this the norm?

Sorry to ask what are probably trivial fundamentals on here, but I was
struggling to
find any detailed documentation on the API, for example explaining
exactly what is
values set to by a call miicv_get() in terms of data structure and dimensions.

If anyone has the time to spare to help me with these question via
email I would be extremely grateful.

More so if anyone from the MNI could spare an hour to take me through
some of the basics of using the MINC libraries that I might be misunderstanding
this would be fantastic, please let me know when you might be
available and I would be more than happy to pop round.

Kind regards
Paul Lyon
paulclyon at gmail.com
+5149653076
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pet-srtm.c.userlist
Url: http://www2.bic.mni.mcgill.ca/pipermail/minc-users/attachments/20080415/f8c205d3/attachment-0001.txt 


More information about the MINC-users mailing list