CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

reduceLabelsToCentroids

Takes a label map and reduces all labels to their center spots. Label IDs stay and background will be zero.

Category: Labels

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

Usage in ImageJ macro

Ext.CLIJ2_reduceLabelsToCentroids(Image input_labels, Image destination_labels);

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 input_labels = clij2.push(input_labelsImagePlus);
destination_labels = clij2.create(input_labels);
// Execute operation on GPU
clij2.reduceLabelsToCentroids(input_labels, destination_labels);
// show result
destination_labelsImagePlus = clij2.pull(destination_labels);
destination_labelsImagePlus.show();

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

% get input parameters
input_labels = clij2.pushMat(input_labels_matrix);
destination_labels = clij2.create(input_labels);
% Execute operation on GPU
clij2.reduceLabelsToCentroids(input_labels, destination_labels);
% show result
destination_labels = clij2.pullMat(destination_labels)

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

clij2 = CLICY.getInstance();

// get input parameters
input_labels_sequence = getSequence();
input_labels = clij2.pushSequence(input_labels_sequence);
destination_labels = clij2.create(input_labels);
// Execute operation on GPU
clij2.reduceLabelsToCentroids(input_labels, destination_labels);
// show result
destination_labels_sequence = clij2.pullSequence(destination_labels)
Icy.addSequence(destination_labels_sequence);
// cleanup memory on GPU
clij2.release(input_labels);
clij2.release(destination_labels);

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint