ImageDev

RegionalExtrema2d

Computes the regional extrema in a grayscale 2D image and marks them in a binary image.

Access to parameter description

For an introduction: This algorithm computes the regional or relative extrema in a 2D image and creates a binary image containing these extrema.

Function Syntax

This function returns outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > regionalExtrema2d( std::shared_ptr< iolink::ImageView > inputImage, RegionalExtrema2d::ExtremaType extremaType, RegionalExtrema2d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );
This function returns outputBinaryImage.
// Function prototype.
regional_extrema_2d( input_image,
                     extrema_type = RegionalExtrema2d.ExtremaType.MAXIMA,
                     neighborhood = RegionalExtrema2d.Neighborhood.CONNECTIVITY_8,
                     output_binary_image = None )
This function returns outputBinaryImage.
// Function prototype.
public static IOLink.ImageView
RegionalExtrema2d( IOLink.ImageView inputImage,
                   RegionalExtrema2d.ExtremaType extremaType = ImageDev.RegionalExtrema2d.ExtremaType.MAXIMA,
                   RegionalExtrema2d.Neighborhood neighborhood = ImageDev.RegionalExtrema2d.Neighborhood.CONNECTIVITY_8,
                   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
neighborhood
The 2D neighborhood configuration.
CONNECTIVITY_4 The structuring element is a cross.
CONNECTIVITY_8 The structuring element is a square.
Enumeration CONNECTIVITY_8
output
outputBinaryImage
The output binary. Its dimensions is 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
neighborhood
The 2D neighborhood configuration.
CONNECTIVITY_4 The structuring element is a cross.
CONNECTIVITY_8 The structuring element is a square.
enumeration CONNECTIVITY_8
output
output_binary_image
The output binary. Its dimensions is 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
neighborhood
The 2D neighborhood configuration.
CONNECTIVITY_4 The structuring element is a cross.
CONNECTIVITY_8 The structuring element is a square.
Enumeration CONNECTIVITY_8
output
outputBinaryImage
The output binary. Its dimensions is forced to the same values as the input. Image null

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

RegionalExtrema2d regionalExtrema2dAlgo;
regionalExtrema2dAlgo.setInputImage( polystyrene );
regionalExtrema2dAlgo.setExtremaType( RegionalExtrema2d::ExtremaType::MAXIMA );
regionalExtrema2dAlgo.setNeighborhood( RegionalExtrema2d::Neighborhood::CONNECTIVITY_8 );
regionalExtrema2dAlgo.execute();

std::cout << "outputBinaryImage:" << regionalExtrema2dAlgo.outputBinaryImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

regional_extrema_2d_algo = imagedev.RegionalExtrema2d()
regional_extrema_2d_algo.input_image = polystyrene
regional_extrema_2d_algo.extrema_type = imagedev.RegionalExtrema2d.MAXIMA
regional_extrema_2d_algo.neighborhood = imagedev.RegionalExtrema2d.CONNECTIVITY_8
regional_extrema_2d_algo.execute()

print( "output_binary_image:", str( regional_extrema_2d_algo.output_binary_image ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

RegionalExtrema2d regionalExtrema2dAlgo = new RegionalExtrema2d
{
    inputImage = polystyrene,
    extremaType = RegionalExtrema2d.ExtremaType.MAXIMA,
    neighborhood = RegionalExtrema2d.Neighborhood.CONNECTIVITY_8
};
regionalExtrema2dAlgo.Execute();

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

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = regionalExtrema2d( polystyrene, RegionalExtrema2d::ExtremaType::MAXIMA, RegionalExtrema2d::Neighborhood::CONNECTIVITY_8 );

std::cout << "outputBinaryImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.regional_extrema_2d( polystyrene, imagedev.RegionalExtrema2d.MAXIMA, imagedev.RegionalExtrema2d.CONNECTIVITY_8 )

print( "output_binary_image:", str( result ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IOLink.ImageView result = Processing.RegionalExtrema2d( polystyrene, RegionalExtrema2d.ExtremaType.MAXIMA, RegionalExtrema2d.Neighborhood.CONNECTIVITY_8 );

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