ImageDev

IntensityHistogram

Computes the histogram of a gray level image.

Access to parameter description

For an introduction: For each gray level $i$ of the input image, the number of pixels with intensity $i$ is computed.
This number of points per level is given in an histogram array. The histogram size depends on the intensity range. As an example, for an 8-bit integer image, the histogram $H$ is an array with 256 entries. $H(i)$ is the number of pixels at level i, for $i \in [0,255]$.

Notice: This algorithm can be used only on integer input images. The IntensityBinHistogram algorithm must be used to compute a histogram on floating point images.

See also

Function Syntax

This function returns outputMeasurement.
// Function prototype
IntensityHistogramMsr::Ptr intensityHistogram( std::shared_ptr< iolink::ImageView > inputImage, IntensityHistogram::RangeMode rangeMode, iolink::Vector2i32 intensityInputRange, IntensityHistogramMsr::Ptr outputMeasurement = nullptr );
This function returns outputMeasurement.
// Function prototype.
intensity_histogram(input_image: idt.ImageType,
                    range_mode: IntensityHistogram.RangeMode = IntensityHistogram.RangeMode.MIN_MAX,
                    intensity_input_range: Iterable[int] = [0, 255],
                    output_measurement: Union[Any, None] = None) -> IntensityHistogramMsr
This function returns outputMeasurement.
// Function prototype.
public static IntensityHistogramMsr
IntensityHistogram( IOLink.ImageView inputImage,
                    IntensityHistogram.RangeMode rangeMode = ImageDev.IntensityHistogram.RangeMode.MIN_MAX,
                    int[] intensityInputRange = null,
                    IntensityHistogramMsr outputMeasurement = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input gray scale image. Float images are not supported Image Binary, Label, Grayscale or Multispectral nullptr
input
rangeMode
The way to determine the input intensity range within which the histogram is computed.
MIN_MAX This histogram is computed between the minimum and the maximum of the image.
OTHER This histogram is computed between user-defined bounds [a,b].
Enumeration MIN_MAX
input
intensityInputRange
The input intensity range [a,b] within which the histogram is computed. This parameter is ignored if the range mode is set to MIN_MAX. Vector2i32 Any value {0, 255}
output
outputMeasurement
The output histogram. IntensityHistogramMsr nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input gray scale image. Float images are not supported image Binary, Label, Grayscale or Multispectral None
input
range_mode
The way to determine the input intensity range within which the histogram is computed.
MIN_MAX This histogram is computed between the minimum and the maximum of the image.
OTHER This histogram is computed between user-defined bounds [a,b].
enumeration MIN_MAX
input
intensity_input_range
The input intensity range [a,b] within which the histogram is computed. This parameter is ignored if the range mode is set to MIN_MAX. vector2i32 Any value [0, 255]
output
output_measurement
The output histogram. IntensityHistogramMsr None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input gray scale image. Float images are not supported Image Binary, Label, Grayscale or Multispectral null
input
rangeMode
The way to determine the input intensity range within which the histogram is computed.
MIN_MAX This histogram is computed between the minimum and the maximum of the image.
OTHER This histogram is computed between user-defined bounds [a,b].
Enumeration MIN_MAX
input
intensityInputRange
The input intensity range [a,b] within which the histogram is computed. This parameter is ignored if the range mode is set to MIN_MAX. Vector2i32 Any value {0, 255}
output
outputMeasurement
The output histogram. IntensityHistogramMsr null

Object Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

IntensityHistogram intensityHistogramAlgo;
intensityHistogramAlgo.setInputImage( polystyrene );
intensityHistogramAlgo.setRangeMode( IntensityHistogram::RangeMode::MIN_MAX );
intensityHistogramAlgo.setIntensityInputRange( {0, 255} );
intensityHistogramAlgo.execute();

std::cout << "intensityValue: " << intensityHistogramAlgo.outputMeasurement()->intensityValue( 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

intensity_histogram_algo = imagedev.IntensityHistogram()
intensity_histogram_algo.input_image = polystyrene
intensity_histogram_algo.range_mode = imagedev.IntensityHistogram.MIN_MAX
intensity_histogram_algo.intensity_input_range = [0, 255]
intensity_histogram_algo.execute()

print("intensityValue: ", str(intensity_histogram_algo.output_measurement.intensity_value(0)))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IntensityHistogram intensityHistogramAlgo = new IntensityHistogram
{
    inputImage = polystyrene,
    rangeMode = IntensityHistogram.RangeMode.MIN_MAX,
    intensityInputRange = new int[]{0, 255}
};
intensityHistogramAlgo.Execute();

Console.WriteLine( "intensityValue: " + intensityHistogramAlgo.outputMeasurement.intensityValue( 0 ) );

Function Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = intensityHistogram( polystyrene, IntensityHistogram::RangeMode::MIN_MAX, {0, 255} );

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

result = imagedev.intensity_histogram(polystyrene, imagedev.IntensityHistogram.MIN_MAX, [0, 255])

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

IntensityHistogramMsr result = Processing.IntensityHistogram( polystyrene, IntensityHistogram.RangeMode.MIN_MAX, new int[]{0, 255} );

Console.WriteLine(  "intensityValue: " + result.intensityValue( 0 )  );