For uint8 images, SPM assumes that there are no negative values. We
recommend using int16 for raw data, rather than uint8. However, the
main reason for this is not because SPM99 does not support negative
values in uint8 data, but because it can only represent 256 different
values.
Its true that if int16 or int32 images are output with larger absolute
negative values than positive ones, then the negative values are
truncated. However, this should be an extremely rare occurence with
normal SPM usage. Larger absolute negative values are likely to
occur in the beta_*, con_* and spmT_* images, but as these images are
written as floating point, then there should not be a problem.
Best regards,
-John
| I don't quite understand how SPM encodes negative voxel values in integer
| datatypes (say TYPE 2 (uint8) and TYPE 4 (int16)) in Analyze format files
| (*.img/*.hdr).
|
| Specifically, true voxel values are rescaled so they can "fit" into the
| maximum and minimum values allowed by the datatype. SPM seems to do this
| with a single scaling value, SCALE (in the analyze header, this is
| "roi_scale" or "funused1"). But what if some uint8 image has positive *and*
| negative values? Given that the datatype runs from 0 to 255, I don't quite
| understand the encoding via the single scalar SCALE. Similarly, tracing
| through the code in SPM99, when writing out an int16 image, spm seems to
| consider the maximum value in the volume, then scales things down by
| max/maxval, where max is the image maximum and maxval is 2^15 - 1. But what
| if the minimum value of the image is negative and has a larger absolute
| value than the maximum?
|
| Is the answer to these questions "the only way SPM will encounter negative
| image values anyway is after *statistical* processing, and any *output*
| image with negative values (say, in a statistical image) will be output as a
| *.mat file"?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|