CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

different

Determines the absolute difference between two images and sets all pixels to 1 where it is above a given tolerance, and 0 otherwise.

Category: Math

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_different(Image input_image1, Image input_image2, Image binary_destination, Number tolerance);

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 input_image1 = clijx.push(input_image1ImagePlus);
ClearCLBuffer input_image2 = clijx.push(input_image2ImagePlus);
binary_destination = clijx.create(input_image1);
float tolerance = 1.0;
// Execute operation on GPU
clijx.different(input_image1, input_image2, binary_destination, tolerance);
// show result
binary_destinationImagePlus = clijx.pull(binary_destination);
binary_destinationImagePlus.show();

// cleanup memory on GPU
clijx.release(input_image1);
clijx.release(input_image2);
clijx.release(binary_destination);
Matlab
% init CLIJ and GPU
clijx = init_clatlabx();

% get input parameters
input_image1 = clijx.pushMat(input_image1_matrix);
input_image2 = clijx.pushMat(input_image2_matrix);
binary_destination = clijx.create(input_image1);
tolerance = 1.0;
% Execute operation on GPU
clijx.different(input_image1, input_image2, binary_destination, tolerance);
% show result
binary_destination = clijx.pullMat(binary_destination)

% cleanup memory on GPU
clijx.release(input_image1);
clijx.release(input_image2);
clijx.release(binary_destination);

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint