FUNCTION c_pixscale(idtype, odtype, in, out, ns, iscale, ioffset, oscale, ooffset, rndopt)
long *idtype; long *odtype; unsigned char *in; unsigned char *out; long *ns; float iscale; float ioffset; float oscale; float ooffset; long *rndopt;
Data type of the input buffer.
EBYTE (1) : unsigned byte data EWORD (2) : signed two byte data ELONG (3) : signed four byte data EREAL (4) : four byte floating point data EDOUBLE (5) : eight byte floating point data EUWORD (7) : unsigned two byte data EULONG (8) : unsigned four byte data
Data type of the output buffer.
EBYTE (1) : unsigned byte data EWORD (2) : signed two byte data ELONG (3) : signed four byte data EREAL (4) : four byte floating point data EDOUBLE (5) : eight byte floating point data EUWORD (7) : unsigned two byte data EULONG (8) : unsigned four byte data
Input buffer of pixel values to be rescaled.
Output buffer of rescaled pixel values.
Number of samples in the input and output buffers.
Scaling factor used in the input buffer.
Offset used in the input buffer.
Scaling factor to be applied to the output pixels.
Offset to be applied to the output pixels.
Rounding option. Rounding may be applied to output pixels in integer data types (EBYTE, EWORD, ELONG, EUWORD, and EULONG).
= TRUE (1) : Round ouput pixels = FALSE (0) : Do not round ouput pixels
The c_pixscale() routine is used to unscale a buffer of pixels given an input scaling factor and offset and rescale the buffer using an output scaling factor and offset. The data type may be converted during the rescaling operation.
The pixel values in the input buffer are first unscaled using the formula:
pixel = (*in - ioffset) * iscaleand they are rescaled and stored in the output buffer using this formula:
*out = (pixel / oscale) + ooffsetIf during scaling a value is generated that is too big or too small for the output data type, the return status will be set to TOOBIG and TOOSMALL, respectively. If the scaling generates some output pixels that are too big and some that are too small, the return status will be set to (TOOBIG | TOOSMALL).
c_pixscale() returns
E_SUCC (0) --> Successful scaling within data type limits. TOOBIG (77) --> Successful scaling; rescaling operation generated a value too large for the output data type. TOOSMALL (88) --> Successful scaling; rescaling operation generated a value too small for the output data type. TOOBIG | TOOSMALL (93) --> Successful scaling; rescaling operation generated value too big and too small for the output data type.