ReorderLabels
Forces values of a label image to be consecutive.
Access to parameter description
When a label image contains missing values in its histogram, it is not always possible to reassign consecutive labels automatically using the labeling algorithm, as shown in Figure 1.
By definition, it assigns a unique value to each connected component.
ReorderLabels fills the missing values of the histogram while preserving the original connectivity of the input labels.
Figure 1. Effects of the label reordering algorithm: (a) input label image,@Br
(b) output of the labeling algorithm, (c) output of the ReorderLabels algorithm
See also
Access to parameter description
When a label image contains missing values in its histogram, it is not always possible to reassign consecutive labels automatically using the labeling algorithm, as shown in Figure 1.
By definition, it assigns a unique value to each connected component.
ReorderLabels fills the missing values of the histogram while preserving the original connectivity of the input labels.
![]() (a) |
![]() (b) |
![]() (c) |
See also
Function Syntax
This function returns outputLabelImage.
// Function prototype
std::shared_ptr< iolink::ImageView > reorderLabels( std::shared_ptr< iolink::ImageView > inputLabelImage, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputLabelImage |
The input label image. | Image | Label | nullptr |
![]() |
outputLabelImage |
The output label image. Its dimensions and type 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" ); ReorderLabels reorderLabelsAlgo; reorderLabelsAlgo.setInputLabelImage( foam_sep_label ); reorderLabelsAlgo.execute(); std::cout << "outputLabelImage:" << reorderLabelsAlgo.outputLabelImage()->toString();
Function Examples
auto foam_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep_label.vip" ); auto result = reorderLabels( foam_sep_label ); std::cout << "outputLabelImage:" << result->toString();