ImageDev

RemoveIslands

Remove areas of connected voxels (islands) less than or equal to a specified size.

Access to parameter description

The removed islands are merged with the label that surrounds them. If all voxels that have a boundary with the island belong to a single material then the island voxels are assigned to this material.
If there are two or more materials around the island (several neighbor islands), the decision to merge or not the island depends to the removalPolicy.
In the SINGLE_NEIGHBOR case, the island is merged only if it is surrounded by a single material.
In the DOMINANT_LABEL case, the island is merged with the most present material around it if this material represents more than borderPercentage of the island boundary.

Note: the DOMINANT_LABEL option uses an histogram to determine the most present label around the island. For this reason, it shows the same limitations as the histogram based algorithms: an image with labels of very high values may lead to processing issues. It is then recommended to reorder the labels before using this algorithm with the ReorderLabels algorithm.

Function Syntax

This function returns outputObjectImage.
// Function prototype
std::shared_ptr< iolink::ImageView > removeIslands( std::shared_ptr< iolink::ImageView > inputObjectImage, uint32_t islandSize, RemoveIslands::RemovalPolicy removalPolicy, uint32_t borderPercentage, std::shared_ptr< iolink::ImageView > outputObjectImage = nullptr );
This function returns outputObjectImage.
// Function prototype.
remove_islands(input_object_image: idt.ImageType,
               island_size: int = 100,
               removal_policy: Union[Literal["SINGLE_NEIGHBOR"],Literal["DOMINANT_LABEL"],RemoveIslands.RemovalPolicy] = RemoveIslands.RemovalPolicy.SINGLE_NEIGHBOR,
               border_percentage: int = 25,
               output_object_image: idt.ImageType = None) -> idt.ImageType
This function returns outputObjectImage.
// Function prototype.
public static IOLink.ImageView
RemoveIslands( IOLink.ImageView inputObjectImage,
               UInt32 islandSize = 100,
               RemoveIslands.RemovalPolicy removalPolicy = ImageDev.RemoveIslands.RemovalPolicy.SINGLE_NEIGHBOR,
               UInt32 borderPercentage = 25,
               IOLink.ImageView outputObjectImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputObjectImage
The input binary or label image. Image Binary, Label or Grayscale nullptr
input
islandSize
The maximum size in pixels of islands to remove. UInt32 Any value 100
input
removalPolicy
The strategy to merge the selected islands.
Value Description
SINGLE_NEIGHBOR Only islands surrounded by a single label or background are removed.
DOMINANT_LABEL When several labels are surrounding an island, the most present along the border is selected as candidate for replacing the island value. The background (0) is not considered as a material in this case excepted if it is the only surrounding value.
The borderPercentage parameter is used to decide if the island is merged or preserved.
Enumeration SINGLE_NEIGHBOR
input
borderPercentage
The percentage of border to share with a neighbor before merging it. UInt32 <=100 25
output
outputObjectImage
The output image. Its dimensions, type, interpretation, and calibration are forced to the same values as the input. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_object_image
The input binary or label image. image Binary, Label or Grayscale None
input
island_size
The maximum size in pixels of islands to remove. uint32 Any value 100
input
removal_policy
The strategy to merge the selected islands.
Value Description
SINGLE_NEIGHBOR Only islands surrounded by a single label or background are removed.
DOMINANT_LABEL When several labels are surrounding an island, the most present along the border is selected as candidate for replacing the island value. The background (0) is not considered as a material in this case excepted if it is the only surrounding value.
The borderPercentage parameter is used to decide if the island is merged or preserved.
enumeration SINGLE_NEIGHBOR
input
border_percentage
The percentage of border to share with a neighbor before merging it. uint32 <=100 25
output
output_object_image
The output image. Its dimensions, type, interpretation, and calibration are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputObjectImage
The input binary or label image. Image Binary, Label or Grayscale null
input
islandSize
The maximum size in pixels of islands to remove. UInt32 Any value 100
input
removalPolicy
The strategy to merge the selected islands.
Value Description
SINGLE_NEIGHBOR Only islands surrounded by a single label or background are removed.
DOMINANT_LABEL When several labels are surrounding an island, the most present along the border is selected as candidate for replacing the island value. The background (0) is not considered as a material in this case excepted if it is the only surrounding value.
The borderPercentage parameter is used to decide if the island is merged or preserved.
Enumeration SINGLE_NEIGHBOR
input
borderPercentage
The percentage of border to share with a neighbor before merging it. UInt32 <=100 25
output
outputObjectImage
The output image. Its dimensions, type, interpretation, and calibration are forced to the same values as the input. Image null

Object Examples

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

RemoveIslands removeIslandsAlgo;
removeIslandsAlgo.setInputObjectImage( foam_sep_label );
removeIslandsAlgo.setIslandSize( 100 );
removeIslandsAlgo.setRemovalPolicy( RemoveIslands::RemovalPolicy::SINGLE_NEIGHBOR );
removeIslandsAlgo.setBorderPercentage( 25 );
removeIslandsAlgo.execute();

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

remove_islands_algo = imagedev.RemoveIslands()
remove_islands_algo.input_object_image = foam_sep_label
remove_islands_algo.island_size = 100
remove_islands_algo.removal_policy = imagedev.RemoveIslands.SINGLE_NEIGHBOR
remove_islands_algo.border_percentage = 25
remove_islands_algo.execute()

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

RemoveIslands removeIslandsAlgo = new RemoveIslands
{
    inputObjectImage = foam_sep_label,
    islandSize = 100,
    removalPolicy = RemoveIslands.RemovalPolicy.SINGLE_NEIGHBOR,
    borderPercentage = 25
};
removeIslandsAlgo.Execute();

Console.WriteLine( "outputObjectImage:" + removeIslandsAlgo.outputObjectImage.ToString() );

Function Examples

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

auto result = removeIslands( foam_sep_label, 100, RemoveIslands::RemovalPolicy::SINGLE_NEIGHBOR, 25 );

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

result = imagedev.remove_islands(foam_sep_label, 100, imagedev.RemoveIslands.SINGLE_NEIGHBOR, 25)

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

IOLink.ImageView result = Processing.RemoveIslands( foam_sep_label, 100, RemoveIslands.RemovalPolicy.SINGLE_NEIGHBOR, 25 );

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



© 2026 Thermo Fisher Scientific Inc. All rights reserved.