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

# The image structure

## DESCRIPTION

`dip_Image` is the structure that is used to store images in DIPlib. It contains a number of fields that are used to describe an image. The type field stores the type of the image using a `dip_ImageType` enumeration. Currently scalar images are the only supported type (`DIP_IMTP_SCALAR`). The `DIP_IMTP_ALIEN` type is used internally by DIPlib for creating interfaces to other packages. Whether the other fields in the `dip_Image` are meaningful depends on the image type. A `dip_Image` may contain fields specific to the current image type. These will be discussed on the pages pertaining to the type in question. The standard fields that are always present are:

field type | short description | access functions
`dip_ImageType` | The image type | `ImageGetType`, `ImageSetType`
`dip_ImageState` | The image state | (none)
`dip_DataType` | Data type used to store pixel values | `ImageGetDataType`, `ImageSetDataType`
`dip_IntegerArray` | Dimensions of the image | `ImageGetDimensions`, `ImageGetDimensionality`, `ImageSetDimensions`
`void` ``* | Pointer to the pixel data | `ImageGetData`
`dip_int` | Plane number, for binary images | `ImageGetPlane`
`dip_IntegerArray` | Stride array (see below) | `ImageGetStride`

Pixel values are stored in the data type specified by the data type field. For a list of possible data types see DIPlib's data types.

The dimensionality of the image and the size of each individual dimension is stored in the dimensions Array.

The data pointer points to the pixel at the origin of the image. For each dimension the stride array holds the interleave between two neigbouring pixels in memory. The following equation may be used to compute the address of a pixel at a coordinate specified by an array called `cor[]`:

                       (N-1)
    address = origin +  Sum  cor[i] * stride[i]
                        i=0

A `dip_Image` structure does not necessarily have pixel data associated with it. When a `dip_Image` does not contain pixel data, it is said to be in the "raw" state. A `dip_Image` that does contain data, is said to be "forged". For binary images the `plane` field holds the number of the bit in which the binary data is stored. Access to the fields of a `dip_Image` is restricted to a number of functions, which are given in the table above. The "set" functions can only be used on "raw" images.

## SEE ALSO

DIPlib's data types

`ImageNew`

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