CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

shortestDistances

Determine the shortest distance from a distance matrix.

This corresponds to the minimum for each individial column.

Categories: Measurements, Graphs

shortestDistances often follows after

Usage in ImageJ macro

Ext.CLIJ2_shortestDistances(Image distance_matrix, Image destination_minimum_distances);

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 distance_matrix = clij2.push(distance_matrixImagePlus);
destination_minimum_distances = clij2.create(distance_matrix);
// Execute operation on GPU
clij2.shortestDistances(distance_matrix, destination_minimum_distances);
// show result
destination_minimum_distancesImagePlus = clij2.pull(destination_minimum_distances);
destination_minimum_distancesImagePlus.show();

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

% get input parameters
distance_matrix = clij2.pushMat(distance_matrix_matrix);
destination_minimum_distances = clij2.create(distance_matrix);
% Execute operation on GPU
clij2.shortestDistances(distance_matrix, destination_minimum_distances);
% show result
destination_minimum_distances = clij2.pullMat(destination_minimum_distances)

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

clij2 = CLICY.getInstance();

// get input parameters
distance_matrix_sequence = getSequence();
distance_matrix = clij2.pushSequence(distance_matrix_sequence);
destination_minimum_distances = clij2.create(distance_matrix);
// Execute operation on GPU
clij2.shortestDistances(distance_matrix, destination_minimum_distances);
// show result
destination_minimum_distances_sequence = clij2.pullSequence(destination_minimum_distances)
Icy.addSequence(destination_minimum_distances_sequence);
// cleanup memory on GPU
clij2.release(distance_matrix);
clij2.release(destination_minimum_distances);

Example scripts

spot_distance_measurement.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint