Mamba C API reference

Version 2.0

MB_Api_3D.h File Reference

Go to the source code of this file.

Functions

MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Watershed (MB3D_Image *src, MB3D_Image *marker, Uint32 max_level, enum MB3D_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Basins (MB3D_Image *src, MB3D_Image *marker, Uint32 max_level, enum MB3D_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_HierarBld (MB3D_Image *mask, MB3D_Image *srcdest, enum MB3D_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_HierarDualBld (MB3D_Image *mask, MB3D_Image *srcdest, enum MB3D_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Label (MB3D_Image *src, MB3D_Image *dest, Uint32 lblow, Uint32 lbhigh, Uint32 *pNbobj, enum MB3D_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Distanceb (MB3D_Image *src, MB3D_Image *dest, enum MB3D_grid_t grid, enum MB_edgemode_t edge)
 

Function Documentation

MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Basins ( MB3D_Image src,
MB3D_Image marker,
Uint32  max_level,
enum MB3D_grid_t  grid 
)

Performs a watershed segmentation of the 3D image using the 3D marker image as a starting point for the flooding. The function returns the catchment basins of the watershed but no actual watershed line. It is recommended to use this function rather than MB_Watershed if you are only interested in catchment basins (faster).

The result is put into the 32-bit marker image.

The segmentation is coded as follows into the 32-bit values.

0 1 2 3
<— label —> unused
See also
MB_CopyBytePlane to access each byte individually.
Parameters
srcthe 3D image (greyscale or 32-bit) to segment
markerthe 3D marker image in which the result of segmentation will be put
max_levelthe maximum level reached by the water
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Distanceb ( MB3D_Image src,
MB3D_Image dest,
enum MB3D_grid_t  grid,
enum MB_edgemode_t  edge 
)

Computes for each pixel the distance to the edge of the set in which the pixel is found.

Parameters
srcthe binary source 3D image
destthe 32-bit 3D image in which the distance for each pixel is stored
gridthe grid used (either cubic or face_center_cubic)
edgethe kind of edge to use (behavior for pixels near edge depends on it)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_HierarBld ( MB3D_Image mask,
MB3D_Image srcdest,
enum MB3D_grid_t  grid 
)

(re)Builds a 3D image according to a 3D mask image and using a hierarchical list to compute the rebuild.

Parameters
maskthe mask image
srcdestthe rebuild image
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_HierarDualBld ( MB3D_Image mask,
MB3D_Image srcdest,
enum MB3D_grid_t  grid 
)

(re)Builds (dual operation) a 3D image according to a 3D mask image and using a hierarchical list to compute the rebuild.

Parameters
maskthe mask image
srcdestthe rebuild image
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Label ( MB3D_Image src,
MB3D_Image dest,
Uint32  lblow,
Uint32  lbhigh,
Uint32 pNbobj,
enum MB3D_grid_t  grid 
)

Labeling the object found in src 3D image.

Parameters
srcthe source 3D image where the object must be labelled
destthe 32-bit 3D image where object are labelled
lblowthe lowest value allowed for label on the low byte (must be inferior to lbhigh)
lbhighthe first high value NOT allowed for label on the low byte (maximum allowed is 256)
pNbobjthe number of object found
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Watershed ( MB3D_Image src,
MB3D_Image marker,
Uint32  max_level,
enum MB3D_grid_t  grid 
)

Performs a watershed segmentation of the 3D image using the marker image as a starting point for the flooding. The function builds the actual watershed line (idempotent) plus catchment basins (not idempotent). The result is put into the 32-bit marker image.

The segmentation is coded as follows into the 32-bit values.

0 1 2 3
<— label —> isLine

isLine is a value indicating if the pixel belongs to the watershed (255 if this is the case, undefined otherwise).

See also
MB_CopyBytePlane to access each byte individually.
Parameters
srcthe 3D image (greyscale or 32-bit) to segment
markerthe marker 3D image in which the result of segmentation will be put
max_levelthe maximum level reach by the water.
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)