CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

generateProximalNeighborsMatrix

Produces a touch-matrix where the neighbors within a given distance range are marked as touching neighbors.

Takes a distance matrix (e.g. derived from a pointlist of centroids) and marks for every column the neighbors whose distance lie within a given distance range (>= min and <= max). The resulting matrix can be use as if it was a touch-matrix (a.k.a. adjacency graph matrix).

Parameters

distance_marix : Image touch_matrix_destination : Image min_distance : float, optional default : 0 max_distance : float, optional default: 10

Returns

touch_matrix_destination

Categories: Graphs, Measurements

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

Usage in ImageJ macro

Ext.CLIJx_generateProximalNeighborsMatrix(Image distance_matrix, Image touch_matrix_destination, Number min_distance, Number max_distance);

Usage in object oriented programming languages

Java
// init CLIJ and GPU
import net.haesleinhuepf.clijx.CLIJx;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJx clijx = CLIJx.getInstance();

// get input parameters
ClearCLBuffer distance_matrix = clijx.push(distance_matrixImagePlus);
touch_matrix_destination = clijx.create(distance_matrix);
float min_distance = 1.0;
float max_distance = 2.0;
// Execute operation on GPU
clijx.generateProximalNeighborsMatrix(distance_matrix, touch_matrix_destination, min_distance, max_distance);
// show result
touch_matrix_destinationImagePlus = clijx.pull(touch_matrix_destination);
touch_matrix_destinationImagePlus.show();

// cleanup memory on GPU
clijx.release(distance_matrix);
clijx.release(touch_matrix_destination);
Matlab
% init CLIJ and GPU
clijx = init_clatlabx();

% get input parameters
distance_matrix = clijx.pushMat(distance_matrix_matrix);
touch_matrix_destination = clijx.create(distance_matrix);
min_distance = 1.0;
max_distance = 2.0;
% Execute operation on GPU
clijx.generateProximalNeighborsMatrix(distance_matrix, touch_matrix_destination, min_distance, max_distance);
% show result
touch_matrix_destination = clijx.pullMat(touch_matrix_destination)

% cleanup memory on GPU
clijx.release(distance_matrix);
clijx.release(touch_matrix_destination);
clEsperanto Python (experimental)
import pyclesperanto_prototype as cle

cle.generate_proximal_neighbors_matrix(distance_matrix, touch_matrix_destination, min_distance, max_distance)

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint