ImageDev

RegionSimilarity

Computes similarity values between the regions from two label images.

Access to parameter description

This algorithm allows the comparison of a segmented image with a ground truth in order to assess the accuracy of a segmentation process; for instance, a classification by machine learning. It outputs three statistical indicators for each label value: $$ Dice= \frac{2TP}{2TP+FP+FN} $$ where See also

Function Syntax

This function returns outputMeasurement.
// Function prototype
RegionSimilarityMsr::Ptr regionSimilarity( std::shared_ptr< iolink::ImageView > inputLabelImage, std::shared_ptr< iolink::ImageView > inputReferenceImage, RegionSimilarityMsr::Ptr outputMeasurement = NULL );
This function returns outputMeasurement.
// Function prototype.
region_similarity( input_label_image, input_reference_image, output_measurement = None )
This function returns outputMeasurement.
// Function prototype.
public static RegionSimilarityMsr
RegionSimilarity( IOLink.ImageView inputLabelImage,
                  IOLink.ImageView inputReferenceImage,
                  RegionSimilarityMsr outputMeasurement = null );

Class Syntax

Parameters

Class Name RegionSimilarity

Parameter Name Description Type Supported Values Default Value
input
inputLabelImage
The segmented image to assess. Image Label nullptr
input
inputReferenceImage
The ground truth image. This image must have same dimensions and type as the main input image. Image Label nullptr
output
outputMeasurement
The similarity results. RegionSimilarityMsr nullptr

Object Examples

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

RegionSimilarity regionSimilarityAlgo;
regionSimilarityAlgo.setInputLabelImage( polystyrene_sep_label );
regionSimilarityAlgo.setInputReferenceImage( polystyrene_sep_label );
regionSimilarityAlgo.execute();

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

region_similarity_algo = imagedev.RegionSimilarity()
region_similarity_algo.input_label_image = polystyrene_sep_label
region_similarity_algo.input_reference_image = polystyrene_sep_label
region_similarity_algo.execute()

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

RegionSimilarity regionSimilarityAlgo = new RegionSimilarity
{
    inputLabelImage = polystyrene_sep_label,
    inputReferenceImage = polystyrene_sep_label
};
regionSimilarityAlgo.Execute();

Console.WriteLine( "sensitivity: " + regionSimilarityAlgo.outputMeasurement.sensitivity( 0 ) );

Function Examples

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

auto result = regionSimilarity( polystyrene_sep_label, polystyrene_sep_label );

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

result = imagedev.region_similarity( polystyrene_sep_label, polystyrene_sep_label )

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

RegionSimilarityMsr result = Processing.RegionSimilarity( polystyrene_sep_label, polystyrene_sep_label );

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