CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

countTouchingNeighbors

Takes a touch matrix as input and delivers a vector with number of touching neighbors per label as a vector.

countTouchingNeighbors is often followed by

Usage in ImageJ macro

Ext.CLIJ2_countTouchingNeighbors(Image touch_matrix, Image touching_neighbors_count_destination);

Usage in Java

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

// get input parameters
ClearCLBuffer touch_matrix = clij2.push(touch_matrixImagePlus);
touching_neighbors_count_destination = clij2.create(touch_matrix);
// Execute operation on GPU
clij2.countTouchingNeighbors(touch_matrix, touching_neighbors_count_destination);
//show result
touching_neighbors_count_destinationImagePlus = clij2.pull(touching_neighbors_count_destination);
touching_neighbors_count_destinationImagePlus.show();

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

Usage in Matlab

clij2.countTouchingNeighbors(touch_matrix, touching_neighbors_count_destination);
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
touch_matrix = clij2.pushMat(touch_matrix_matrix);
touching_neighbors_count_destination = clij2.create(touch_matrix);
% Execute operation on GPU
clij2.countTouchingNeighbors(touch_matrix, touching_neighbors_count_destination);
% show result
touching_neighbors_count_destination = clij2.pullMat(touching_neighbors_count_destination)

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

Usage in Icy

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

clij2 = CLICY.getInstance();

// get input parameters
touch_matrix_sequence = getSequence();
touch_matrix = clij2.pushSequence(touch_matrix_sequence);
touching_neighbors_count_destination = clij2.create(touch_matrix);
// Execute operation on GPU
clij2.countTouchingNeighbors(touch_matrix, touching_neighbors_count_destination);
// show result
touching_neighbors_count_destination_sequence = clij2.pullSequence(touching_neighbors_count_destination)
Icy.addSequence(touching_neighbors_count_destination_sequence);
// cleanup memory on GPU
clij2.release(touch_matrix);
clij2.release(touching_neighbors_count_destination);

Example notebooks

spots_pointlists_matrices_tables

Example scripts

division_visualisation.ijm
spots_pointlists_matrices_tables.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint