CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

generateTouchCountMatrix

Takes a label map with n labels and generates a (n+1)*(n+1) matrix where all pixels are set the number of pixels where labels touch (diamond neighborhood).

Major parts of this operation run on the CPU.

Categories: Graphs, Measurements, Labels

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

generateTouchCountMatrix is often followed by

Usage in ImageJ macro

Ext.CLIJ2_generateTouchCountMatrix(Image label_map, Image touch_count_matrix_destination);

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 label_map = clij2.push(label_mapImagePlus);
touch_count_matrix_destination = clij2.create(label_map);
// Execute operation on GPU
clij2.generateTouchCountMatrix(label_map, touch_count_matrix_destination);
// show result
touch_count_matrix_destinationImagePlus = clij2.pull(touch_count_matrix_destination);
touch_count_matrix_destinationImagePlus.show();

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

% get input parameters
label_map = clij2.pushMat(label_map_matrix);
touch_count_matrix_destination = clij2.create(label_map);
% Execute operation on GPU
clij2.generateTouchCountMatrix(label_map, touch_count_matrix_destination);
% show result
touch_count_matrix_destination = clij2.pullMat(touch_count_matrix_destination)

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

clij2 = CLICY.getInstance();

// get input parameters
label_map_sequence = getSequence();
label_map = clij2.pushSequence(label_map_sequence);
touch_count_matrix_destination = clij2.create(label_map);
// Execute operation on GPU
clij2.generateTouchCountMatrix(label_map, touch_count_matrix_destination);
// show result
touch_count_matrix_destination_sequence = clij2.pullSequence(touch_count_matrix_destination)
Icy.addSequence(touch_count_matrix_destination_sequence);
// cleanup memory on GPU
clij2.release(label_map);
clij2.release(touch_count_matrix_destination);

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint