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.
// Function prototype.publicstaticIOLink.ImageViewAssignLabel(IOLink.ImageView inputBinaryImage,Int32 labelValue =1,IOLink.ImageView outputLabelImage =null);
Class Syntax
// Command constructor.AssignLabel();/// Gets the inputBinaryImage parameter./// The input binary image.
std::shared_ptr< iolink::ImageView> inputBinaryImage()const;/// Sets the inputBinaryImage parameter./// The input binary image.void setInputBinaryImage( std::shared_ptr< iolink::ImageView> inputBinaryImage );/// Gets the labelValue parameter./// The label value to assign.int32_t labelValue()const;/// Sets the labelValue parameter./// The label value to assign.void setLabelValue(constint32_t& labelValue );/// Gets the outputLabelImage parameter./// The output label image. Its dimensions are forced to the same values as the input.
std::shared_ptr< iolink::ImageView> outputLabelImage()const;/// Sets the outputLabelImage parameter./// The output label image. Its dimensions are forced to the same values as the input.void setOutputLabelImage( std::shared_ptr< iolink::ImageView> outputLabelImage );// Method to launch the command.void execute();
# Property of the inputBinaryImage parameter.AssignLabel.input_binary_image
# Property of the labelValue parameter.AssignLabel.label_value
# Property of the outputLabelImage parameter.AssignLabel.output_label_image
// Method to launch the command.
execute()
// Command constructor.AssignLabel()// Property of the inputBinaryImage parameter.AssignLabel.inputBinaryImage
// Property of the labelValue parameter.AssignLabel.labelValue
// Property of the outputLabelImage parameter.AssignLabel.outputLabelImage
// Method to launch the command.Execute()
Parameters
Parameter Name
Description
Type
Supported Values
Default Value
inputBinaryImage
The input binary image.
Image
Binary
nullptr
labelValue
The label value to assign.
Int32
>=1
1
outputLabelImage
The output label image. Its dimensions are forced to the same values as the input.
Image
nullptr
Parameter Name
Description
Type
Supported Values
Default Value
input_binary_image
The input binary image.
image
Binary
None
label_value
The label value to assign.
int32
>=1
1
output_label_image
The output label image. Its dimensions are forced to the same values as the input.
image
None
Parameter Name
Description
Type
Supported Values
Default Value
inputBinaryImage
The input binary image.
Image
Binary
null
labelValue
The label value to assign.
Int32
>=1
1
outputLabelImage
The output label image. Its dimensions are forced to the same values as the input.
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());