ImageDev

LabelInterfaces

Generates a binary image containing points having a minimum number of different neighbors in a label input image.

Access to parameter description

This algorithm computes all points of a label image that have at least a user-defined number of different neighbors (label value greater than 0). Then this algorithm generates a binary image highlighting all these points.
This algorithm can search points everywhere in the input image or only in the background (where intensity equals 0), which is useful for boundaries of a MarkerBasedWatershed result image.

See also

Function Syntax

This function returns the outputBinaryImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
labelInterfaces( std::shared_ptr< iolink::ImageView > inputLabelImage,
                 int32_t phaseNumber,
                 LabelInterfaces::OnlyBlackVoxels onlyBlackVoxels,
                 LabelInterfaces::Neighborhood neighborhood,
                 std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );
This function returns the outputBinaryImage output parameter.
// Function prototype.
label_interfaces( input_label_image,
                  phase_number = 3,
                  only_black_voxels = LabelInterfaces.OnlyBlackVoxels.YES,
                  neighborhood = LabelInterfaces.Neighborhood.CONNECTIVITY_26,
                  output_binary_image = None )
This function returns the outputBinaryImage output parameter.
// Function prototype.
public static IOLink.ImageView
LabelInterfaces( IOLink.ImageView inputLabelImage,
                 Int32 phaseNumber = 3,
                 LabelInterfaces.OnlyBlackVoxels onlyBlackVoxels = ImageDev.LabelInterfaces.OnlyBlackVoxels.YES,
                 LabelInterfaces.Neighborhood neighborhood = ImageDev.LabelInterfaces.Neighborhood.CONNECTIVITY_26,
                 IOLink.ImageView outputBinaryImage = null );

Class Syntax

Parameters

Class Name LabelInterfaces

Parameter Name Description Type Supported Values Default Value
input
inputLabelImage
The input label image. Image Label nullptr
input
phaseNumber
The minimum number of different neighbor labels to select a point. Int32 >=0 3
input
onlyBlackVoxels
The way to look for interface points.
NO Interface points are searched everywhere in the input iamge.
YES Interface points are searched only in the image background (where intensity equals 0).
Enumeration YES
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
outputBinaryImage
The output binary image. Its dimensions are forced to the same values as the input. Image nullptr

Object Examples

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

LabelInterfaces labelInterfacesAlgo;
labelInterfacesAlgo.setInputLabelImage( foam_sep_label );
labelInterfacesAlgo.setPhaseNumber( 3 );
labelInterfacesAlgo.setOnlyBlackVoxels( LabelInterfaces::OnlyBlackVoxels::YES );
labelInterfacesAlgo.setNeighborhood( LabelInterfaces::Neighborhood::CONNECTIVITY_26 );
labelInterfacesAlgo.execute();

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

label_interfaces_algo = imagedev.LabelInterfaces()
label_interfaces_algo.input_label_image = foam_sep_label
label_interfaces_algo.phase_number = 3
label_interfaces_algo.only_black_voxels = imagedev.LabelInterfaces.YES
label_interfaces_algo.neighborhood = imagedev.LabelInterfaces.CONNECTIVITY_26
label_interfaces_algo.execute()

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

LabelInterfaces labelInterfacesAlgo = new LabelInterfaces
{
    inputLabelImage = foam_sep_label,
    phaseNumber = 3,
    onlyBlackVoxels = LabelInterfaces.OnlyBlackVoxels.YES,
    neighborhood = LabelInterfaces.Neighborhood.CONNECTIVITY_26
};
labelInterfacesAlgo.Execute();

Console.WriteLine( "outputBinaryImage:" + labelInterfacesAlgo.outputBinaryImage.ToString() );

Function Examples

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

auto result = labelInterfaces( foam_sep_label, 3, LabelInterfaces::OnlyBlackVoxels::YES, LabelInterfaces::Neighborhood::CONNECTIVITY_26 );

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

result = imagedev.label_interfaces( foam_sep_label, 3, imagedev.LabelInterfaces.YES, imagedev.LabelInterfaces.CONNECTIVITY_26 )

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

IOLink.ImageView result = Processing.LabelInterfaces( foam_sep_label, 3, LabelInterfaces.OnlyBlackVoxels.YES, LabelInterfaces.Neighborhood.CONNECTIVITY_26 );

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