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:

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:

Table 1-2: Some IDL Data Type Conversion Functions  

Function
Description

BYTE

Convert to byte

BYTSCL

Scale data to range from 0 to 255 and then convert to byte

UINT

Convert to 16-bit unsigned integer

FIX

Convert to 16-bit integer, or optionally other type

ULONG

Convert to 32-bit unsigned integer

LONG

Convert to 32-bit integer

FLOAT

Convert to floating-point

DOUBLE

Convert to double-precision floating-point