GPU accelerated image processing for everyone
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mean average value of neighboring labels. The radius of the neighborhood can be configured:
Note: Values of all pixels in a label each must be identical.
parametric_map : Image label_map : Image parametric_map_destination : Image radius : int ignore_touching_background : bool
parametric_map_destination
Categories: Measurements, Filter, Graphs
Availability: Available in Fiji by activating the update sites clij and clij2. This function is part of clij2_-2.5.0.1.jar.
Ext.CLIJ2_meanOfTouchingNeighborsMap(Image parametric_map, Image label_map, Image parametric_map_destination, Number radius, Boolean ignore_touching_background);
// init CLIJ and GPU import net.haesleinhuepf.clij2.CLIJ2; import net.haesleinhuepf.clij.clearcl.ClearCLBuffer; CLIJ2 clij2 = CLIJ2.getInstance(); // get input parameters ClearCLBuffer parametric_map = clij2.push(parametric_mapImagePlus); ClearCLBuffer label_map = clij2.push(label_mapImagePlus); parametric_map_destination = clij2.create(parametric_map); int radius = 10; boolean ignore_touching_background = true;
// Execute operation on GPU clij2.meanOfTouchingNeighborsMap(parametric_map, label_map, parametric_map_destination, radius, ignore_touching_background);
// show result parametric_map_destinationImagePlus = clij2.pull(parametric_map_destination); parametric_map_destinationImagePlus.show(); // cleanup memory on GPU clij2.release(parametric_map); clij2.release(label_map); clij2.release(parametric_map_destination);
% init CLIJ and GPU clij2 = init_clatlab(); % get input parameters parametric_map = clij2.pushMat(parametric_map_matrix); label_map = clij2.pushMat(label_map_matrix); parametric_map_destination = clij2.create(parametric_map); radius = 10; ignore_touching_background = true;
% Execute operation on GPU clij2.meanOfTouchingNeighborsMap(parametric_map, label_map, parametric_map_destination, radius, ignore_touching_background);
% show result parametric_map_destination = clij2.pullMat(parametric_map_destination) % cleanup memory on GPU clij2.release(parametric_map); clij2.release(label_map); clij2.release(parametric_map_destination);
// init CLIJ and GPU importClass(net.haesleinhuepf.clicy.CLICY); importClass(Packages.icy.main.Icy); clij2 = CLICY.getInstance(); // get input parameters parametric_map_sequence = getSequence(); parametric_map = clij2.pushSequence(parametric_map_sequence); label_map_sequence = getSequence(); label_map = clij2.pushSequence(label_map_sequence); parametric_map_destination = clij2.create(parametric_map); radius = 10; ignore_touching_background = true;
// Execute operation on GPU clij2.meanOfTouchingNeighborsMap(parametric_map, label_map, parametric_map_destination, radius, ignore_touching_background);
// show result parametric_map_destination_sequence = clij2.pullSequence(parametric_map_destination) Icy.addSequence(parametric_map_destination_sequence); // cleanup memory on GPU clij2.release(parametric_map); clij2.release(label_map); clij2.release(parametric_map_destination);
import pyclesperanto_prototype as cle cle.mean_of_touching_neighbors_map(parametric_map, label_map, parametric_map_destination, radius, ignore_touching_background)