ImageDev

Erosion3d

Performs a three-dimensional erosion using a structuring element matching with a full or partial cube.

Access to parameter description

For an introduction: The erosion is performed by an iterative method in which each step erodes the result of the previous step. The kernelRadius parameter tunes the number of iterations, which sets the kernel size.
This algorithm uses a basic structuring element with 6, 18 or 26 neighbors, according to the neighborhood parameter.

<b> Figure 1.</b> Structuring elements: 6, 18 and 26 neighbors
Figure 1. Structuring elements: 6, 18 and 26 neighbors
See also
See related example

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > erosion3d( std::shared_ptr< iolink::ImageView > inputImage, uint32_t kernelRadius, Erosion3d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
erosion_3d( input_image,
            kernel_radius = 3,
            neighborhood = Erosion3d.Neighborhood.CONNECTIVITY_26,
            output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
Erosion3d( IOLink.ImageView inputImage,
           UInt32 kernelRadius = 3,
           Erosion3d.Neighborhood neighborhood = ImageDev.Erosion3d.Neighborhood.CONNECTIVITY_26,
           IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name Erosion3d

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 number of iterations (the half size of the structuring element, in voxels). A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1. UInt32 >=1 3
input
neighborhood
The 3D neighborhood configuration.
CONNECTIVITY_6 The structuring element is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18 The structuring element is composed of voxels with at least one common edge.
CONNECTIVITY_26 The structuring element is a full cube.
Enumeration CONNECTIVITY_26
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input image. Image nullptr

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

Erosion3d erosion3dAlgo;
erosion3dAlgo.setInputImage( foam );
erosion3dAlgo.setKernelRadius( 3 );
erosion3dAlgo.setNeighborhood( Erosion3d::Neighborhood::CONNECTIVITY_26 );
erosion3dAlgo.execute();

std::cout << "outputImage:" << erosion3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

erosion_3d_algo = imagedev.Erosion3d()
erosion_3d_algo.input_image = foam
erosion_3d_algo.kernel_radius = 3
erosion_3d_algo.neighborhood = imagedev.Erosion3d.CONNECTIVITY_26
erosion_3d_algo.execute()

print( "output_image:", str( erosion_3d_algo.output_image ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

Erosion3d erosion3dAlgo = new Erosion3d
{
    inputImage = foam,
    kernelRadius = 3,
    neighborhood = Erosion3d.Neighborhood.CONNECTIVITY_26
};
erosion3dAlgo.Execute();

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

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = erosion3d( foam, 3, Erosion3d::Neighborhood::CONNECTIVITY_26 );

std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result = imagedev.erosion_3d( foam, 3, imagedev.Erosion3d.CONNECTIVITY_26 )

print( "output_image:", str( result ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

IOLink.ImageView result = Processing.Erosion3d( foam, 3, Erosion3d.Neighborhood.CONNECTIVITY_26 );

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