ImageDev

VolumeFractionByRegion

Computes, for each region of a first label image, the intersection ratio with particles of a second label image.

Access to parameter description

This algorithm computes the intersection ratio of a particle in a given region.
$IR(P, R)= \frac{A(R\cap P)}{A(P)}$
Where $IR$ is the intersection ratio, $A$ the number of pixels (area in the 2D case, volume in 3D), $R$ a given region and $P$ a given particle.

For example, it can be used in digital rock analysis by setting a ganglia segmentation as region input (object image) and a pore segmentation as particle input (label image). If the ganglia segmentation is oil and water, one can get the percentage of oil and water per pore.

Result is a two-dimensional array where the first index refers to particles and the second index to regions. For regions, index 0 refers to the background (pixels having an intensity equal to 0). For particles, index 0 refers to the first label (pixels having an intensity equal to 1).

See also

Function Syntax

This function returns the outputMeasurement output parameter.
// Function prototype.
VolumeFractionByRegionMsr::Ptr
volumeFractionByRegion( std::shared_ptr< iolink::ImageView > inputObjectImage,
                        std::shared_ptr< iolink::ImageView > inputLabelImage,
                        VolumeFractionByRegionMsr::Ptr outputMeasurement = NULL );
This function returns the outputMeasurement output parameter.
// Function prototype.
volume_fraction_by_region( input_object_image, input_label_image, output_measurement = None )
This function returns the outputMeasurement output parameter.
// Function prototype.
public static VolumeFractionByRegionMsr
VolumeFractionByRegion( IOLink.ImageView inputObjectImage,
                        IOLink.ImageView inputLabelImage,
                        VolumeFractionByRegionMsr outputMeasurement = null );

Class Syntax

Parameters

Class Name VolumeFractionByRegion

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 intersected with regions. This image must have same dimensions as the region input image. Image Label nullptr
output
outputMeasurement
The output measurement result providing the intersection ratio between each region and particle. VolumeFractionByRegionMsr nullptr

Object Examples

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

VolumeFractionByRegion volumeFractionByRegionAlgo;
volumeFractionByRegionAlgo.setInputObjectImage( polystyrene_sep_label );
volumeFractionByRegionAlgo.setInputLabelImage( polystyrene_sep_label );
volumeFractionByRegionAlgo.execute();

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

volume_fraction_by_region_algo = imagedev.VolumeFractionByRegion()
volume_fraction_by_region_algo.input_object_image = polystyrene_sep_label
volume_fraction_by_region_algo.input_label_image = polystyrene_sep_label
volume_fraction_by_region_algo.execute()

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

VolumeFractionByRegion volumeFractionByRegionAlgo = new VolumeFractionByRegion
{
    inputObjectImage = polystyrene_sep_label,
    inputLabelImage = polystyrene_sep_label
};
volumeFractionByRegionAlgo.Execute();

Console.WriteLine( "intersectionRatio: " + volumeFractionByRegionAlgo.outputMeasurement.intersectionRatio( 0 , 0 ) );

Function Examples

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

auto result = volumeFractionByRegion( polystyrene_sep_label, polystyrene_sep_label );

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

result = imagedev.volume_fraction_by_region( polystyrene_sep_label, polystyrene_sep_label )

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

VolumeFractionByRegionMsr result = Processing.VolumeFractionByRegion( polystyrene_sep_label, polystyrene_sep_label );

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