[MINC-users] converting one format to minc

Andrew Janke rotor@cmr.uq.edu.au
Mon May 10 02:04:04 2004


First, sorry about the late reply here, I have been overseas..

On Sat, 10 Apr 2004, Gibby Koldenhof wrote:

> I'm writing up some code to convert a number of file formats to minc (I'm
> using minc 1.2). For some reason I get strange results. When trying to convert
> 16bit signed raw data I get strange results. I first convert the raw data
> using minctoraw:
>
> rawtominc -short -input raw.raw -scan_range -xstep 1.0 -ystep 1.0 -zstep 1.0
>    a.mnc 100 100 100
>
>         GET_VALUE_3D(value, volume, x, y, z);
>         *voxels++  = value;
>
> mincinfo says both the files are the same, yet mincdiff tells me that the data
> is different. And indeed when I internally compare all the voxels about 1/6th
> of the voxels have a difference of 1 (integer, e.g. a voxel from a.mnc is 203
> and from b.mnc is 204 for example)  - strangly enough when loading both files
> into register they look exactly the same.
>
> ... how ... why ... I can't understand what is going wrong. I do not do any
> floating point conversion anywhere (since it looks like a roundoff error) ...
> I tried pretty much everything (e.g. changing the parameters to each call)

Gibby,

Assuming I can correctly grok what you have done here, I think you are getting
caught up with the difference between a real and a voxel range in MINC. Byt
simply incrementing the real value of all the voxels you have effectively just
changed the scaling of the volume.

Also register's precision is limited to byte (0..256) to the point that when a
volume is loaded the whole volume is scaled to byte precision and effectively
only a scaling and offset value are stored to convert to the "real value".

If you are concerned that what you are doing really is "correct" or not,
there are a few things you can do:

  1: Increment the VOXEL value directly and see that this range is
       stored correctly (if indeed this is what you are trying to do)

  2: Store the volumes in question in float or double precision at
       which stge the difference between voxel and real ranges is
       irrelevant.

But never fear! keep up the good work writing converters, I'll be more than
interested to havea copy of what you have done once you are finished.


--
Andrew Janke  ( rotorATcmr.uq.edu.au || www.cmr.uq.edu.au/~rotor )
Australia->University of Queensland->Centre for Magnetic Resonance
W: +61 7 3232 7254  ||  H: +61 7 3800 4042  ||  M: +61 4 2138 8581