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

ChainCodeNew

Chain code object allocation

SYNOPSIS

#include "dip_chaincode.h"

dip_Error dip_ChainCodeNew ( chaincode, resources )

FUNCTION

Allocates an object of type dip_ChainCode. However, since its fields are private and currently there exist only read access functions, it is of little use creating such an object.

A dip_ChainCode object stores the following data:

Data typeNameDescription
dip_intstartXStart coordinates for chain, ChainCodeGetStart
dip_intstartYStart coordinates for chain, ChainCodeGetStart
dip_intlabelLabel ID of object, ChainCodeGetLabel
dip_intconnectivityConnectivity of chain, ChainCodeGetConnectivity
dip_intnumberNumber of elements in chain, ChainCodeGetSize
dip_Chain *chainPointer to first element in chain, ChainCodeGetChains

The dip_Chain structure has the following elements:

Data typeNameDescription
dip_uint8codeDirection of step taken from previous to this pixel (Freeman code)
dip_BooleanborderPixel is on the border
dip_Chain *nextPointer to the next element in the chain

The chain parameter points to the first dip_Chain object in the chain, which points to the next through its next value. The last element in the chain has a NULL pointer.

Each chain element contains the code value (between 0 and 3 or between 0 and 7, depending on the connectivity) as well as a border value, which indicates whether the pixel is on the edge of the image or not. The border value is important because it indicates that the object is cut by the imaging window and needs to be treated differently.

The chain code for an object always has as many elements as the object has border pixels.

ARGUMENTS

Data typeNameDescription
dip_ChainCode *chaincodeReceives pointer to allocated structure
dip_ResourcesresourcesResources tracking structure. See ResourcesNew

SEE ALSO

ImageChainCode, ChainCodeFree, ChainCodeArrayNew, ChainCodeArrayFree, ChainCodeGetSize, ChainCodeGetChains, ChainCodeGetStart, ChainCodeGetLabel, ChainCodeGetConnectivity, ChainCodeGetLength, ChainCodeGetLongestRun, ChainCodeGetFeret