CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

meanOfNNearestNeighborsMap

Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the minimum value of neighboring labels. The distance number of nearest neighbors can be configured. Note: Values of all pixels in a label each must be identical.

Parameters

parametric_map : Image label_map : Image parametric_map_destination : Image n : int number of nearest neighbors

Categories: Measurements, Filter, Graphs

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_meanOfNNearestNeighborsMap(Image parametric_map, Image label_map, Image parametric_map_destination, Number n);

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 parametric_map = clijx.push(parametric_mapImagePlus);
ClearCLBuffer label_map = clijx.push(label_mapImagePlus);
parametric_map_destination = clijx.create(parametric_map);
int n = 10;
// Execute operation on GPU
clijx.meanOfNNearestNeighborsMap(parametric_map, label_map, parametric_map_destination, n);
// show result
parametric_map_destinationImagePlus = clijx.pull(parametric_map_destination);
parametric_map_destinationImagePlus.show();

// cleanup memory on GPU
clijx.release(parametric_map);
clijx.release(label_map);
clijx.release(parametric_map_destination);
Matlab
% init CLIJ and GPU
clijx = init_clatlabx();

% get input parameters
parametric_map = clijx.pushMat(parametric_map_matrix);
label_map = clijx.pushMat(label_map_matrix);
parametric_map_destination = clijx.create(parametric_map);
n = 10;
% Execute operation on GPU
clijx.meanOfNNearestNeighborsMap(parametric_map, label_map, parametric_map_destination, n);
% show result
parametric_map_destination = clijx.pullMat(parametric_map_destination)

% cleanup memory on GPU
clijx.release(parametric_map);
clijx.release(label_map);
clijx.release(parametric_map_destination);

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint