This algorithm fills the holes inside particles, irrespective of their size.
Holes inside objects are filled using a numerical reconstruction applied on the complement
of the input image, from markers made of pixels of the image frame.
Figure 1. Illustration of the hole filling algorithm
Note: Since the reconstruction is applied on the input image complement, selecting a 4-neighbor
connectivity fills holes connected to the background with a 8-neighbor connectivity.
// Function prototype.publicstaticIOLink.ImageViewFillHoles2d(IOLink.ImageView inputObjectImage,FillHoles2d.Neighborhood neighborhood =ImageDev.FillHoles2d.Neighborhood.CONNECTIVITY_8,IOLink.ImageView outputObjectImage =null);
Class Syntax
// Command constructor.FillHoles2d();/// Gets the inputObjectImage parameter./// The input binary or label image.
std::shared_ptr< iolink::ImageView> inputObjectImage()const;/// Sets the inputObjectImage parameter./// The input binary or label image.void setInputObjectImage( std::shared_ptr< iolink::ImageView> inputObjectImage );/// Gets the neighborhood parameter./// The 2D neighborhood configuration for performing numerical reconstruction.FillHoles2d::Neighborhood neighborhood()const;/// Sets the neighborhood parameter./// The 2D neighborhood configuration for performing numerical reconstruction.void setNeighborhood(constFillHoles2d::Neighborhood& neighborhood );/// Gets the outputObjectImage parameter./// The output binary or label image. Its dimensions and type are forced to the same values as the input image.
std::shared_ptr< iolink::ImageView> outputObjectImage()const;/// Sets the outputObjectImage parameter./// The output binary or label image. Its dimensions and type are forced to the same values as the input image.void setOutputObjectImage( std::shared_ptr< iolink::ImageView> outputObjectImage );// Method to launch the command.void execute();
# Property of the inputObjectImage parameter.FillHoles2d.input_object_image
# Property of the neighborhood parameter.FillHoles2d.neighborhood
# Property of the outputObjectImage parameter.FillHoles2d.output_object_image
// Method to launch the command.
execute()
// Command constructor.FillHoles2d()// Property of the inputObjectImage parameter.FillHoles2d.inputObjectImage
// Property of the neighborhood parameter.FillHoles2d.neighborhood
// Property of the outputObjectImage parameter.FillHoles2d.outputObjectImage
// Method to launch the command.Execute()
Parameters
Parameter Name
Description
Type
Supported Values
Default Value
inputObjectImage
The input binary or label image.
Image
Binary or Label
nullptr
neighborhood
The 2D neighborhood configuration for performing numerical reconstruction.
CONNECTIVITY_8
Morphological reconstruction is performed with a 8-neighbor connectivity.
CONNECTIVITY_4
Morphological reconstruction is performed with a 4-neighbor connectivity.
Enumeration
CONNECTIVITY_8
outputObjectImage
The output binary or label image. Its dimensions and type are forced to the same values as the input image.
Image
nullptr
Parameter Name
Description
Type
Supported Values
Default Value
input_object_image
The input binary or label image.
image
Binary or Label
None
neighborhood
The 2D neighborhood configuration for performing numerical reconstruction.
CONNECTIVITY_8
Morphological reconstruction is performed with a 8-neighbor connectivity.
CONNECTIVITY_4
Morphological reconstruction is performed with a 4-neighbor connectivity.
enumeration
CONNECTIVITY_8
output_object_image
The output binary or label image. Its dimensions and type are forced to the same values as the input image.
image
None
Parameter Name
Description
Type
Supported Values
Default Value
inputObjectImage
The input binary or label image.
Image
Binary or Label
null
neighborhood
The 2D neighborhood configuration for performing numerical reconstruction.
CONNECTIVITY_8
Morphological reconstruction is performed with a 8-neighbor connectivity.
CONNECTIVITY_4
Morphological reconstruction is performed with a 4-neighbor connectivity.
Enumeration
CONNECTIVITY_8
outputObjectImage
The output binary or label image. Its dimensions and type are forced to the same values as the input image.