Determines the centroids of the background and 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.
- paste2D (1)
Ext.CLIJ2_centroidsOfBackgroundAndLabels(Image source, Image pointlist_destination);
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.centroidsOfBackgroundAndLabels(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.centroidsOfBackgroundAndLabels(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.centroidsOfBackgroundAndLabels(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 clecle.centroids_of_background_and_labels(source, pointlist_destination)