DIPlib Documentation - ©1995-2009 Quantitative Imaging Group, Delft University of Technology.

# DIPlib's data types

Pixel values are represented by different types, called data types. DIPlib supports the data types given in the following table:

data type | `dip_DataType` | data type identifier | suffix
`dip_bin8` | `DIP_DT_BIN8` | `DIP_DTID_BIN8` | `_b8`
`dip_bin16` | `DIP_DT_BIN16` | `DIP_DTID_BIN16` | `_b16`
`dip_bin32` | `DIP_DT_BIN32` | `DIP_DTID_BIN32` | `_b32`
`dip_uint8` | `DIP_DT_UINT8` | `DIP_DTID_UINT8` | `_u8`
`dip_uint16` | `DIP_DT_UINT16` | `DIP_DTID_UINT16` | `_u16`
`dip_uint32` | `DIP_DT_UINT32` | `DIP_DTID_UINT32` | `_u32`
`dip_sint8` | `DIP_DT_SINT8` | `DIP_DTID_SINT8` | `_s8`
`dip_sint16` | `DIP_DT_SINT16` | `DIP_DTID_SINT16` | `_s16`
`dip_sint32` | `DIP_DT_SINT32` | `DIP_DTID_SINT32` | `_s32`
`dip_sfloat` | `DIP_DT_SFLOAT` | `DIP_DTID_SFLOAT` | `_sfl`
`dip_dfloat` | `DIP_DT_DFLOAT` | `DIP_DTID_DFLOAT` | `_dfl`
`dip_scomplex` | `DIP_DT_SCOMPLEX` | `DIP_DTID_SCOMPLEX` | `_scx`
`dip_dcomplex` | `DIP_DT_DCOMPLEX` | `DIP_DTID_DCOMPLEX` | `_dcx`

The data types can be divided into five classes: the binary, unsigned integer, signed integer, floating point and complex classes. Different data types in the same class (e.g. `dip_uint8` and `dip_uint16`) provide a different range of values they can represent.

The complex data types are defines as follows:

    typedef struct                        typedef struct
    {                                     {
       dip_sfloat re;                        dip_dfloat re;
       dip_sfloat im;                        dip_dfloat im;
    } dip_scomplex;                       } dip_dcomplex;

The binary data types are simply aliases for a set of corresponding unsigned integer types. The reason for having a separate typedef for the binary types is that they are not used like ordinary integers. Each bit of the integer can store one binary value. When manipulating binary data, care must be taken not to change any of the other bits of the integer used for storing it.

The `dip_DataType` enumeration is used to represent data types symbolically. It is used in `dip_Image`'s to indicate what the data type of the image is. Data type identifiers are used by the type iterator (see `tpi.h`) and overload schemes (see `ovl.h` and overload.h). Type suffixes are used to give type specific routines a unique name. Using a standard set of suffixes enables the type iterator and overload schemes to deal with these type specific routines. The `dip_DataType` enumeration, data type identifiers and suffixes can be found in the table above.

In addition to the data type identifiers for individual data types, there are also defines to represent an entire group. These are given in the following table:

Data type identifier group | data types
`DIP_DTGID_UINT` | unsigned integer
`DIP_DTGID_UNSIGNED` | unsigned integer
`DIP_DTGID_SINT` | signed integer
`DIP_DTGID_INT` | signed and unsigned integer
`DIP_DTGID_INTEGER` | signed and unsigned intege
`DIP_DTGID_FLOAT` | floating-point
`DIP_DTGID_REAL` | integer and floating-point
`DIP_DTGID_COMPLEX` | complex floating-point
`DIP_DTGID_SIGNED` | signed integer, floating-point and complex
`DIP_DTGID_BINARY` | binary
`DIP_DTGID_ALL` | all

## SEE ALSO

`DataTypeGetInfo`

DIPlib on-line documentation | Function reference | Global function index