ImageDev

HExtrema3d

Detects and merges the local maxima or minima of a three-dimensional grayscale image and marks them in a binary image.

Access to parameter description

For an introduction: This algorithm detects and merges local maxima or minima presenting a contrast with their context of minimal height $h$.

In case of local maxima detection, the input is subtracted from the contrast coefficient $h$, then a grayscale reconstruction by dilation is performed on the result of this subtraction.
The regional maxima of the reconstructed image are called the h-maxima.

For detecting local minima, the input is added to the contrast coefficient $h$, then a grayscale reconstruction by erosion is performed with the result of this addition as marker image.
The regional minima of the reconstructed image are called the h-minima.

This algorithm only works with homogeneous gray level objects. The appropriate $h$ value depends on the local contrast between the gray level objects to detect. Increasing this factor too much may eliminate some previously merged objects.

This algorithm is useful for filtering noisy maxima or minima sets.
It also can be used as particle markers in various algorithms; for example, watershed detection.

Reference:
P. Soille, Morphological Image Analysis. Principles and Applications, Second Edition, Springer-Verlag, Berlin, pp.203-204, 2003.

See also

Function Syntax

This function returns outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > hExtrema3d( std::shared_ptr< iolink::ImageView > inputImage, HExtrema3d::ExtremaType extremaType, uint32_t contrast, HExtrema3d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputBinaryImage = nullptr );
This function returns outputBinaryImage.
// Function prototype.
h_extrema_3d(input_image: idt.ImageType,
             extrema_type: HExtrema3d.ExtremaType = HExtrema3d.ExtremaType.MAXIMA,
             contrast: int = 4,
             neighborhood: HExtrema3d.Neighborhood = HExtrema3d.Neighborhood.CONNECTIVITY_26,
             output_binary_image: idt.ImageType = None) -> idt.ImageType
This function returns outputBinaryImage.
// Function prototype.
public static IOLink.ImageView
HExtrema3d( IOLink.ImageView inputImage,
            HExtrema3d.ExtremaType extremaType = ImageDev.HExtrema3d.ExtremaType.MAXIMA,
            UInt32 contrast = 4,
            HExtrema3d.Neighborhood neighborhood = ImageDev.HExtrema3d.Neighborhood.CONNECTIVITY_26,
            IOLink.ImageView outputBinaryImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input grayscale image. Image Grayscale nullptr
input
extremaType
The type of extrema to detect.
MAXIMA The regional maxima are extracted from the input image.
MINIMA The regional minima are extracted from the input image.
Enumeration MAXIMA
input
contrast
The contrast level h. UInt32 Any value 4
input
neighborhood
The 3D neighborhood configuration used for the morphological operations.
CONNECTIVITY_6 The neighborhood configuration is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18 The neighborhood configuration is composed of voxels with at least one common edge.
CONNECTIVITY_26 The neighborhood configuration is a full cube.
Enumeration CONNECTIVITY_26
output
outputBinaryImage
The output binary image. Its dimensions are forced to the same values as the input. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input grayscale image. image Grayscale None
input
extrema_type
The type of extrema to detect.
MAXIMA The regional maxima are extracted from the input image.
MINIMA The regional minima are extracted from the input image.
enumeration MAXIMA
input
contrast
The contrast level h. uint32 Any value 4
input
neighborhood
The 3D neighborhood configuration used for the morphological operations.
CONNECTIVITY_6 The neighborhood configuration is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18 The neighborhood configuration is composed of voxels with at least one common edge.
CONNECTIVITY_26 The neighborhood configuration is a full cube.
enumeration CONNECTIVITY_26
output
output_binary_image
The output binary image. Its dimensions are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input grayscale image. Image Grayscale null
input
extremaType
The type of extrema to detect.
MAXIMA The regional maxima are extracted from the input image.
MINIMA The regional minima are extracted from the input image.
Enumeration MAXIMA
input
contrast
The contrast level h. UInt32 Any value 4
input
neighborhood
The 3D neighborhood configuration used for the morphological operations.
CONNECTIVITY_6 The neighborhood configuration is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18 The neighborhood configuration is composed of voxels with at least one common edge.
CONNECTIVITY_26 The neighborhood configuration is a full cube.
Enumeration CONNECTIVITY_26
output
outputBinaryImage
The output binary image. Its dimensions are forced to the same values as the input. Image null

Object Examples

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

HExtrema3d hExtrema3dAlgo;
hExtrema3dAlgo.setInputImage( foam );
hExtrema3dAlgo.setExtremaType( HExtrema3d::ExtremaType::MAXIMA );
hExtrema3dAlgo.setContrast( 4 );
hExtrema3dAlgo.setNeighborhood( HExtrema3d::Neighborhood::CONNECTIVITY_26 );
hExtrema3dAlgo.execute();

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

h_extrema_3d_algo = imagedev.HExtrema3d()
h_extrema_3d_algo.input_image = foam
h_extrema_3d_algo.extrema_type = imagedev.HExtrema3d.MAXIMA
h_extrema_3d_algo.contrast = 4
h_extrema_3d_algo.neighborhood = imagedev.HExtrema3d.CONNECTIVITY_26
h_extrema_3d_algo.execute()

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

HExtrema3d hExtrema3dAlgo = new HExtrema3d
{
    inputImage = foam,
    extremaType = HExtrema3d.ExtremaType.MAXIMA,
    contrast = 4,
    neighborhood = HExtrema3d.Neighborhood.CONNECTIVITY_26
};
hExtrema3dAlgo.Execute();

Console.WriteLine( "outputBinaryImage:" + hExtrema3dAlgo.outputBinaryImage.ToString() );

Function Examples

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

auto result = hExtrema3d( foam, HExtrema3d::ExtremaType::MAXIMA, 4, HExtrema3d::Neighborhood::CONNECTIVITY_26 );

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

result = imagedev.h_extrema_3d(foam, imagedev.HExtrema3d.MAXIMA, 4, imagedev.HExtrema3d.CONNECTIVITY_26)

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

IOLink.ImageView result = Processing.HExtrema3d( foam, HExtrema3d.ExtremaType.MAXIMA, 4, HExtrema3d.Neighborhood.CONNECTIVITY_26 );

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