Pixel values are converted for type and sign by specifying values for
the properties MI_ICV_TYPE
and MI_ICV_SIGN
(they default
to NC_SHORT
and MI_SIGNED
). Values can also be converted
for valid range and for normalization. These conversions are enabled
by setting MI_ICV_DO_RANGE
to TRUE
(the default).
If MI_ICV_DO_NORM
is FALSE
(the default) then only
conversions for valid range are made. This means that if the input
file has shorts in the range 0 to 4095, then they can be converted to
bytes in the range 64 to 248 (for example). The real image maximum and
minimum (MIimagemax
and MIimagemin
) are ignored. The
valid range is specified by the properties MI_ICV_VALID_MAX
and
MI_ICV_VALID_MIN
, which default to the legal range for the type
and sign.
We may want to scale values so that they are normalized either to all
values in the MIimage
variable or to some user-defined range.
To do normalization, set MI_ICV_DO_NORM
to TRUE
. Setting
MI_ICV_USER_NORM
to FALSE
(the default) causes normalization to
the real maximum and minimum of the variable (the maximum of
MIimagemax
and the minimum of MIimagemin
). If
MI_ICV_USER_NORM
is true then the values of MI_ICV_IMAGE_MAX
and MI_ICV_IMAGE_MIN
are used (defaulting to 1.0 and 0.0).
When either MI_ICV_TYPE
or the file type is floating-point,
then the conversion to and from real values is always done using the
real image maximum and minimum information. If the internal type is
integer and MI_ICV_DO_NORM
is FALSE
, then the rescaling
is done so that the slice maximum maps to the valid range of the
internal values.
Note that when converting to integer types, values are rounded to the nearest integer and limited to be within the legal range for the data type.
The above transformations are simple enough, but the use of floating-point values adds to the complexity, since in general we do not want to rescale these values to get the real values. The various possibilities are described in greater detail below.