ImageDev

OpeningByReconstruction3d

Performs a three-dimensional opening by reconstruction with a structuring element matching with a cube.

Access to parameter description

An opening by reconstruction consists in applying an erosion followed by a morphological reconstruction. In the binary case, opening by reconstruction can be used for removing small objects 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 bright small structures without getting artifacts from the boundary concavities of the large ones.
Its 2D binary behavior is illustrated in the OpeningByReconstruction2d documentation (Figure 1).

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > openingByReconstruction3d( std::shared_ptr< iolink::ImageView > inputImage, uint32_t kernelRadius, OpeningByReconstruction3d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
opening_by_reconstruction_3d(input_image: idt.ImageType,
                             kernel_radius: int = 3,
                             neighborhood: OpeningByReconstruction3d.Neighborhood = OpeningByReconstruction3d.Neighborhood.CONNECTIVITY_26,
                             output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
OpeningByReconstruction3d( IOLink.ImageView inputImage,
                           UInt32 kernelRadius = 3,
                           OpeningByReconstruction3d.Neighborhood neighborhood = ImageDev.OpeningByReconstruction3d.Neighborhood.CONNECTIVITY_26,
                           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 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
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label or Grayscale None
input
kernel_radius
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
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 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 null

Object Examples

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

OpeningByReconstruction3d openingByReconstruction3dAlgo;
openingByReconstruction3dAlgo.setInputImage( foam );
openingByReconstruction3dAlgo.setKernelRadius( 3 );
openingByReconstruction3dAlgo.setNeighborhood( OpeningByReconstruction3d::Neighborhood::CONNECTIVITY_26 );
openingByReconstruction3dAlgo.execute();

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

opening_by_reconstruction_3d_algo = imagedev.OpeningByReconstruction3d()
opening_by_reconstruction_3d_algo.input_image = foam
opening_by_reconstruction_3d_algo.kernel_radius = 3
opening_by_reconstruction_3d_algo.neighborhood = imagedev.OpeningByReconstruction3d.CONNECTIVITY_26
opening_by_reconstruction_3d_algo.execute()

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

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

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

Function Examples

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

auto result = openingByReconstruction3d( foam, 3, OpeningByReconstruction3d::Neighborhood::CONNECTIVITY_26 );

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

result = imagedev.opening_by_reconstruction_3d(foam, 3, imagedev.OpeningByReconstruction3d.CONNECTIVITY_26)

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

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

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