CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

multiplyStackWithPlane

Multiplies all pairs of pixel values x and y from an image stack X and a 2D image Y.

x and y are at the same spatial position within a plane.

f(x, y) = x * y

Usage in ImageJ macro

Ext.CLIJ2_multiplyStackWithPlane(Image sourceStack, Image sourcePlane, Image destination);

Usage in Java

clij2.multiplyStackWithPlane(sourceStack, sourcePlane, destination);
// init CLIJ and GPU
import net.haesleinhuepf.clij2.CLIJ2;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ2 clij2 = CLIJ2.getInstance();

// get input parameters
ClearCLBuffer sourceStack = clij2.push(sourceStackImagePlus);
ClearCLBuffer sourcePlane = clij2.push(sourcePlaneImagePlus);
destination = clij2.create(sourceStack);
// Execute operation on GPU
clij2.multiplyStackWithPlane(sourceStack, sourcePlane, destination);
//show result
destinationImagePlus = clij2.pull(destination);
destinationImagePlus.show();

// cleanup memory on GPU
clij2.release(sourceStack);
clij2.release(sourcePlane);
clij2.release(destination);

Usage in Matlab

clij2.multiplyStackWithPlane(sourceStack, sourcePlane, destination);
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
sourceStack = clij2.pushMat(sourceStack_matrix);
sourcePlane = clij2.pushMat(sourcePlane_matrix);
destination = clij2.create(sourceStack);
% Execute operation on GPU
clij2.multiplyStackWithPlane(sourceStack, sourcePlane, destination);
% show result
destination = clij2.pullMat(destination)

% cleanup memory on GPU
clij2.release(sourceStack);
clij2.release(sourcePlane);
clij2.release(destination);

Usage in Icy

clij2.multiplyStackWithPlane(sourceStack, sourcePlane, destination);
// init CLIJ and GPU
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);

clij2 = CLICY.getInstance();

// get input parameters
sourceStack_sequence = getSequence();
sourceStack = clij2.pushSequence(sourceStack_sequence);
sourcePlane_sequence = getSequence();
sourcePlane = clij2.pushSequence(sourcePlane_sequence);
destination = clij2.create(sourceStack);
// Execute operation on GPU
clij2.multiplyStackWithPlane(sourceStack, sourcePlane, destination);
// show result
destination_sequence = clij2.pullSequence(destination)
Icy.addSequence(destination_sequence);
// cleanup memory on GPU
clij2.release(sourceStack);
clij2.release(sourcePlane);
clij2.release(destination);

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint