Representing Image Data in IDL
Pixel values in an image file can be stored in many different data types. IDL maintains 15 different data types. The original data type of an image is reflected in IDL when importing the image, but the type can be converted once the image is stored in an IDL variable. The following types are commonly used for images:
- Byte — An 8-bit unsigned integer ranging in value from 0 to 255. Pixels in images are commonly represented as byte data.
- Unsigned Integer — A 16-bit unsigned integer ranging from 0 to 65535.
- Signed Integer — A 16-bit signed integer ranging from -32,768 to +32,767.
- Unsigned Longword Integer — A 32-bit unsigned integer ranging in value from 0 to approximately four billion.
- Longword Integer — A 32-bit signed integer ranging in value from approximately minus two billion to plus two billion.
- Floating-point — A 32-bit, single-precision, floating-point number in the range from -1038 to 1038, with approximately 6 or 7 decimal places of significance.
- Double-precision — A 64-bit, double-precision, floating-point number in the range from -10308 to 10308 with approximately 14 decimal places of significance.
While pixel values are commonly stored in files as whole numbers, they are usually converted to floating-point or double-precision data types prior to performing numerical computations. See the examples section of "REFORM" (IDL Reference Guide) and "Calculating Image Statistics" in Chapter 4 for more information.
IDL provides predefined routines to convert data from one type to another. These routines are shown in the following table: