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

# Label

Label a binary image

## SYNOPSIS

`#include "dip_regions.h"`

dip_Error dip_Label ( in, out, connectivity, flags, minsize, maxsize, nol, boundary )

## DATA TYPES

binary

## FUNCTION

The output is an integer image. Each object (respecting the connectivity, see The connectivity parameter) in the input image receives a unique number. This number ranges from 1 to the number of objects in the image. The pixels in the output image corresponding to a given object are set to this number (label). The remaining pixels in the output image are set to 0. The `minsize` and `maxsize` set limits on the size of the objects, if the flag `DIP_LB_THRESHOLD_ON_SIZE` is set: Objects smaller than `minsize` or larger than `maxsize` do not receive a label and the corresponding pixels in the output image are set to zero. Setting `minsize` to zero implies that there is no check with respect to the minimum size of the object, and the same holds for `maxsize` and the maximum size of the object. If the flag `DIP_LB_LABEL_IS_SIZE` is set, the objects' labels are set to the objects' sizes. The boundary conditions are generally ignored (labeling stops at the boundary). The exception is `DIP_BC_PERIODIC`, which is the only one that makes sense for this algorithm.

## ARGUMENTS

Data type | Name | Description
`dip_Image` | `in` | Input binary image
`dip_Image` | `out` | Output label image
`dip_int` | `connectivity` | Connectivity
`dip_int` | `flags` | 0, or a logical OR of the flags described above
`dip_int` | `minsize` | Minimum size of the objects (0=do not check)
`dip_int` | `maxsize` | Maximum size of the objects (0=do not check)
`dip_int *` | `nol` | Pointer to dip_int. Used for returning the number of objects. May be set to 0.
`dip_BoundaryArray` | `boundary` | Boundary conditions

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