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

MeasurementFeatureRegister

Register a measurement function

SYNOPSIS

#include "dip_measurement.h"

dip_Error dip_MeasurementFeatureRegister ( registry )

FUNCTION

This function registers a measurement function, specified by registry. Once a function is registered, it can be used through the Measure function by specifying registry.id.rtid as the measurement ID. registry contains pointers to a series of functions related to making the measurement, and contains information on how these functions should be called. See below for more information.

ARGUMENTS

Data typeNameDescription
dip_MeasurementFeatureRegistryregistryRegistry

THE REGISTRY STRUCTURE

The dip_MeasurementFeatureRegistry structure contains the following fields:

Data typeNameDescription
dip_IdentifieridUnique identifier
dipf_FeatureMeasureFunctiontypeType of function measure points to
dip_FeatureCreateFunctioncreateFunction pointer, see FeatureCreateFunction
dip_FeatureComposeFunctioncomposeFunction pointer, see FeatureComposeFunction
dip_FeatureMeasureFunctionmeasureUnion of function pointers
dip_FeatureValueFunctionvalueFunction pointer, see FeatureValueFunction
dip_FeatureDescriptionFunctiondescriptionFunction pointer, see FeatureDescriptionFunction
dip_FeatureConvertFunctionconvertFunction pointer, see FeatureConvertFunction
dip_intiterationsCurrently ignored (set to 1)
dip_BooleanneedIntensityImWhether or not a grey-value image is needed

dip_Identifier is a struct with two values: uuid and rtid. rtid is of type dip_int, and needs to be set to a unique number (use GetUniqueNumber for that). uuid is curently ignored, but should be set to a universally unique number by using the time, date and processor ID at the time of writing the code. The UNIX command uuidgen should be used for this.

measure points to the main measuring function, and can be of four different types, based on how it does the measuring. measure is a union with the following fields:

Data typeNameDescription
dip_FeatureLineFunctionlineTakes one image line at the time, see FeatureLineFunction
dip_FeatureImageFunctionimageTakes the whole image at once, see FeatureImageFunction
dip_FeatureChainCodeFunctionchaincodeTakes one chain code at the time, see FeatureChainCodeFunction
dip_FeatureConvHullFunctionconvhullTakes one convex polygon at the time, see FeatureConvHullFunction
dip_FeatureCompositeFunctioncompositeCombines the results of various other measurements, see FeatureCompositeFunction

The type flag should match the function type pointed to, and can be one of the following:

NameDescription
DIP_MSR_FUNCTION_LINE_BASEDmeasure.line is set
DIP_MSR_FUNCTION_IMAGE_BASEDmeasure.image is set
DIP_MSR_FUNCTION_CHAINCODE_BASEDmeasure.chaincode is set
DIP_MSR_FUNCTION_CONVHULL_BASEDmeasure.convhull is set
DIP_MSR_FUNCTION_COMPOSITEmeasure.composite is set

create points to a function that allocates and initialises any data before the measurement can start. value points to a function that returns the measurement result (called by MeasurementObjectValue). description points to a function that returns information on the measurement performed (called by MeasurementFeatureDescription). convert points to a function that copies the collected measurement data to a second measurement object (called MeasurementFeatureConvert). Finally, the compose element points to a function that returns the list of measurement IDs that the DIP_MSR_FUNCTION_COMPOSITE function depends on. This value is ignored for other types of measurement functions.

needIntensityIm should be set if the measurement function expects a grey-value input as well as the labeled image.

SEE ALSO

Measure, MeasurementFeatureRegistryList, MeasurementFeatureRegistryGet, MeasurementFeatureRegistryFeatureDescription, MeasurementFeatureRegistryFeatureNeedsIntensityImage, MeasurementFeatureValid, MeasurementFeatureDescription, MeasurementObjectData, MeasurementObjectValue, MeasurementFeatureConvert, FeatureLineFunction, FeatureImageFunction, FeatureChainCodeFunction, FeatureConvHullFunction, FeatureCompositeFunction, FeatureCreateFunction, FeatureComposeFunction, FeatureValueFunction, FeatureConvertFunction, FeatureDescriptionFunction