CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

connectedComponentsLabelingBox

Performs connected components analysis inspecting the box neighborhood of every pixel to a binary image and generates a label map.

Category: Labels

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

connectedComponentsLabelingBox often follows after

connectedComponentsLabelingBox is often followed by

Usage in ImageJ macro

Ext.CLIJ2_connectedComponentsLabelingBox(Image binary_input, Image labeling_destination);

Usage in object oriented programming languages

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

// get input parameters
ClearCLBuffer binary_input = clij2.push(binary_inputImagePlus);
labeling_destination = clij2.create(binary_input);
// Execute operation on GPU
clij2.connectedComponentsLabelingBox(binary_input, labeling_destination);
// show result
labeling_destinationImagePlus = clij2.pull(labeling_destination);
labeling_destinationImagePlus.show();

// cleanup memory on GPU
clij2.release(binary_input);
clij2.release(labeling_destination);
Matlab
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
binary_input = clij2.pushMat(binary_input_matrix);
labeling_destination = clij2.create(binary_input);
% Execute operation on GPU
clij2.connectedComponentsLabelingBox(binary_input, labeling_destination);
% show result
labeling_destination = clij2.pullMat(labeling_destination)

% cleanup memory on GPU
clij2.release(binary_input);
clij2.release(labeling_destination);
Icy JavaScript
// init CLIJ and GPU
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);

clij2 = CLICY.getInstance();

// get input parameters
binary_input_sequence = getSequence();
binary_input = clij2.pushSequence(binary_input_sequence);
labeling_destination = clij2.create(binary_input);
// Execute operation on GPU
clij2.connectedComponentsLabelingBox(binary_input, labeling_destination);
// show result
labeling_destination_sequence = clij2.pullSequence(labeling_destination)
Icy.addSequence(labeling_destination_sequence);
// cleanup memory on GPU
clij2.release(binary_input);
clij2.release(labeling_destination);
clEsperanto Python (experimental)
import pyclesperanto_prototype as cle

cle.connected_components_labeling_box(binary_input, labeling_destination)

Example notebooks

count_overlap_between_channels
custom_clij_macro_functions
image_types
labeling
labelmap_voronoi
mean_of_touching_neighbors
outlines_numbers_overlay
working_with_rois
count_blobs.ipynb
spots_pointlists_matrices_tables.ipynb
napari_dask.ipynb
parametric_maps.ipynb
tribolium_morphometry.ipynb

Example scripts

count_overlap_between_channels.ijm
custom_clij_macro_functions.ijm
division_visualisation.ijm
image_types.ijm
jaccard_matrix.ijm
labeling.ijm
labelmap_voronoi.ijm
mean_of_touching_neighbors.ijm
outlines_numbers_overlay.ijm
working_with_rois.ijm
count_blobs.py
napari_.py
napari_magicgui.py
tribolium.py

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint