ImageDev

AssignLabel

Converts a binary image into a label image by changing its intensity values to a specific value.

Access to parameter description

This algorithm is used to assign a user-defined label value to a binary image.

A label image may be 8, 16 or 32 bits per pixel. By default the result of this algorithm is a 16-bit label image, but if the number of labels exceeds 65,535 then the output image is automatically converted to 32-bit type, and thus can manage more than two billion labels.

See also

Function Syntax

This function returns the outputLabelImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
assignLabel( std::shared_ptr< iolink::ImageView > inputBinaryImage,
             int32_t labelValue,
             std::shared_ptr< iolink::ImageView > outputLabelImage = NULL );
This function returns the outputLabelImage output parameter.
// Function prototype.
assign_label( input_binary_image, label_value = 1, output_label_image = None )
This function returns the outputLabelImage output parameter.
// Function prototype.
public static IOLink.ImageView
AssignLabel( IOLink.ImageView inputBinaryImage,
             Int32 labelValue = 1,
             IOLink.ImageView outputLabelImage = null );

Class Syntax

Parameters

Class Name AssignLabel

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The input binary image. Image Binary nullptr
input
labelValue
The label value to assign. Int32 >=1 1
output
outputLabelImage
The output label image. Its dimensions are forced to the same values as the input. Image nullptr

Object Examples

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

AssignLabel assignLabelAlgo;
assignLabelAlgo.setInputBinaryImage( polystyrene_sep );
assignLabelAlgo.setLabelValue( 1 );
assignLabelAlgo.execute();

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

assign_label_algo = imagedev.AssignLabel()
assign_label_algo.input_binary_image = polystyrene_sep
assign_label_algo.label_value = 1
assign_label_algo.execute()

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

AssignLabel assignLabelAlgo = new AssignLabel
{
    inputBinaryImage = polystyrene_sep,
    labelValue = 1
};
assignLabelAlgo.Execute();

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

Function Examples

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

auto result = assignLabel( polystyrene_sep, 1 );

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

result = imagedev.assign_label( polystyrene_sep, 1 )

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

IOLink.ImageView result = Processing.AssignLabel( polystyrene_sep, 1 );

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