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 outputImage.
// 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 = nullptr );
This function returns outputImage.
// Function prototype.
closing_disk_by_reconstruction_2d(input_image: idt.ImageType,
                                  kernel_radius: int = 3,
                                  precision: ClosingDiskByReconstruction2d.Precision = ClosingDiskByReconstruction2d.Precision.FASTER,
                                  output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// 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

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
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label or Grayscale None
input
kernel_radius
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
output_image
The output 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
input
inputImage
The input image. Image Binary, Label or Grayscale null
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 null

Object Examples

auto 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

auto 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() );