CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

shrinkLabels

Extend labels with a given radius.

This is actually a local minimum filter applied to a label map after introducing background-gaps between labels. In case relabel_islands is set, split objects will get new labels each. In this case, more labels might be in the result. It is recommended to apply this operation to isotropic images only. Warning: If labels were too small, they may be missing in the resulting label image.

Categories: Filter, Labels

Availability: Available in Fiji by activating the update sites clij and clij2. This function is part of clijx_-0.30.1.21.jar.

Usage in ImageJ macro

Ext.CLIJx_shrinkLabels(Image labels_input, Image labels_destination, Number radius, Boolean relabel_islands);

Usage in object oriented programming languages

Java
// init CLIJ and GPU
import net.haesleinhuepf.clijx.CLIJx;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJx clijx = CLIJx.getInstance();

// get input parameters
ClearCLBuffer labels_input = clijx.push(labels_inputImagePlus);
labels_destination = clijx.create(labels_input);
int radius = 10;
boolean relabel_islands = true;
// Execute operation on GPU
clijx.shrinkLabels(labels_input, labels_destination, radius, relabel_islands);
// show result
labels_destinationImagePlus = clijx.pull(labels_destination);
labels_destinationImagePlus.show();

// cleanup memory on GPU
clijx.release(labels_input);
clijx.release(labels_destination);
Matlab
% init CLIJ and GPU
clijx = init_clatlabx();

% get input parameters
labels_input = clijx.pushMat(labels_input_matrix);
labels_destination = clijx.create(labels_input);
radius = 10;
relabel_islands = true;
% Execute operation on GPU
clijx.shrinkLabels(labels_input, labels_destination, radius, relabel_islands);
% show result
labels_destination = clijx.pullMat(labels_destination)

% cleanup memory on GPU
clijx.release(labels_input);
clijx.release(labels_destination);

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint