Morphological segmentation
#include "dip_morphology.h"
dip_Error dip_SeededWatershed ( seeds, in, mask, out, connectivity, order, max_depth, max_size, binaryOutput )
integer, float
Watershed segmentation with built-in region merging. max_depth and max_size control the merging procedure. Any region with max_size or less pixels and with max_depth grey-value difference or less will be merged to neighbouring regions when they touch (as opposed to build a watershed). max_size equal to 0 means that the size of the region is not tested when merging. To avoid merging of seeds with no grey-value difference between them, set max_size to a negative value. The regions are grown according to the connectivity parameter. See The connectivity parameter for more information. The output is either a labelled image where the pixels belonging to a catchment basin are labelled, or a binary image where the watershed pixels are 1 and the rest is 0. This is controlled by binaryOutput.
As opposed to Watershed, this function takes a seeds input image, and grows the catchment basins from there. The output image, when binaryOutput is DIP_TRUE, will have label values as given by the seed image.
If mask is not 0, only the pixels within mask will be considered. All the other pixels will be untouched.
Data type | Name | Description |
dip_Image | seeds | Binary or labelled input image |
dip_Image | in | Grey-value input image |
dip_Image | mask | Mask image |
dip_Image | out | Output |
dip_int | connectivity | Connectivity |
dipf_GreyValueSortOrder | order | Whether to grow from low to high or high to low |
dip_float | max_depth | Maximum depth of a region that can be merged |
dip_int | max_size | Maximum size of a region that can be merged |
dip_Boolean | binaryOutput | DIP_FALSE if the output should be a labelled image |
The dipf_GreyValueSortOrder enumeration consists of the following values:
Name | Description |
DIP_GVSO_HIGH_FIRST | Process the pixels from high grey-value to low grey-value. |
DIP_GVSO_LOW_FIRST | Process the pixels from low grey-value to high grey-value. |