CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

centroidsOfLabels

Determines the centroids of all labels in a label image or image stack.

It writes the resulting coordinates in a pointlist image. Depending on the dimensionality d of the labelmap and the number of labels n, the pointlist image will have n*d pixels.

Category: Measurements

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

centroidsOfLabels often follows after

centroidsOfLabels is often followed by

Usage in ImageJ macro

Ext.CLIJ2_centroidsOfLabels(Image source, Image pointlist_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 source = clij2.push(sourceImagePlus);
pointlist_destination = clij2.create(source);
// Execute operation on GPU
clij2.centroidsOfLabels(source, pointlist_destination);
// show result
pointlist_destinationImagePlus = clij2.pull(pointlist_destination);
pointlist_destinationImagePlus.show();

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

% get input parameters
source = clij2.pushMat(source_matrix);
pointlist_destination = clij2.create(source);
% Execute operation on GPU
clij2.centroidsOfLabels(source, pointlist_destination);
% show result
pointlist_destination = clij2.pullMat(pointlist_destination)

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

clij2 = CLICY.getInstance();

// get input parameters
source_sequence = getSequence();
source = clij2.pushSequence(source_sequence);
pointlist_destination = clij2.create(source);
// Execute operation on GPU
clij2.centroidsOfLabels(source, pointlist_destination);
// show result
pointlist_destination_sequence = clij2.pullSequence(pointlist_destination)
Icy.addSequence(pointlist_destination_sequence);
// cleanup memory on GPU
clij2.release(source);
clij2.release(pointlist_destination);
clEsperanto Python (experimental)
import pyclesperanto_prototype as cle

cle.centroids_of_labels(source, pointlist_destination)

Example notebooks

tables
shape_descriptors_based_on_neighborhood_graphs.ipynb
benchmarking_centroids_of_labels.ipynb

Example scripts

centroid_visualisation.ijm
tables.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint