CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

excludeLabels

This operation removes labels from a labelmap and renumbers the remaining labels.

Hand over a binary flag list vector starting with a flag for the background, continuing with label1, label2, …

For example if you pass 0,1,0,0,1: Labels 1 and 4 will be removed (those with a 1 in the vector will be excluded). Labels 2 and 3 will be kept and renumbered to 1 and 2.

excludeLabels often follows after

Usage in ImageJ macro

Ext.CLIJ2_excludeLabels(Image binary_flaglist, Image label_map_input, Image label_map_destination);

Usage in Java

clij2.excludeLabels(binary_flaglist, label_map_input, label_map_destination);
// init CLIJ and GPU
import net.haesleinhuepf.clij2.CLIJ2;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ2 clij2 = CLIJ2.getInstance();

// get input parameters
ClearCLBuffer binary_flaglist = clij2.push(binary_flaglistImagePlus);
ClearCLBuffer label_map_input = clij2.push(label_map_inputImagePlus);
label_map_destination = clij2.create(binary_flaglist);
// Execute operation on GPU
clij2.excludeLabels(binary_flaglist, label_map_input, label_map_destination);
//show result
label_map_destinationImagePlus = clij2.pull(label_map_destination);
label_map_destinationImagePlus.show();

// cleanup memory on GPU
clij2.release(binary_flaglist);
clij2.release(label_map_input);
clij2.release(label_map_destination);

Usage in Matlab

clij2.excludeLabels(binary_flaglist, label_map_input, label_map_destination);
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
binary_flaglist = clij2.pushMat(binary_flaglist_matrix);
label_map_input = clij2.pushMat(label_map_input_matrix);
label_map_destination = clij2.create(binary_flaglist);
% Execute operation on GPU
clij2.excludeLabels(binary_flaglist, label_map_input, label_map_destination);
% show result
label_map_destination = clij2.pullMat(label_map_destination)

% cleanup memory on GPU
clij2.release(binary_flaglist);
clij2.release(label_map_input);
clij2.release(label_map_destination);

Usage in Icy

clij2.excludeLabels(binary_flaglist, label_map_input, label_map_destination);
// init CLIJ and GPU
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);

clij2 = CLICY.getInstance();

// get input parameters
binary_flaglist_sequence = getSequence();
binary_flaglist = clij2.pushSequence(binary_flaglist_sequence);
label_map_input_sequence = getSequence();
label_map_input = clij2.pushSequence(label_map_input_sequence);
label_map_destination = clij2.create(binary_flaglist);
// Execute operation on GPU
clij2.excludeLabels(binary_flaglist, label_map_input, label_map_destination);
// show result
label_map_destination_sequence = clij2.pullSequence(label_map_destination)
Icy.addSequence(label_map_destination_sequence);
// cleanup memory on GPU
clij2.release(binary_flaglist);
clij2.release(label_map_input);
clij2.release(label_map_destination);

Example notebooks

labeling
superpixel_segmentation

Example scripts

excludeLabelsOnEdges.ijm
excludeLabelsWithinRange.ijm
filter_label_maps.ijm
labeling.ijm
superpixel_segmentation.ijm
segmentation.py

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint