ImageDev

ErosionDisk2d

Performs a two-dimensional erosion using a structuring element matching with a disk.

Access to parameter description

For an introduction: This algorithm supports two modes: a fast mode that combines erosions using different neighborhoods, and a precise mode (slower) that ensures a real disk structuring element. The mode can be selected with the precision parameter.

See also

Function Syntax

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

Class Syntax

Parameters

Class Name ErosionDisk2d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. The image type can be integer or float. Image Binary, Label, Grayscale or Multispectral 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" );

ErosionDisk2d erosionDisk2dAlgo;
erosionDisk2dAlgo.setInputImage( polystyrene );
erosionDisk2dAlgo.setKernelRadius( 3 );
erosionDisk2dAlgo.setPrecision( ErosionDisk2d::Precision::FASTER );
erosionDisk2dAlgo.execute();

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

erosion_disk_2d_algo = imagedev.ErosionDisk2d()
erosion_disk_2d_algo.input_image = polystyrene
erosion_disk_2d_algo.kernel_radius = 3
erosion_disk_2d_algo.precision = imagedev.ErosionDisk2d.FASTER
erosion_disk_2d_algo.execute()

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

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

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

Function Examples

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

auto result = erosionDisk2d( polystyrene, 3, ErosionDisk2d::Precision::FASTER );

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

result = imagedev.erosion_disk_2d( polystyrene, 3, imagedev.ErosionDisk2d.FASTER )

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

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

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