ImageDev

ExpandLabelsOnBackground

Performs an iterative dilation of a label image, until the entire background is filled by labels.

Access to parameter description

For an introduction: This algorithms performs an iterative dilation of a label image. The process stops when the complete image is covered by labels.
It works with 2D and 3D images.

<b>(a)</b>
(a)
<b>(b)</b>
(b)
Figure 1. Example of label expansion on background: (a) input label image, (b) image after label expansion


See also

Function Syntax

This function returns the outputLabelImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
expandLabelsOnBackground( std::shared_ptr< iolink::ImageView > inputLabelImage,
                          ExpandLabelsOnBackground::Neighborhood neighborhood,
                          std::shared_ptr< iolink::ImageView > outputLabelImage = NULL );
This function returns the outputLabelImage output parameter.
// Function prototype.
expand_labels_on_background( input_label_image, neighborhood = ExpandLabelsOnBackground.Neighborhood.CONNECTIVITY_26, output_label_image = None )
This function returns the outputLabelImage output parameter.
// Function prototype.
public static IOLink.ImageView
ExpandLabelsOnBackground( IOLink.ImageView inputLabelImage,
                          ExpandLabelsOnBackground.Neighborhood neighborhood = ImageDev.ExpandLabelsOnBackground.Neighborhood.CONNECTIVITY_26,
                          IOLink.ImageView outputLabelImage = null );

Class Syntax

Parameters

Class Name ExpandLabelsOnBackground

Parameter Name Description Type Supported Values Default Value
input
inputLabelImage
The input label image. Image Label nullptr
input
neighborhood
The 3D neighborhood configuration. This parameter is ignored with a 2D input image.
CONNECTIVITY_6 The structuring element is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18 The structuring element is composed of voxels with at least one common edge.
CONNECTIVITY_26 The structuring element is a full cube.
Enumeration CONNECTIVITY_26
output
outputLabelImage
The output label image. Its dimensions are forced to the same values as the input image. Image nullptr

Object Examples

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

ExpandLabelsOnBackground expandLabelsOnBackgroundAlgo;
expandLabelsOnBackgroundAlgo.setInputLabelImage( foam_sep_label );
expandLabelsOnBackgroundAlgo.setNeighborhood( ExpandLabelsOnBackground::Neighborhood::CONNECTIVITY_26 );
expandLabelsOnBackgroundAlgo.execute();

std::cout << "outputLabelImage:" << expandLabelsOnBackgroundAlgo.outputLabelImage()->toString();
foam_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep_label.vip"))

expand_labels_on_background_algo = imagedev.ExpandLabelsOnBackground()
expand_labels_on_background_algo.input_label_image = foam_sep_label
expand_labels_on_background_algo.neighborhood = imagedev.ExpandLabelsOnBackground.CONNECTIVITY_26
expand_labels_on_background_algo.execute()

print( "output_label_image:", str( expand_labels_on_background_algo.output_label_image ) )
ImageView foam_sep_label = Data.ReadVipImage( @"Data/images/foam_sep_label.vip" );

ExpandLabelsOnBackground expandLabelsOnBackgroundAlgo = new ExpandLabelsOnBackground
{
    inputLabelImage = foam_sep_label,
    neighborhood = ExpandLabelsOnBackground.Neighborhood.CONNECTIVITY_26
};
expandLabelsOnBackgroundAlgo.Execute();

Console.WriteLine( "outputLabelImage:" + expandLabelsOnBackgroundAlgo.outputLabelImage.ToString() );

Function Examples

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

auto result = expandLabelsOnBackground( foam_sep_label, ExpandLabelsOnBackground::Neighborhood::CONNECTIVITY_26 );

std::cout << "outputLabelImage:" << result->toString();
foam_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep_label.vip"))

result = imagedev.expand_labels_on_background( foam_sep_label, imagedev.ExpandLabelsOnBackground.CONNECTIVITY_26 )

print( "output_label_image:", str( result ) )
ImageView foam_sep_label = Data.ReadVipImage( @"Data/images/foam_sep_label.vip" );

IOLink.ImageView result = Processing.ExpandLabelsOnBackground( foam_sep_label, ExpandLabelsOnBackground.Neighborhood.CONNECTIVITY_26 );

Console.WriteLine( "outputLabelImage:" + result.ToString() );