OpeningDisk2d
Performs a two-dimensional opening using a structuring element matching with a disk.
Access to parameter description
For an introduction:
It supports two modes: a fast mode that combines erosions and dilations using different neighborhoods, and a precise mode (slower) that ensures a real disk structuring element. The mode can be selected with the precision parameter.
With a classic implementation, morphological opening systematically considers areas out of the image as a replication of the image borders at each step of the algorithm. Therefore, when applying an opening, some thin object parts cut by the image borders may be removed at the erosion step and not be restored after the dilation, while one would expect to keep them. The borderPolicy parameter manages this case. The default mode, LIMITED, corresponds to the classic behavior. The EXTENDED mode properly manages image borders by extending them by a size equal to the structuring element's. This mode can be slower and more memory consuming, especially when the structuring element size is high.
This option is illustrated in the Opening2d documentation (Figure 2).
See also
Access to parameter description
For an introduction:
- section Mathematical Morphology
- section Introduction To Opening
It supports two modes: a fast mode that combines erosions and dilations using different neighborhoods, and a precise mode (slower) that ensures a real disk structuring element. The mode can be selected with the precision parameter.
With a classic implementation, morphological opening systematically considers areas out of the image as a replication of the image borders at each step of the algorithm. Therefore, when applying an opening, some thin object parts cut by the image borders may be removed at the erosion step and not be restored after the dilation, while one would expect to keep them. The borderPolicy parameter manages this case. The default mode, LIMITED, corresponds to the classic behavior. The EXTENDED mode properly manages image borders by extending them by a size equal to the structuring element's. This mode can be slower and more memory consuming, especially when the structuring element size is high.
This option is illustrated in the Opening2d documentation (Figure 2).
See also
Function Syntax
This function returns the outputImage output parameter.
// Function prototype. std::shared_ptr< iolink::ImageView > openingDisk2d( std::shared_ptr< iolink::ImageView > inputImage, uint32_t kernelRadius, OpeningDisk2d::Precision precision, OpeningDisk2d::BorderPolicy borderPolicy, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype. opening_disk_2d( input_image, kernel_radius = 3, precision = OpeningDisk2d.Precision.FASTER, border_policy = OpeningDisk2d.BorderPolicy.LIMITED, output_image = None )
This function returns the outputImage output parameter.
// Function prototype. public static IOLink.ImageView OpeningDisk2d( IOLink.ImageView inputImage, UInt32 kernelRadius = 3, OpeningDisk2d.Precision precision = ImageDev.OpeningDisk2d.Precision.FASTER, OpeningDisk2d.BorderPolicy borderPolicy = ImageDev.OpeningDisk2d.BorderPolicy.LIMITED, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Class Name | OpeningDisk2d |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
inputImage |
The input image. The image type can be integer or float. | Image | Binary, Label, Grayscale or Multispectral | nullptr | |||||
borderPolicy |
The border policy to apply.
|
Enumeration | LIMITED | ||||||
kernelRadius |
The length of the disk radius in pixels. | UInt32 | >=1 | 3 | |||||
precision |
The precision of the computation method.
|
Enumeration | FASTER | ||||||
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" ); OpeningDisk2d openingDisk2dAlgo; openingDisk2dAlgo.setInputImage( polystyrene ); openingDisk2dAlgo.setKernelRadius( 3 ); openingDisk2dAlgo.setPrecision( OpeningDisk2d::Precision::FASTER ); openingDisk2dAlgo.setBorderPolicy( OpeningDisk2d::BorderPolicy::EXTENDED ); openingDisk2dAlgo.execute(); std::cout << "outputImage:" << openingDisk2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) opening_disk_2d_algo = imagedev.OpeningDisk2d() opening_disk_2d_algo.input_image = polystyrene opening_disk_2d_algo.kernel_radius = 3 opening_disk_2d_algo.precision = imagedev.OpeningDisk2d.FASTER opening_disk_2d_algo.border_policy = imagedev.OpeningDisk2d.EXTENDED opening_disk_2d_algo.execute() print( "output_image:", str( opening_disk_2d_algo.output_image ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); OpeningDisk2d openingDisk2dAlgo = new OpeningDisk2d { inputImage = polystyrene, kernelRadius = 3, precision = OpeningDisk2d.Precision.FASTER, borderPolicy = OpeningDisk2d.BorderPolicy.EXTENDED }; openingDisk2dAlgo.Execute(); Console.WriteLine( "outputImage:" + openingDisk2dAlgo.outputImage.ToString() );
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = openingDisk2d( polystyrene, 3, OpeningDisk2d::Precision::FASTER, OpeningDisk2d::BorderPolicy::EXTENDED ); std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.opening_disk_2d( polystyrene, 3, imagedev.OpeningDisk2d.FASTER, imagedev.OpeningDisk2d.EXTENDED ) print( "output_image:", str( result ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); IOLink.ImageView result = Processing.OpeningDisk2d( polystyrene, 3, OpeningDisk2d.Precision.FASTER, OpeningDisk2d.BorderPolicy.EXTENDED ); Console.WriteLine( "outputImage:" + result.ToString() );