This algorithm is based on the watershed algorithm to extract the lines separating objects of a binary image.
These lines are used as boundary lines between overlapping particles.
This algorithm is a high-level combination of distance transform, numerical reconstruction, and
watershed algorithms.
A contrast level parameter is used to reduce the number of markers for the watershed process and
thus of false positive separation lines.
There is a limitation to the separation ability: if some particles overlap too much, they are not
separated by the algorithm. A sensible criteria is that the distance between particle centroids should be
larger than their greatest radius.
Note: This algorithm requires up to 10 times the size of the input image as free memory.
If the system does not have enough free memory, this algorithm will fail during its computation. In this case,
the SeparateObjectsByBlock should be used instead.
// Command constructor.SeparateObjects();/// Gets the inputBinaryImage parameter./// The input binary image.
std::shared_ptr< iolink::ImageView> inputBinaryImage()const;/// Sets the inputBinaryImage parameter./// The input binary image.void setInputBinaryImage( std::shared_ptr< iolink::ImageView> inputBinaryImage );/// Gets the contrastValue parameter./// The depth of the valley used to select the markers of the watershed.int32_t contrastValue()const;/// Sets the contrastValue parameter./// The depth of the valley used to select the markers of the watershed.void setContrastValue(constint32_t& contrastValue );/// Gets the outputType parameter./// The type of result image.SeparateObjects::OutputType outputType()const;/// Sets the outputType parameter./// The type of result image.void setOutputType(constSeparateObjects::OutputType& outputType );/// Gets the algorithmMode parameter./// The mode for applying the watershed algorithm.SeparateObjects::AlgorithmMode algorithmMode()const;/// Sets the algorithmMode parameter./// The mode for applying the watershed algorithm.void setAlgorithmMode(constSeparateObjects::AlgorithmMode& algorithmMode );/// Gets the neighborhood parameter./// The 3D neighborhood configuration. This parameter is ignored with a 2D input image.SeparateObjects::Neighborhood neighborhood()const;/// Sets the neighborhood parameter./// The 3D neighborhood configuration. This parameter is ignored with a 2D input image.void setNeighborhood(constSeparateObjects::Neighborhood& neighborhood );/// Gets the outputImage parameter./// The output binary or label image. Its dimensions are forced to the same values as the input image. Its type depends on the outputType parameter.
std::shared_ptr< iolink::ImageView> outputImage()const;/// Sets the outputImage parameter./// The output binary or label image. Its dimensions are forced to the same values as the input image. Its type depends on the outputType parameter.void setOutputImage( std::shared_ptr< iolink::ImageView> outputImage );// Method to launch the command.void execute();
# Property of the inputBinaryImage parameter.SeparateObjects.input_binary_image
# Property of the contrastValue parameter.SeparateObjects.contrast_value
# Property of the outputType parameter.SeparateObjects.output_type
# Property of the algorithmMode parameter.SeparateObjects.algorithm_mode
# Property of the neighborhood parameter.SeparateObjects.neighborhood
# Property of the outputImage parameter.SeparateObjects.output_image
// Method to launch the command.
execute()
// Command constructor.SeparateObjects()// Property of the inputBinaryImage parameter.SeparateObjects.inputBinaryImage
// Property of the contrastValue parameter.SeparateObjects.contrastValue
// Property of the outputType parameter.SeparateObjects.outputType
// Property of the algorithmMode parameter.SeparateObjects.algorithmMode
// Property of the neighborhood parameter.SeparateObjects.neighborhood
// Property of the outputImage parameter.SeparateObjects.outputImage
// Method to launch the command.Execute()
Parameters
Parameter Name
Description
Type
Supported Values
Default Value
inputBinaryImage
The input binary image.
Image
Binary
nullptr
outputType
The type of result image.
SEPARATED_OBJECTS
The result image is a binary image representing the original data minus separation lines (split particles).
WATERSHED_RIDGES
The result image is a binary image representing the separation lines (watershed).
SEPARATED_BASINS
The result image is a label image representing the catchment areas (labeled complement of the watershed).
CONTIGUOUS_BASINS
The result image is a label image representing the catchment areas with separation lines filled by a label.
CONTIGUOUS_OBJECTS
The result image is a label image representing the original image with labels taking into account the watershed.
Enumeration
SEPARATED_OBJECTS
algorithmMode
The mode for applying the watershed algorithm.
REPEATABLE
The result is repeatable but slower to compute.
FAST
The result is faster to compute but not repeatable because of asynchronous parallel computation. Since a watershed problem does not generally have a unique solution, two processings of the same image can lead to two different results (both exact).
Enumeration
REPEATABLE
contrastValue
The depth of the valley used to select the markers of the watershed.
Int32
>=0
2
neighborhood
The 3D neighborhood configuration. This parameter is ignored with a 2D input image.
CONNECTIVITY_6
The structuring element is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18
The structuring element is composed of voxels with at least one common edge.
CONNECTIVITY_26
The structuring element is a full cube.
Enumeration
CONNECTIVITY_26
outputImage
The output binary or label image. Its dimensions are forced to the same values as the input image. Its type depends on the outputType parameter.
Image
nullptr
Parameter Name
Description
Type
Supported Values
Default Value
input_binary_image
The input binary image.
image
Binary
None
output_type
The type of result image.
SEPARATED_OBJECTS
The result image is a binary image representing the original data minus separation lines (split particles).
WATERSHED_RIDGES
The result image is a binary image representing the separation lines (watershed).
SEPARATED_BASINS
The result image is a label image representing the catchment areas (labeled complement of the watershed).
CONTIGUOUS_BASINS
The result image is a label image representing the catchment areas with separation lines filled by a label.
CONTIGUOUS_OBJECTS
The result image is a label image representing the original image with labels taking into account the watershed.
enumeration
SEPARATED_OBJECTS
algorithm_mode
The mode for applying the watershed algorithm.
REPEATABLE
The result is repeatable but slower to compute.
FAST
The result is faster to compute but not repeatable because of asynchronous parallel computation. Since a watershed problem does not generally have a unique solution, two processings of the same image can lead to two different results (both exact).
enumeration
REPEATABLE
contrast_value
The depth of the valley used to select the markers of the watershed.
int32
>=0
2
neighborhood
The 3D neighborhood configuration. This parameter is ignored with a 2D input image.
CONNECTIVITY_6
The structuring element is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18
The structuring element is composed of voxels with at least one common edge.
CONNECTIVITY_26
The structuring element is a full cube.
enumeration
CONNECTIVITY_26
output_image
The output binary or label image. Its dimensions are forced to the same values as the input image. Its type depends on the outputType parameter.
image
None
Parameter Name
Description
Type
Supported Values
Default Value
inputBinaryImage
The input binary image.
Image
Binary
null
outputType
The type of result image.
SEPARATED_OBJECTS
The result image is a binary image representing the original data minus separation lines (split particles).
WATERSHED_RIDGES
The result image is a binary image representing the separation lines (watershed).
SEPARATED_BASINS
The result image is a label image representing the catchment areas (labeled complement of the watershed).
CONTIGUOUS_BASINS
The result image is a label image representing the catchment areas with separation lines filled by a label.
CONTIGUOUS_OBJECTS
The result image is a label image representing the original image with labels taking into account the watershed.
Enumeration
SEPARATED_OBJECTS
algorithmMode
The mode for applying the watershed algorithm.
REPEATABLE
The result is repeatable but slower to compute.
FAST
The result is faster to compute but not repeatable because of asynchronous parallel computation. Since a watershed problem does not generally have a unique solution, two processings of the same image can lead to two different results (both exact).
Enumeration
REPEATABLE
contrastValue
The depth of the valley used to select the markers of the watershed.
Int32
>=0
2
neighborhood
The 3D neighborhood configuration. This parameter is ignored with a 2D input image.
CONNECTIVITY_6
The structuring element is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18
The structuring element is composed of voxels with at least one common edge.
CONNECTIVITY_26
The structuring element is a full cube.
Enumeration
CONNECTIVITY_26
outputImage
The output binary or label image. Its dimensions are forced to the same values as the input image. Its type depends on the outputType parameter.