CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

statisticsOfLabelledPixels

Determines bounding box, area (in pixels/voxels), min, max and mean intensity of labelled objects in a label map and corresponding pixels in the original image.

Instead of a label map, you can also use a binary image as a binary image is a label map with just one label.

This method is executed on the CPU and not on the GPU/OpenCL device.

statisticsOfLabelledPixels often follows after

Usage in ImageJ macro

Ext.CLIJ2_statisticsOfLabelledPixels(Image input, Image labelmap);

Usage in Java

clij2.statisticsOfLabelledPixels(input, labelmap);
// init CLIJ and GPU
import net.haesleinhuepf.clij2.CLIJ2;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ2 clij2 = CLIJ2.getInstance();

// get input parameters
ClearCLBuffer input = clij2.push(inputImagePlus);
ClearCLBuffer labelmap = clij2.push(labelmapImagePlus);
// Execute operation on GPU
double[][] resultStatisticsOfLabelledPixels = clij2.statisticsOfLabelledPixels(input, labelmap);
//show result
System.out.println(resultStatisticsOfLabelledPixels);

// cleanup memory on GPU
clij2.release(input);
clij2.release(labelmap);

Usage in Matlab

clij2.statisticsOfLabelledPixels(input, labelmap);
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
input = clij2.pushMat(input_matrix);
labelmap = clij2.pushMat(labelmap_matrix);
% Execute operation on GPU
double[][] resultStatisticsOfLabelledPixels = clij2.statisticsOfLabelledPixels(input, labelmap);
% show result
System.out.println(resultStatisticsOfLabelledPixels);

% cleanup memory on GPU
clij2.release(input);
clij2.release(labelmap);

Usage in Icy

clij2.statisticsOfLabelledPixels(input, labelmap);
// init CLIJ and GPU
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);

clij2 = CLICY.getInstance();

// get input parameters
input_sequence = getSequence();
input = clij2.pushSequence(input_sequence);
labelmap_sequence = getSequence();
labelmap = clij2.pushSequence(labelmap_sequence);
// Execute operation on GPU
double[][] resultStatisticsOfLabelledPixels = clij2.statisticsOfLabelledPixels(input, labelmap);
// show result
System.out.println(resultStatisticsOfLabelledPixels);

// cleanup memory on GPU
clij2.release(input);
clij2.release(labelmap);

Example notebooks

measure_statistics
spots_pointlists_matrices_tables

Example scripts

measure_statistics.ijm
particle_analysis.ijm
spots_pointlists_matrices_tables.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint