CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

averageDistanceOfNClosestPoints

Determines the average of the n closest points for every point in a distance matrix.

This corresponds to the average of the n minimum values (rows) for each column of the distance matrix.

Parameters

distance_matrix : Image The a distance matrix to be processed. distance_list_destination : Image A vector image with the same width as the distance matrix and height=1, depth=1. Determined average distances will be written into this vector. n_closest_points_to_find : Number Number of smallest distances which should be averaged.

Categories: Graphs, Measurements

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

averageDistanceOfNClosestPoints often follows after

Usage in ImageJ macro

Ext.CLIJ2_averageDistanceOfNClosestPoints(Image distance_matrix, Image distance_list_destination, Number n_closest_points_to_find);

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);
distance_list_destination = clij2.create(distance_matrix);
int n_closest_points_to_find = 10;
// Execute operation on GPU
clij2.averageDistanceOfNClosestPoints(distance_matrix, distance_list_destination, n_closest_points_to_find);
// show result
distance_list_destinationImagePlus = clij2.pull(distance_list_destination);
distance_list_destinationImagePlus.show();

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

% get input parameters
distance_matrix = clij2.pushMat(distance_matrix_matrix);
distance_list_destination = clij2.create(distance_matrix);
n_closest_points_to_find = 10;
% Execute operation on GPU
clij2.averageDistanceOfNClosestPoints(distance_matrix, distance_list_destination, n_closest_points_to_find);
% show result
distance_list_destination = clij2.pullMat(distance_list_destination)

% cleanup memory on GPU
clij2.release(distance_matrix);
clij2.release(distance_list_destination);
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);
distance_list_destination = clij2.create(distance_matrix);
n_closest_points_to_find = 10;
// Execute operation on GPU
clij2.averageDistanceOfNClosestPoints(distance_matrix, distance_list_destination, n_closest_points_to_find);
// show result
distance_list_destination_sequence = clij2.pullSequence(distance_list_destination)
Icy.addSequence(distance_list_destination_sequence);
// cleanup memory on GPU
clij2.release(distance_matrix);
clij2.release(distance_list_destination);

Example notebooks

tables

Example scripts

tables.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint