ImageDev

IntensityMaskedStatistics

Computes basic statistics on a region of interest of an image, defined by a binary mask.

Access to parameter description

For an introduction: This algorithm gives the same results as IntensityStatistics taking into account only pixels under a binary mask image.

See also

Function Syntax

This function returns outputMeasurement.
// Function prototype
StatisticsMsr::Ptr intensityMaskedStatistics( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputMaskImage, StatisticsMsr::Ptr outputMeasurement = NULL );
This function returns outputMeasurement.
// Function prototype.
intensity_masked_statistics( input_image, input_mask_image, output_measurement = None )
This function returns outputMeasurement.
// Function prototype.
public static StatisticsMsr
IntensityMaskedStatistics( IOLink.ImageView inputImage,
                           IOLink.ImageView inputMaskImage,
                           StatisticsMsr outputMeasurement = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputMaskImage
The binary mask input image. This image must have same dimensions as the input image. Image Binary nullptr
output
outputMeasurement
The output measurement results. StatisticsMsr nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label, Grayscale or Multispectral None
input
input_mask_image
The binary mask input image. This image must have same dimensions as the input image. image Binary None
output
output_measurement
The output measurement results. StatisticsMsr None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral null
input
inputMaskImage
The binary mask input image. This image must have same dimensions as the input image. Image Binary null
output
outputMeasurement
The output measurement results. StatisticsMsr null

Object Examples

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

IntensityMaskedStatistics intensityMaskedStatisticsAlgo;
intensityMaskedStatisticsAlgo.setInputImage( polystyrene );
intensityMaskedStatisticsAlgo.setInputMaskImage( polystyrene_mask );
intensityMaskedStatisticsAlgo.execute();

std::cout << "pixelCount: " << intensityMaskedStatisticsAlgo.outputMeasurement()->pixelCount( 0 , 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
polystyrene_mask = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_mask.vip"))

intensity_masked_statistics_algo = imagedev.IntensityMaskedStatistics()
intensity_masked_statistics_algo.input_image = polystyrene
intensity_masked_statistics_algo.input_mask_image = polystyrene_mask
intensity_masked_statistics_algo.execute()

print( "pixelCount: ", str( intensity_masked_statistics_algo.output_measurement.pixel_count( 0 , 0 ) ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
ImageView polystyrene_mask = Data.ReadVipImage( @"Data/images/polystyrene_mask.vip" );

IntensityMaskedStatistics intensityMaskedStatisticsAlgo = new IntensityMaskedStatistics
{
    inputImage = polystyrene,
    inputMaskImage = polystyrene_mask
};
intensityMaskedStatisticsAlgo.Execute();

Console.WriteLine( "pixelCount: " + intensityMaskedStatisticsAlgo.outputMeasurement.pixelCount( 0 , 0 ) );

Function Examples

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

auto result = intensityMaskedStatistics( polystyrene, polystyrene_mask );

std::cout << "pixelCount: " << result->pixelCount( 0 , 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
polystyrene_mask = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_mask.vip"))

result = imagedev.intensity_masked_statistics( polystyrene, polystyrene_mask )

print( "pixelCount: ", str( result.pixel_count( 0 , 0 ) )  )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
ImageView polystyrene_mask = Data.ReadVipImage( @"Data/images/polystyrene_mask.vip" );

StatisticsMsr result = Processing.IntensityMaskedStatistics( polystyrene, polystyrene_mask );

Console.WriteLine(  "pixelCount: " + result.pixelCount( 0 , 0 )  );