ImageDev

GrayscaleReconstruction3d

Performs a three-dimensional numerical reconstruction, starting from a grayscale marker image, into a grayscale input image.

Access to parameter description

For an introduction: This algorithm removes the light points in a dark image (reconstruction by dilation) or the dark points in a light image (reconstruction by erosion).

This algorithm is based on a recursive method whereby the minimum between the dilated or eroded image and the mask image is retained and used as the marker image for the next step.
At each step, the marker image is dilated or eroded by a structuring element of size 1.
This operation is repeated until stability. Therefore, the number of iterations depends on the input image and the marker image.

As shown in Figure 1, peaks and ridges are leveled down with a reconstruction by dilation, which results in a much more homogeneous output image.

<b> Figure 1.</b> One-dimensional example of a reconstruction by dilation
Figure 1. One-dimensional example of a reconstruction by dilation

As shown in Figure 2, the valleys are leveled up with a reconstruction by erosion, which results in a much more homogeneous output image.

<b> Figure 2.</b> One-dimensional example of a reconstruction by erosion
Figure 2. One-dimensional example of a reconstruction by erosion


See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > grayscaleReconstruction3d( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputMarkerImage, GrayscaleReconstruction3d::ReconstructionType reconstructionType, GrayscaleReconstruction3d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
grayscale_reconstruction_3d( input_image,
                             input_marker_image,
                             reconstruction_type = GrayscaleReconstruction3d.ReconstructionType.DILATION,
                             neighborhood = GrayscaleReconstruction3d.Neighborhood.CONNECTIVITY_26,
                             output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
GrayscaleReconstruction3d( IOLink.ImageView inputImage,
                           IOLink.ImageView inputMarkerImage,
                           GrayscaleReconstruction3d.ReconstructionType reconstructionType = ImageDev.GrayscaleReconstruction3d.ReconstructionType.DILATION,
                           GrayscaleReconstruction3d.Neighborhood neighborhood = ImageDev.GrayscaleReconstruction3d.Neighborhood.CONNECTIVITY_26,
                           IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The grayscale input mask image constraining reconstruction. Image Binary, Label or Grayscale nullptr
input
inputMarkerImage
The grayscale input marker image containing seeds for reconstruction. It must have the same dimensions and type as the input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
reconstructionType
The type of reconstruction algorithm to apply.
DILATION The reconstruction is performed by dilation. This mode removes the light points in a dark image.
EROSION The reconstruction is performed by dilation. This mode removes the dark points in a light image.
Enumeration DILATION
input
neighborhood
The 3D neighborhood configuration for performing dilations or erosions.
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 nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The grayscale input mask image constraining reconstruction. image Binary, Label or Grayscale None
input
input_marker_image
The grayscale input marker image containing seeds for reconstruction. It must have the same dimensions and type as the input image. image Binary, Label, Grayscale or Multispectral None
input
reconstruction_type
The type of reconstruction algorithm to apply.
DILATION The reconstruction is performed by dilation. This mode removes the light points in a dark image.
EROSION The reconstruction is performed by dilation. This mode removes the dark points in a light image.
enumeration DILATION
input
neighborhood
The 3D neighborhood configuration for performing dilations or erosions.
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 None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The grayscale input mask image constraining reconstruction. Image Binary, Label or Grayscale null
input
inputMarkerImage
The grayscale input marker image containing seeds for reconstruction. It must have the same dimensions and type as the input image. Image Binary, Label, Grayscale or Multispectral null
input
reconstructionType
The type of reconstruction algorithm to apply.
DILATION The reconstruction is performed by dilation. This mode removes the light points in a dark image.
EROSION The reconstruction is performed by dilation. This mode removes the dark points in a light image.
Enumeration DILATION
input
neighborhood
The 3D neighborhood configuration for performing dilations or erosions.
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 null

Object Examples

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

GrayscaleReconstruction3d grayscaleReconstruction3dAlgo;
grayscaleReconstruction3dAlgo.setInputImage( foam );
grayscaleReconstruction3dAlgo.setInputMarkerImage( foam );
grayscaleReconstruction3dAlgo.setReconstructionType( GrayscaleReconstruction3d::ReconstructionType::DILATION );
grayscaleReconstruction3dAlgo.setNeighborhood( GrayscaleReconstruction3d::Neighborhood::CONNECTIVITY_26 );
grayscaleReconstruction3dAlgo.execute();

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

grayscale_reconstruction_3d_algo = imagedev.GrayscaleReconstruction3d()
grayscale_reconstruction_3d_algo.input_image = foam
grayscale_reconstruction_3d_algo.input_marker_image = foam
grayscale_reconstruction_3d_algo.reconstruction_type = imagedev.GrayscaleReconstruction3d.DILATION
grayscale_reconstruction_3d_algo.neighborhood = imagedev.GrayscaleReconstruction3d.CONNECTIVITY_26
grayscale_reconstruction_3d_algo.execute()

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

GrayscaleReconstruction3d grayscaleReconstruction3dAlgo = new GrayscaleReconstruction3d
{
    inputImage = foam,
    inputMarkerImage = foam,
    reconstructionType = GrayscaleReconstruction3d.ReconstructionType.DILATION,
    neighborhood = GrayscaleReconstruction3d.Neighborhood.CONNECTIVITY_26
};
grayscaleReconstruction3dAlgo.Execute();

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

Function Examples

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

auto result = grayscaleReconstruction3d( foam, foam, GrayscaleReconstruction3d::ReconstructionType::DILATION, GrayscaleReconstruction3d::Neighborhood::CONNECTIVITY_26 );

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

result = imagedev.grayscale_reconstruction_3d( foam, foam, imagedev.GrayscaleReconstruction3d.DILATION, imagedev.GrayscaleReconstruction3d.CONNECTIVITY_26 )

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

IOLink.ImageView result = Processing.GrayscaleReconstruction3d( foam, foam, GrayscaleReconstruction3d.ReconstructionType.DILATION, GrayscaleReconstruction3d.Neighborhood.CONNECTIVITY_26 );

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