Skip to content

Latest commit

 

History

History
133 lines (90 loc) · 3.17 KB

reference_centroidsOfLabels.md

File metadata and controls

133 lines (90 loc) · 3.17 KB

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

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);

Example scripts

centroid_visualisation.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint