[MINC-users] Accessing 4D image data in MINC / Normalisation

Paul Lyon paulclyon at gmail.com
Tue Dec 23 16:11:33 EST 2008


Dear MINC User Community

I have been developing a piece of software to analyse neuro PET images
under MINC 1.5 and it is nearly complete other than one outstanding
problem that I have.

The PET images that I am using are converted from MINC and have a 4th
(time) dimension and are converted from ECAT using ecattominc.

I need to manipulate data across the temporal aspect and so I would
like to load in the entire 4D image into memory space at once.

The problem is I do not know how to access the image data voxels for a time, t.

As a result I am working around by extracting frame by frame, writing
to temporary file, and reading back in again. This is inefficient and
worse still is causing me all sorts of bother with normalisation such
that my voxel values become scewed.

Please can someone tell me how to access / index 4D image voxel data
directly in MINC 1.5.

At present I am using the following code to assign an index 4D array
of image data called voxel[][][][] by first pulling out a frame then a
slice of that frame and making new assignments:

  signed short int* image;
  ...
  image = malloc(vol4d->nrows * vol4d->ncols * sizeof(*image));
  for (t=0; t<vol4d->nframes; t++)
  {
    /* Extract the frame and perform the copy */
    extractFrame(mincId, icvId, framefile, vol4d, &vol3d, t);
    openFrame(framefile, NC_NOWRITE, &tempIcvId, &tempMincId, &vol3d);
    for (i=0; i<vol3d.nslices; i++)
    {
      getSlice(tempIcvId, &vol3d, i, image);
      for (j=0; j<vol4d->nrows; j++)
      {
        for (k=0; k<vol4d->ncols; k++)
        {
          /* Make the assignment */
          index = j*vol4d->ncols+k;
          vol4d->voxel[t][i][j][k]=image[index];
          ...
        }
      }
    }
  }

Where the methods extractFrame(), openFrame() and getSlice() are
methods written by myself which save a frame to file, open that frame
for reading and read a slice from that file respectively.
In the struct for the Volume4d datatype I have: signed short int ****voxel;

Surely there must be an easier and cleaner way?

Any help with this matter / relevant documentation would be very much
appreciated.

Also if anyone has any knowledge of the normalisation process which
goes on in loading images under MINC 1.5 I would love to discuss with
you. I could potentially stick with my current workaround and solve
the problem by modifying the normalisation parameters.

Dr. Paul Lyon (paulclyon at gmail.com)
University of Nottingham, England
Working under Dr. Alex Theil, MNI


More information about the MINC-users mailing list