CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

generateDistanceMatrix

Takes two images containing coordinates and builds up a matrix containing distance between the points.

Convention: image width represents number of points, height represents dimensionality (2D, 3D, … 10D). The result image has width the first input image and height equals to the width of the second input image.

generateDistanceMatrix often follows after

generateDistanceMatrix is often followed by

Usage in ImageJ macro

Ext.CLIJ2_generateDistanceMatrix(Image coordinate_list1, Image coordinate_list2, Image distance_matrix_destination);

Usage in Java

clij2.generateDistanceMatrix(coordinate_list1, coordinate_list2, distance_matrix_destination);
// init CLIJ and GPU
import net.haesleinhuepf.clij2.CLIJ2;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ2 clij2 = CLIJ2.getInstance();

// get input parameters
ClearCLBuffer coordinate_list1 = clij2.push(coordinate_list1ImagePlus);
ClearCLBuffer coordinate_list2 = clij2.push(coordinate_list2ImagePlus);
distance_matrix_destination = clij2.create(coordinate_list1);
// Execute operation on GPU
clij2.generateDistanceMatrix(coordinate_list1, coordinate_list2, distance_matrix_destination);
//show result
distance_matrix_destinationImagePlus = clij2.pull(distance_matrix_destination);
distance_matrix_destinationImagePlus.show();

// cleanup memory on GPU
clij2.release(coordinate_list1);
clij2.release(coordinate_list2);
clij2.release(distance_matrix_destination);

Usage in Matlab

clij2.generateDistanceMatrix(coordinate_list1, coordinate_list2, distance_matrix_destination);
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
coordinate_list1 = clij2.pushMat(coordinate_list1_matrix);
coordinate_list2 = clij2.pushMat(coordinate_list2_matrix);
distance_matrix_destination = clij2.create(coordinate_list1);
% Execute operation on GPU
clij2.generateDistanceMatrix(coordinate_list1, coordinate_list2, distance_matrix_destination);
% show result
distance_matrix_destination = clij2.pullMat(distance_matrix_destination)

% cleanup memory on GPU
clij2.release(coordinate_list1);
clij2.release(coordinate_list2);
clij2.release(distance_matrix_destination);

Usage in Icy

clij2.generateDistanceMatrix(coordinate_list1, coordinate_list2, distance_matrix_destination);
// init CLIJ and GPU
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);

clij2 = CLICY.getInstance();

// get input parameters
coordinate_list1_sequence = getSequence();
coordinate_list1 = clij2.pushSequence(coordinate_list1_sequence);
coordinate_list2_sequence = getSequence();
coordinate_list2 = clij2.pushSequence(coordinate_list2_sequence);
distance_matrix_destination = clij2.create(coordinate_list1);
// Execute operation on GPU
clij2.generateDistanceMatrix(coordinate_list1, coordinate_list2, distance_matrix_destination);
// show result
distance_matrix_destination_sequence = clij2.pullSequence(distance_matrix_destination)
Icy.addSequence(distance_matrix_destination_sequence);
// cleanup memory on GPU
clij2.release(coordinate_list1);
clij2.release(coordinate_list2);
clij2.release(distance_matrix_destination);

Example notebooks

spots_pointlists_matrices_tables
tribolium_morphometry

Example scripts

mesh_closest_points.ijm
spots_pointlists_matrices_tables.ijm
spot_distance_measurement.ijm
tribolium_morphometry.ijm
mesh_closest_points.py

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint