CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

meanOfTouchingNeighbors

Takes a touch matrix and a vector of values to determine the mean value among touching neighbors for every object.

meanOfTouchingNeighbors often follows after

meanOfTouchingNeighbors is often followed by

Usage in ImageJ macro

Ext.CLIJ2_meanOfTouchingNeighbors(Image values, Image touch_matrix, Image mean_values_destination);

Usage in Java

clij2.meanOfTouchingNeighbors(values, touch_matrix, mean_values_destination);
// init CLIJ and GPU
import net.haesleinhuepf.clij2.CLIJ2;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ2 clij2 = CLIJ2.getInstance();

// get input parameters
ClearCLBuffer values = clij2.push(valuesImagePlus);
ClearCLBuffer touch_matrix = clij2.push(touch_matrixImagePlus);
mean_values_destination = clij2.create(values);
// Execute operation on GPU
clij2.meanOfTouchingNeighbors(values, touch_matrix, mean_values_destination);
//show result
mean_values_destinationImagePlus = clij2.pull(mean_values_destination);
mean_values_destinationImagePlus.show();

// cleanup memory on GPU
clij2.release(values);
clij2.release(touch_matrix);
clij2.release(mean_values_destination);

Usage in Matlab

clij2.meanOfTouchingNeighbors(values, touch_matrix, mean_values_destination);
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
values = clij2.pushMat(values_matrix);
touch_matrix = clij2.pushMat(touch_matrix_matrix);
mean_values_destination = clij2.create(values);
% Execute operation on GPU
clij2.meanOfTouchingNeighbors(values, touch_matrix, mean_values_destination);
% show result
mean_values_destination = clij2.pullMat(mean_values_destination)

% cleanup memory on GPU
clij2.release(values);
clij2.release(touch_matrix);
clij2.release(mean_values_destination);

Usage in Icy

clij2.meanOfTouchingNeighbors(values, touch_matrix, mean_values_destination);
// init CLIJ and GPU
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);

clij2 = CLICY.getInstance();

// get input parameters
values_sequence = getSequence();
values = clij2.pushSequence(values_sequence);
touch_matrix_sequence = getSequence();
touch_matrix = clij2.pushSequence(touch_matrix_sequence);
mean_values_destination = clij2.create(values);
// Execute operation on GPU
clij2.meanOfTouchingNeighbors(values, touch_matrix, mean_values_destination);
// show result
mean_values_destination_sequence = clij2.pullSequence(mean_values_destination)
Icy.addSequence(mean_values_destination_sequence);
// cleanup memory on GPU
clij2.release(values);
clij2.release(touch_matrix);
clij2.release(mean_values_destination);

Example notebooks

mean_of_touching_neighbors
neighbors_of_neighbors
tribolium_morphometry

Example scripts

mean_of_touching_neighbors.ijm
neighbors_of_neighbors.ijm
tribolium_morphometry.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint