ImageDev

LabelCountByRegion

Computes, for each region of a first label image, the number of objects contained in a second label image.

Access to parameter description

This algorithm can be used, for instance, to compute the number of markers contained in each cell of a life science image, or the number of inclusions in each phase of a material science image.
If the region image is a binary image, it is considered as a single region and the algorithm amounts to computing the number of objects masked by this image.
If the region image is a label image, the number of objects is given for each label of the region image.

See also

Function Syntax

This function returns outputMeasurement.
// Function prototype
LabelCountByRegionMsr::Ptr labelCountByRegion( std::shared_ptr< iolink::ImageView > inputObjectImage, std::shared_ptr< iolink::ImageView > inputLabelImage, LabelCountByRegionMsr::Ptr outputMeasurement = NULL );
This function returns outputMeasurement.
// Function prototype.
label_count_by_region( input_object_image, input_label_image, output_measurement = None )
This function returns outputMeasurement.
// Function prototype.
public static LabelCountByRegionMsr
LabelCountByRegion( IOLink.ImageView inputObjectImage,
                    IOLink.ImageView inputLabelImage,
                    LabelCountByRegionMsr outputMeasurement = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputObjectImage
The input binary or label image representing the regions to be analyzed. Image Binary or Label nullptr
input
inputLabelImage
The input label image containing the particles to be counted. This image must have same dimensions as the region input image. Image Label nullptr
output
outputMeasurement
The output measurement result providing one count per region. LabelCountByRegionMsr nullptr
Parameter Name Description Type Supported Values Default Value
input
input_object_image
The input binary or label image representing the regions to be analyzed. image Binary or Label None
input
input_label_image
The input label image containing the particles to be counted. This image must have same dimensions as the region input image. image Label None
output
output_measurement
The output measurement result providing one count per region. LabelCountByRegionMsr None
Parameter Name Description Type Supported Values Default Value
input
inputObjectImage
The input binary or label image representing the regions to be analyzed. Image Binary or Label null
input
inputLabelImage
The input label image containing the particles to be counted. This image must have same dimensions as the region input image. Image Label null
output
outputMeasurement
The output measurement result providing one count per region. LabelCountByRegionMsr null

Object Examples

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

LabelCountByRegion labelCountByRegionAlgo;
labelCountByRegionAlgo.setInputObjectImage( polystyrene_sep_label );
labelCountByRegionAlgo.setInputLabelImage( polystyrene_sep_label );
labelCountByRegionAlgo.execute();

std::cout << "region: " << labelCountByRegionAlgo.outputMeasurement()->region( 0 ) ;
polystyrene_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep_label.vip"))

label_count_by_region_algo = imagedev.LabelCountByRegion()
label_count_by_region_algo.input_object_image = polystyrene_sep_label
label_count_by_region_algo.input_label_image = polystyrene_sep_label
label_count_by_region_algo.execute()

print( "region: ", str( label_count_by_region_algo.output_measurement.region( 0 ) ) )
ImageView polystyrene_sep_label = Data.ReadVipImage( @"Data/images/polystyrene_sep_label.vip" );

LabelCountByRegion labelCountByRegionAlgo = new LabelCountByRegion
{
    inputObjectImage = polystyrene_sep_label,
    inputLabelImage = polystyrene_sep_label
};
labelCountByRegionAlgo.Execute();

Console.WriteLine( "region: " + labelCountByRegionAlgo.outputMeasurement.region( 0 ) );

Function Examples

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

auto result = labelCountByRegion( polystyrene_sep_label, polystyrene_sep_label );

std::cout << "region: " << result->region( 0 ) ;
polystyrene_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep_label.vip"))

result = imagedev.label_count_by_region( polystyrene_sep_label, polystyrene_sep_label )

print( "region: ", str( result.region( 0 ) )  )
ImageView polystyrene_sep_label = Data.ReadVipImage( @"Data/images/polystyrene_sep_label.vip" );

LabelCountByRegionMsr result = Processing.LabelCountByRegion( polystyrene_sep_label, polystyrene_sep_label );

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