ImageDev

GrayscaleFillHoles3d

Fills holes in particles of a three-dimensional grayscale image.

Access to parameter description

For an introduction: This algorithm is analogous to the FillHoles3d which is dedicated to the binary case. It fills darks areas that are not connected to the image borders with the maximal gray level surrounding them. This algorithm uses the grayscale reconstruction by erosion algorithm. The marker image used by the reconstruction is generated with gray levels equal to: The thresholdFillingValue parameter sets the maximum gray level from which the bottom of a valley is considered as a hole.

Reference:
P. Soille, Morphological Image Analysis. Principles and Applications, Second Edition, Springer-Verlag, Berlin, p.208, 2003.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > grayscaleFillHoles3d( std::shared_ptr< iolink::ImageView > inputImage, double thresholdFillingValue, GrayscaleFillHoles3d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
grayscale_fill_holes_3d( input_image,
                         threshold_filling_value = 1,
                         neighborhood = GrayscaleFillHoles3d.Neighborhood.CONNECTIVITY_26,
                         output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
GrayscaleFillHoles3d( IOLink.ImageView inputImage,
                      double thresholdFillingValue = 1,
                      GrayscaleFillHoles3d.Neighborhood neighborhood = ImageDev.GrayscaleFillHoles3d.Neighborhood.CONNECTIVITY_26,
                      IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The grayscale input image. Image Binary, Label or Grayscale nullptr
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
input
thresholdFillingValue
The value filling the marker image inside (the gray level under which valleys are filled). The common usage is to set it at the image maximum intensity. Float64 Any value 1
output
outputImage
The grayscale output image. Its dimensions and type are forced to the same values as the input. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The grayscale input image. image Binary, Label or Grayscale None
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
input
threshold_filling_value
The value filling the marker image inside (the gray level under which valleys are filled). The common usage is to set it at the image maximum intensity. float64 Any value 1
output
output_image
The grayscale output image. Its dimensions and type are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The grayscale input image. Image Binary, Label or Grayscale null
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
input
thresholdFillingValue
The value filling the marker image inside (the gray level under which valleys are filled). The common usage is to set it at the image maximum intensity. Float64 Any value 1
output
outputImage
The grayscale output image. Its dimensions and type are forced to the same values as the input. Image null

Object Examples

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

GrayscaleFillHoles3d grayscaleFillHoles3dAlgo;
grayscaleFillHoles3dAlgo.setInputImage( foam );
grayscaleFillHoles3dAlgo.setThresholdFillingValue( 0.0 );
grayscaleFillHoles3dAlgo.setNeighborhood( GrayscaleFillHoles3d::Neighborhood::CONNECTIVITY_26 );
grayscaleFillHoles3dAlgo.execute();

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

grayscale_fill_holes_3d_algo = imagedev.GrayscaleFillHoles3d()
grayscale_fill_holes_3d_algo.input_image = foam
grayscale_fill_holes_3d_algo.threshold_filling_value = 0.0
grayscale_fill_holes_3d_algo.neighborhood = imagedev.GrayscaleFillHoles3d.CONNECTIVITY_26
grayscale_fill_holes_3d_algo.execute()

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

GrayscaleFillHoles3d grayscaleFillHoles3dAlgo = new GrayscaleFillHoles3d
{
    inputImage = foam,
    thresholdFillingValue = 0.0,
    neighborhood = GrayscaleFillHoles3d.Neighborhood.CONNECTIVITY_26
};
grayscaleFillHoles3dAlgo.Execute();

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

Function Examples

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

auto result = grayscaleFillHoles3d( foam, 0.0, GrayscaleFillHoles3d::Neighborhood::CONNECTIVITY_26 );

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

result = imagedev.grayscale_fill_holes_3d( foam, 0.0, imagedev.GrayscaleFillHoles3d.CONNECTIVITY_26 )

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

IOLink.ImageView result = Processing.GrayscaleFillHoles3d( foam, 0.0, GrayscaleFillHoles3d.Neighborhood.CONNECTIVITY_26 );

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