ImageDev

ClosingDiskByReconstruction2d

Performs a three-dimensional closing by reconstruction with a structuring element matching with a disk.

Access to parameter description

A closing by reconstruction consists in applying a dilation followed by a morphological reconstruction. In the binary case, closing by reconstruction can be used for filling small holes without modifying edges of the large ones. In the grayscale case, opening by reconstruction can be used for performing a Top Hat by reconstruction for detecting dark small structures without getting artifacts from the boundary concavities of large structures.
Its 2D grayscale behavior is illustrated in the ClosingByReconstruction2d documentation (Figure 1).

See also

Function Syntax

This function returns the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
closingDiskByReconstruction2d( std::shared_ptr< iolink::ImageView > inputImage,
                               uint32_t kernelRadius,
                               ClosingDiskByReconstruction2d::Precision precision,
                               std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
closing_disk_by_reconstruction_2d( input_image,
                                   kernel_radius = 3,
                                   precision = ClosingDiskByReconstruction2d.Precision.FASTER,
                                   output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
ClosingDiskByReconstruction2d( IOLink.ImageView inputImage,
                               UInt32 kernelRadius = 3,
                               ClosingDiskByReconstruction2d.Precision precision = ImageDev.ClosingDiskByReconstruction2d.Precision.FASTER,
                               IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name ClosingDiskByReconstruction2d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label or Grayscale nullptr
input
kernelRadius
The length of the disk radius in pixels. UInt32 >=1 3
input
precision
The precision of the computation method.
FASTER The operation is computed with the fast mode, which approximates a circular structuring element by combining erosions using 8 and 4 neighborhoods.
PRECISE The operation is computed with the precise mode (slower), which ensures a real circular structuring element.
Enumeration FASTER
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input image. Image nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

ClosingDiskByReconstruction2d closingDiskByReconstruction2dAlgo;
closingDiskByReconstruction2dAlgo.setInputImage( polystyrene );
closingDiskByReconstruction2dAlgo.setKernelRadius( 3 );
closingDiskByReconstruction2dAlgo.setPrecision( ClosingDiskByReconstruction2d::Precision::FASTER );
closingDiskByReconstruction2dAlgo.execute();

std::cout << "outputImage:" << closingDiskByReconstruction2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

closing_disk_by_reconstruction_2d_algo = imagedev.ClosingDiskByReconstruction2d()
closing_disk_by_reconstruction_2d_algo.input_image = polystyrene
closing_disk_by_reconstruction_2d_algo.kernel_radius = 3
closing_disk_by_reconstruction_2d_algo.precision = imagedev.ClosingDiskByReconstruction2d.FASTER
closing_disk_by_reconstruction_2d_algo.execute()

print( "output_image:", str( closing_disk_by_reconstruction_2d_algo.output_image ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

ClosingDiskByReconstruction2d closingDiskByReconstruction2dAlgo = new ClosingDiskByReconstruction2d
{
    inputImage = polystyrene,
    kernelRadius = 3,
    precision = ClosingDiskByReconstruction2d.Precision.FASTER
};
closingDiskByReconstruction2dAlgo.Execute();

Console.WriteLine( "outputImage:" + closingDiskByReconstruction2dAlgo.outputImage.ToString() );

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = closingDiskByReconstruction2d( polystyrene, 3, ClosingDiskByReconstruction2d::Precision::FASTER );

std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.closing_disk_by_reconstruction_2d( polystyrene, 3, imagedev.ClosingDiskByReconstruction2d.FASTER )

print( "output_image:", str( result ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IOLink.ImageView result = Processing.ClosingDiskByReconstruction2d( polystyrene, 3, ClosingDiskByReconstruction2d.Precision.FASTER );

Console.WriteLine( "outputImage:" + result.ToString() );