CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

statisticsOfBackgroundAndLabelledPixels

Determines bounding box, area (in pixels/voxels), min, max and mean intensity of background and 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.

In CLIJ this method is executed on the CPU and not on the GPU/OpenCL device.

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.

statisticsOfBackgroundAndLabelledPixels often follows after

Usage in ImageJ macro

Ext.CLIJ2_statisticsOfBackgroundAndLabelledPixels(Image input, Image labelmap);

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 = clij2.push(inputImagePlus);
ClearCLBuffer labelmap = clij2.push(labelmapImagePlus);
// Execute operation on GPU
double[][] resultStatisticsOfBackgroundAndLabelledPixels = clij2.statisticsOfBackgroundAndLabelledPixels(input, labelmap);
// show result
System.out.println(resultStatisticsOfBackgroundAndLabelledPixels);

// cleanup memory on GPU
clij2.release(input);
clij2.release(labelmap);
Matlab
% 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[][] resultStatisticsOfBackgroundAndLabelledPixels = clij2.statisticsOfBackgroundAndLabelledPixels(input, labelmap);
% show result
System.out.println(resultStatisticsOfBackgroundAndLabelledPixels);

% cleanup memory on GPU
clij2.release(input);
clij2.release(labelmap);
Icy JavaScript
// 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[][] resultStatisticsOfBackgroundAndLabelledPixels = clij2.statisticsOfBackgroundAndLabelledPixels(input, labelmap);
// show result
System.out.println(resultStatisticsOfBackgroundAndLabelledPixels);

// cleanup memory on GPU
clij2.release(input);
clij2.release(labelmap);
clEsperanto Python (experimental)
import pyclesperanto_prototype as cle

cle.statistics_of_background_and_labelled_pixels(input, labelmap)

Example notebooks

mean_of_touching_neighbors
neighbors_of_neighbors
superpixel_segmentation
tables

Example scripts

excludeLabelsWithinRange.ijm
filter_label_maps.ijm
mean_of_touching_neighbors.ijm
neighbors_of_neighbors.ijm
superpixel_segmentation.ijm
tables.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint