CLIJ

Logo

GPU-accelerated image processing in ImageJ using CLIJ

View the Project on GitHub clij/clij-docs

CLIJ reference for ImageJ/Java

absolute( ClearCLBuffer src, ClearCLBuffer dst )

Computes the absolute value of every individual pixel x in a given image.

f(x) = |x| 

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().absolute(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

addImageAndScalar( ClearCLBuffer src, ClearCLBuffer dst, Float scalar )

Adds a scalar value s to all pixels x of a given image X.

f(x, s) = x + s

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float scalar

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float scalar = 1.0;
// Execute operation on GPU
clij.op().addImageAndScalar(src, dst, scalar);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

addImages( ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst )

Calculates the sum of pairs of pixels x and y of two images X and Y.

f(x, y) = x + y

Parameters: ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer src1 = clij.push(src1ImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().addImages(src, src1, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
src1.close();
dst.close();

addImagesWeighted( ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst, Float factor, Float factor1 )

Calculates the sum of pairs of pixels x and y from images X and Y weighted with factors a and b.

f(x, y, a, b) = x * a + y * b

Parameters: ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst, Float factor, Float factor1

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer src1 = clij.push(src1ImagePlus);
dst = clij.create(src);
float factor = 1.0;
float factor1 = 2.0;
// Execute operation on GPU
clij.op().addImagesWeighted(src, src1, dst, factor, factor1);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
src1.close();
dst.close();

affineTransform( ClearCLBuffer src, ClearCLBuffer dst, AffineTransform3D at )

CLIJ affineTransform is deprecated. Use affineTransform2D or affineTransform3D instead.

Applies an affine transform to a 3D image. Individual transforms must be separated by spaces.

Supported transforms:

Example transform: transform = “center scale=2 rotate=45 -center”;

Parameters: ClearCLBuffer src, ClearCLBuffer dst, AffineTransform3D at

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
import net.imglib2.realtransform.AffineTransform3D;
at = new AffineTransform3D();
at.translate(4, 0, 0);
// Execute operation on GPU
clij.op().affineTransform(src, dst, at);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

affineTransform( ClearCLBuffer src, ClearCLBuffer dst, float[] matrix )

CLIJ affineTransform is deprecated. Use affineTransform2D or affineTransform3D instead.

Applies an affine transform to a 3D image. Individual transforms must be separated by spaces.

Supported transforms:

Example transform: transform = “center scale=2 rotate=45 -center”;

Parameters: ClearCLBuffer src, ClearCLBuffer dst, float[] matrix

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().affineTransform(src, dst, matrix);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

affineTransform2D( ClearCLBuffer src, ClearCLBuffer dst, AffineTransform2D at )

Applies an affine transform to a 2D image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, AffineTransform2D at

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
import net.imglib2.realtransform.AffineTransform2D;
at = new AffineTransform2D();
at.translate(4, 0);
// Execute operation on GPU
clij.op().affineTransform2D(src, dst, at);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

affineTransform2D( ClearCLBuffer src, ClearCLBuffer dst, float[] matrix )

Applies an affine transform to a 2D image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, float[] matrix

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().affineTransform2D(src, dst, matrix);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

affineTransform3D( ClearCLBuffer src, ClearCLBuffer dst, AffineTransform3D at )

Applies an affine transform to a 3D image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, AffineTransform3D at

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
import net.imglib2.realtransform.AffineTransform3D;
at = new AffineTransform3D();
at.translate(4, 0, 0);
// Execute operation on GPU
clij.op().affineTransform3D(src, dst, at);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

affineTransform3D( ClearCLBuffer src, ClearCLBuffer dst, float[] matrix )

Applies an affine transform to a 3D image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, float[] matrix

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().affineTransform3D(src, dst, matrix);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

applyVectorfield( ClearCLBuffer src, ClearCLBuffer vectorX, ClearCLBuffer vectorY, ClearCLBuffer dst )

Deforms an image according to distances provided in the given vector images. It is recommended to use 32-bit images for input, output and vector images.

Parameters: ClearCLBuffer src, ClearCLBuffer vectorX, ClearCLBuffer vectorY, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer vectorX = clij.push(vectorXImagePlus);
ClearCLBuffer vectorY = clij.push(vectorYImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().applyVectorfield(src, vectorX, vectorY, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
vectorX.close();
vectorY.close();
dst.close();

Example programs

applyVectorfield( ClearCLBuffer src, ClearCLBuffer vectorX, ClearCLBuffer vectorY, ClearCLBuffer vectorZ, ClearCLBuffer dst )

Deforms an image according to distances provided in the given vector images. It is recommended to use 32-bit images for input, output and vector images.

Parameters: ClearCLBuffer src, ClearCLBuffer vectorX, ClearCLBuffer vectorY, ClearCLBuffer vectorZ, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer vectorX = clij.push(vectorXImagePlus);
ClearCLBuffer vectorY = clij.push(vectorYImagePlus);
ClearCLBuffer vectorZ = clij.push(vectorZImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().applyVectorfield(src, vectorX, vectorY, vectorZ, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
vectorX.close();
vectorY.close();
vectorZ.close();
dst.close();

Example programs

argMaximumZProjection( ClearCLBuffer src, ClearCLBuffer dst_max, ClearCLBuffer dst_arg )

Determines the maximum projection of an image stack along Z. Furthermore, another 2D image is generated with pixels containing the z-index where the maximum was found (zero based).

Parameters: ClearCLBuffer src, ClearCLBuffer dst_max, ClearCLBuffer dst_arg

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst_max = clij.create(src);
dst_arg = clij.create(src);
// Execute operation on GPU
clij.op().argMaximumZProjection(src, dst_max, dst_arg);
//show result
dst_maxImagePlus = clij.pull(dst_max);
dst_maxImagePlus.show();
dst_argImagePlus = clij.pull(dst_arg);
dst_argImagePlus.show();

// cleanup memory on GPU
src.close();
dst_max.close();
dst_arg.close();

automaticThreshold( ClearCLBuffer src, ClearCLBuffer dst, String userSelectedMethod )

The automatic thresholder utilizes the threshold methods from ImageJ on a histogram determined on the GPU to create binary images as similar as possible to ImageJ ‘Apply Threshold’ method. Enter one of these methods in the method text field: [Default, Huang, Intermodes, IsoData, IJ_IsoData, Li, MaxEntropy, Mean, MinError, Minimum, Moments, Otsu, Percentile, RenyiEntropy, Shanbhag, Triangle, Yen]

Parameters: ClearCLBuffer src, ClearCLBuffer dst, String userSelectedMethod

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().automaticThreshold(src, dst, userSelectedMethod);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

automaticThreshold( ClearCLBuffer src, ClearCLBuffer dst, String userSelectedMethod, Float minimumGreyValue, Float maximumGreyValue, Integer numberOfBins )

The automatic thresholder utilizes the threshold methods from ImageJ on a histogram determined on the GPU to create binary images as similar as possible to ImageJ ‘Apply Threshold’ method. Enter one of these methods in the method text field: [Default, Huang, Intermodes, IsoData, IJ_IsoData, Li, MaxEntropy, Mean, MinError, Minimum, Moments, Otsu, Percentile, RenyiEntropy, Shanbhag, Triangle, Yen]

Parameters: ClearCLBuffer src, ClearCLBuffer dst, String userSelectedMethod, Float minimumGreyValue, Float maximumGreyValue, Integer numberOfBins

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float minimumGreyValue = 1.0;
float maximumGreyValue = 2.0;
int numberOfBins = 10;
// Execute operation on GPU
clij.op().automaticThreshold(src, dst, userSelectedMethod, minimumGreyValue, maximumGreyValue, numberOfBins);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

binaryAnd( ClearCLBuffer src1, ClearCLBuffer src2, ClearCLBuffer dst )

Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary AND operator &. All pixel values except 0 in the input images are interpreted as 1.

f(x, y) = x & y

Parameters: ClearCLBuffer src1, ClearCLBuffer src2, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src1 = clij.push(src1ImagePlus);
ClearCLBuffer src2 = clij.push(src2ImagePlus);
dst = clij.create(src1);
// Execute operation on GPU
clij.op().binaryAnd(src1, src2, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src1.close();
src2.close();
dst.close();

binaryNot( ClearCLBuffer src1, ClearCLBuffer dst )

Computes a binary image (containing pixel values 0 and 1) from an image X by negating its pixel values x using the binary NOT operator ! All pixel values except 0 in the input image are interpreted as 1.

f(x) = !x

Parameters: ClearCLBuffer src1, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src1 = clij.push(src1ImagePlus);
dst = clij.create(src1);
// Execute operation on GPU
clij.op().binaryNot(src1, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src1.close();
dst.close();

binaryOr( ClearCLBuffer src1, ClearCLBuffer src2, ClearCLBuffer dst )

Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary OR operator |. All pixel values except 0 in the input images are interpreted as 1.<pre>f(x, y) = x | y</pre>

Parameters: ClearCLBuffer src1, ClearCLBuffer src2, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src1 = clij.push(src1ImagePlus);
ClearCLBuffer src2 = clij.push(src2ImagePlus);
dst = clij.create(src1);
// Execute operation on GPU
clij.op().binaryOr(src1, src2, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src1.close();
src2.close();
dst.close();

binaryXOr( ClearCLBuffer src1, ClearCLBuffer src2, ClearCLBuffer dst )

Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary operators AND &, OR | and NOT ! implementing the XOR operator. All pixel values except 0 in the input images are interpreted as 1.

f(x, y) = (x & !y) | (!x & y)

Parameters: ClearCLBuffer src1, ClearCLBuffer src2, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src1 = clij.push(src1ImagePlus);
ClearCLBuffer src2 = clij.push(src2ImagePlus);
dst = clij.create(src1);
// Execute operation on GPU
clij.op().binaryXOr(src1, src2, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src1.close();
src2.close();
dst.close();

Example programs

blur( ClearCLBuffer src, ClearCLBuffer dst, Float blurSigmaX, Float blurSigmaY )

Computes the Gaussian blurred image of an image given two sigma values in X and Y. Thus, the filterkernel can have non-isotropic shape.

The implementation is done separable. In case a sigma equals zero, the direction is not blurred.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float blurSigmaX, Float blurSigmaY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float blurSigmaX = 1.0;
float blurSigmaY = 2.0;
// Execute operation on GPU
clij.op().blur(src, dst, blurSigmaX, blurSigmaY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

blur( ClearCLBuffer src, ClearCLBuffer dst, Float blurSigmaX, Float blurSigmaY, Float blurSigmaZ )

Computes the Gaussian blurred image of an image given two sigma values in X and Y. Thus, the filterkernel can have non-isotropic shape.

The implementation is done separable. In case a sigma equals zero, the direction is not blurred.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float blurSigmaX, Float blurSigmaY, Float blurSigmaZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float blurSigmaX = 1.0;
float blurSigmaY = 2.0;
float blurSigmaZ = 3.0;
// Execute operation on GPU
clij.op().blur(src, dst, blurSigmaX, blurSigmaY, blurSigmaZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

blurSliceBySlice( ClearCLBuffer src, ClearCLBuffer dst, int kernelSizeX, int kernelSizeY, float sigmaX, float sigmaY )

Computes the Gaussian blurred image of an image given two sigma values in X and Y. Thus, the filterkernel can have non-isotropic shape.

The Gaussian blur is applied slice by slice in 2D.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, int kernelSizeX, int kernelSizeY, float sigmaX, float sigmaY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().blurSliceBySlice(src, dst, kernelSizeX, kernelSizeY, sigmaX, sigmaY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

centerOfMass( ClearCLBuffer input )

Determines the center of mass of an image or image stack and writes the result in the results table in the columns MassX, MassY and MassZ.

Parameters: ClearCLBuffer input

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer input = clij.push(inputImagePlus);
// Execute operation on GPU
double[] resultCenterOfMass = clij.op().centerOfMass(input);
//show result
System.out.println(resultCenterOfMass);

// cleanup memory on GPU
input.close();

Example programs

convertToImageJBinary( ClearCLBuffer src, ClearCLBuffer dst )

Convert a binary image to an image with values 0 and 255 as it can be interpreted by ImageJ as binary image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
from net.haesleinhuepf.clij.coremem.enums import NativeTypeEnum;
ClearCLBuffer dst = clij.create(src.getDimensions(), src.getHeight()], NativeTypeEnum.UnsignedByte);
// Execute operation on GPU
clij.op().convertToImageJBinary(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

copy( ClearCLBuffer src, ClearCLBuffer dst )

Copies an image.

f(x) = x

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().copy(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

copySlice( ClearCLBuffer src, ClearCLBuffer dst, Integer planeIndex )

Copies a slice with a given index out of an input image stack into a 2D image, if 3D and 2D image are given as parameters. OrCopies a given slice into a given image stack, if 2D and 3D images are given as parameters.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer planeIndex

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(new long[]{src.getWidth(), src.getHeight()}, src.getNativeType());
int planeIndex = 10;
// Execute operation on GPU
clij.op().copySlice(src, dst, planeIndex);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

countNonZeroPixelsLocally( ClearCLBuffer src, ClearCLBuffer dst, Integer radiusX, Integer radiusY )

Counts non-zero pixels in the neighborhood of every pixel in a 2D image and writes the resulting count in the corresponding pixel of the target image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radiusX, Integer radiusY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radiusX = 10;
int radiusY = 20;
// Execute operation on GPU
clij.op().countNonZeroPixelsLocally(src, dst, radiusX, radiusY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

countNonZeroPixelsLocallySliceBySlice( ClearCLBuffer src, ClearCLBuffer dst, Integer radiusX, Integer radiusY )

Counts non-zero pixels in the 2D-neighborhood of every pixel in a 3D image stack and writes the resulting count in the corresponding pixel of the target image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radiusX, Integer radiusY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radiusX = 10;
int radiusY = 20;
// Execute operation on GPU
clij.op().countNonZeroPixelsLocallySliceBySlice(src, dst, radiusX, radiusY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

countNonZeroVoxelsLocally( ClearCLBuffer src, ClearCLBuffer dst, Integer radiusX, Integer radiusY, Integer radiusZ )

Counts non-zero pixels in the 2D-neighborhood of every pixel in a 3D image stack and writes the resulting count in the corresponding pixel of the target image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radiusX, Integer radiusY, Integer radiusZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radiusX = 10;
int radiusY = 20;
int radiusZ = 30;
// Execute operation on GPU
clij.op().countNonZeroVoxelsLocally(src, dst, radiusX, radiusY, radiusZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

crop( ClearCLBuffer src, ClearCLBuffer dst, Integer startX, Integer startY )

Crops out a region of a 2D image or a substack out of a given image stack. Size of the region is determined from the given destination image stack.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer startX, Integer startY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int startX = 10;
int startY = 20;
// Execute operation on GPU
clij.op().crop(src, dst, startX, startY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

crop( ClearCLBuffer src, ClearCLBuffer dst, Integer startX, Integer startY, Integer startZ )

Crops out a region of a 2D image or a substack out of a given image stack. Size of the region is determined from the given destination image stack.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer startX, Integer startY, Integer startZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int startX = 10;
int startY = 20;
int startZ = 30;
// Execute operation on GPU
clij.op().crop(src, dst, startX, startY, startZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

detectMaximaBox( ClearCLBuffer src, ClearCLBuffer dst, Integer radius )

Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which has a higher intensity, and to 0 otherwise.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
// Execute operation on GPU
clij.op().detectMaximaBox(src, dst, radius);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

detectMaximaSliceBySliceBox( ClearCLBuffer src, ClearCLBuffer dst, Integer radius )

Detects local maxima in a given square neighborhood of an input image stack. The input image stack is processed slice by slice. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which has a higher intensity, and to 0 otherwise.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
// Execute operation on GPU
clij.op().detectMaximaSliceBySliceBox(src, dst, radius);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

detectMinimaBox( ClearCLBuffer src, ClearCLBuffer dst, Integer radius )

Detects local minima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which has a lower intensity, and to 0 otherwise.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
// Execute operation on GPU
clij.op().detectMinimaBox(src, dst, radius);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

detectMinimaSliceBySliceBox( ClearCLBuffer src, ClearCLBuffer dst, Integer radius )

Detects local minima in a given square neighborhood of an input image stack. The input image stack is processed slice by slice. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which has a lower intensity, and to 0 otherwise.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
// Execute operation on GPU
clij.op().detectMinimaSliceBySliceBox(src, dst, radius);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

detectOptima( ClearCLBuffer src, ClearCLBuffer dst, Integer radius, Boolean detectMaxima )

It is recommended to detectMaxima and detectMinima.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius, Boolean detectMaxima

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
boolean detectMaxima = true;
// Execute operation on GPU
clij.op().detectOptima(src, dst, radius, detectMaxima);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

detectOptimaSliceBySlice( ClearCLBuffer src, ClearCLBuffer dst, Integer radius, Boolean detectMaxima )

It is recommended to detectMaximaSliceBySlice and detectMinimaSliceBySlice.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius, Boolean detectMaxima

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
boolean detectMaxima = true;
// Execute operation on GPU
clij.op().detectOptimaSliceBySlice(src, dst, radius, detectMaxima);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

dilateBox( ClearCLBuffer src, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation takes the Moore-neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.

This method is comparable to the ‘Dilate’ menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().dilateBox(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

dilateBoxSliceBySlice( ClearCLBuffer src, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation takes the Moore-neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.

This method is comparable to the ‘Dilate’ menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255.

This filter is applied slice by slice in 2D.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().dilateBoxSliceBySlice(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

dilateSphere( ClearCLBuffer src, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation takes the von-Neumann-neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().dilateSphere(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

dilateSphereSliceBySlice( ClearCLBuffer src, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation takes the von-Neumann-neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.

This filter is applied slice by slice in 2D.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().dilateSphereSliceBySlice(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

divideImages( ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst )

Divides two images X and Y by each other pixel wise.

f(x, y) = x / y

Parameters: ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer src1 = clij.push(src1ImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().divideImages(src, src1, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
src1.close();
dst.close();

downsample( ClearCLBuffer src, ClearCLBuffer dst, Float factorX, Float factorY )

Scales an image using given scaling factors for X and Y dimensions. The nearest-neighbor method is applied. In ImageJ the method which is similar is called ‘Interpolation method: none’.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float factorX, Float factorY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float factorX = 1.0;
float factorY = 2.0;
// Execute operation on GPU
clij.op().downsample(src, dst, factorX, factorY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

downsample( ClearCLBuffer src, ClearCLBuffer dst, Float factorX, Float factorY, Float factorZ )

Scales an image using given scaling factors for X and Y dimensions. The nearest-neighbor method is applied. In ImageJ the method which is similar is called ‘Interpolation method: none’.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float factorX, Float factorY, Float factorZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float factorX = 1.0;
float factorY = 2.0;
float factorZ = 3.0;
// Execute operation on GPU
clij.op().downsample(src, dst, factorX, factorY, factorZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

downsampleSliceBySliceHalfMedian( ClearCLBuffer src, ClearCLBuffer dst )

Scales an image using scaling factors 0.5 for X and Y dimensions. The Z dimension stays untouched. Thus, each slice is processed separately. The median method is applied. Thus, each pixel value in the destination image equals to the median of four corresponding pixels in the source image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().downsampleSliceBySliceHalfMedian(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

erodeBox( ClearCLBuffer src, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion takes the Moore-neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.

This method is comparable to the ‘Erode’ menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().erodeBox(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

erodeBoxSliceBySlice( ClearCLBuffer src, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion takes the Moore-neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.

This method is comparable to the ‘Erode’ menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255.

This filter is applied slice by slice in 2D.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().erodeBoxSliceBySlice(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

erodeSphere( ClearCLBuffer src, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion takes the von-Neumann-neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().erodeSphere(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

erodeSphereSliceBySlice( ClearCLBuffer src, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion takes the von-Neumann-neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.

This filter is applied slice by slice in 2D.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().erodeSphereSliceBySlice(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

fillHistogram( ClearCLBuffer src, ClearCLBuffer dstHistogram, Float minimumGreyValue, Float maximumGreyValue )

Generates a histogram of a 2D image or 3D stack and writes into a 2D image where X corresponds to the bin index and Y corresponds to the count of found pixels.

Parameters: ClearCLBuffer src, ClearCLBuffer dstHistogram, Float minimumGreyValue, Float maximumGreyValue

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dstHistogram = clij.create(src);
float minimumGreyValue = 1.0;
float maximumGreyValue = 2.0;
// Execute operation on GPU
clij.op().fillHistogram(src, dstHistogram, minimumGreyValue, maximumGreyValue);
//show result
dstHistogramImagePlus = clij.pull(dstHistogram);
dstHistogramImagePlus.show();

// cleanup memory on GPU
src.close();
dstHistogram.close();

flip( ClearCLBuffer src, ClearCLBuffer dst, Boolean flipx, Boolean flipy )

Flips an image in X and/or Y direction depending on boolean flags.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Boolean flipx, Boolean flipy

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
boolean flipx = true;
boolean flipy = false;
// Execute operation on GPU
clij.op().flip(src, dst, flipx, flipy);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

flip( ClearCLBuffer src, ClearCLBuffer dst, Boolean flipx, Boolean flipy, Boolean flipz )

Flips an image in X and/or Y direction depending on boolean flags.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Boolean flipx, Boolean flipy, Boolean flipz

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
boolean flipx = true;
boolean flipy = false;
boolean flipz = false;
// Execute operation on GPU
clij.op().flip(src, dst, flipx, flipy, flipz);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

gradientX( ClearCLBuffer src, ClearCLBuffer dst )

Computes the gradient of gray values along X. Assuming a, b and c are three adjacent pixels in X direction. In the target image will be saved as: <pre>b’ = c - a;</pre>

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().gradientX(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

gradientY( ClearCLBuffer src, ClearCLBuffer dst )

Computes the gradient of gray values along Y. Assuming a, b and c are three adjacent pixels in Y direction. In the target image will be saved as: <pre>b’ = c - a;</pre>

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().gradientY(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

gradientZ( ClearCLBuffer src, ClearCLBuffer dst )

Computes the gradient of gray values along Z. Assuming a, b and c are three adjacent pixels in Z direction. In the target image will be saved as: <pre>b’ = c - a;</pre>

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().gradientZ(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

histogram( ClearCLBuffer image, Float minGreyValue, Float maxGreyValue, Integer numberOfBins )

Determines the histogram of a given image.

Parameters: ClearCLBuffer image, Float minGreyValue, Float maxGreyValue, Integer numberOfBins

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer image = clij.push(imageImagePlus);
float minGreyValue = 1.0;
float maxGreyValue = 2.0;
int numberOfBins = 10;
// Execute operation on GPU
float[] resultHistogram = clij.op().histogram(image, minGreyValue, maxGreyValue, numberOfBins);
//show result
System.out.println(resultHistogram);

// cleanup memory on GPU
image.close();

invert( ClearCLBuffer input3d, ClearCLBuffer output3d )

Computes the negative value of all pixels in a given image. It is recommended to convert images to 32-bit float before applying this operation.

f(x) = - x

For binary images, use binaryNot.

Parameters: ClearCLBuffer input3d, ClearCLBuffer output3d

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer input3d = clij.push(input3dImagePlus);
output3d = clij.create(input3d);
// Execute operation on GPU
clij.op().invert(input3d, output3d);
//show result
output3dImagePlus = clij.pull(output3d);
output3dImagePlus.show();

// cleanup memory on GPU
input3d.close();
output3d.close();

localThreshold( ClearCLBuffer src, ClearCLBuffer threshold, ClearCLBuffer dst )

Computes a binary image with pixel values 0 and 1 depending on if a pixel value x in image X was above of equal to the pixel value m in mask image M.

f(x) = (1 if (x >=  m)); (0 otherwise)

Parameters: ClearCLBuffer src, ClearCLBuffer threshold, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer threshold = clij.push(thresholdImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().localThreshold(src, threshold, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
threshold.close();
dst.close();

mask( ClearCLBuffer src, ClearCLBuffer mask, ClearCLBuffer dst )

Computes a masked image by applying a mask to an image. All pixel values x of image X will be copied to the destination image in case pixel value m at the same position in the mask image is not equal to zero.

f(x,m) = (x if (m != 0); (0 otherwise))

Parameters: ClearCLBuffer src, ClearCLBuffer mask, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer mask = clij.push(maskImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().mask(src, mask, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
mask.close();
dst.close();

maskStackWithPlane( ClearCLBuffer src, ClearCLBuffer mask, ClearCLBuffer dst )

Computes a masked image by applying a 2D mask to an image stack. All pixel values x of image X will be copied to the destination image in case pixel value m at the same spatial position in the mask image is not equal to zero.

f(x,m) = (x if (m != 0); (0 otherwise))

Parameters: ClearCLBuffer src, ClearCLBuffer mask, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer mask = clij.push(maskImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().maskStackWithPlane(src, mask, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
mask.close();
dst.close();

maximumBox( ClearCLBuffer src, ClearCLBuffer dst, int radiusX, int radiusY, int radiusZ )

Computes the local maximum of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, int radiusX, int radiusY, int radiusZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().maximumBox(src, dst, radiusX, radiusY, radiusZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

maximumIJ( ClearCLBuffer src, ClearCLBuffer dst, Integer radius )

This method is deprecated. Consider using maximumBox or maximumSphere instead.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
// Execute operation on GPU
clij.op().maximumIJ(src, dst, radius);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

maximumImageAndScalar( ClearCLBuffer src, ClearCLBuffer dst, Float valueB )

Computes the maximum of a constant scalar s and each pixel value x in a given image X.

f(x, s) = max(x, s)

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float valueB

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float valueB = 1.0;
// Execute operation on GPU
clij.op().maximumImageAndScalar(src, dst, valueB);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

maximumImages( ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst )

Computes the maximum of a pair of pixel values x, y from two given images X and Y.

f(x, y) = max(x, y)

Parameters: ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer src1 = clij.push(src1ImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().maximumImages(src, src1, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
src1.close();
dst.close();

maximumOfAllPixels( ClearCLBuffer clImage )

Determines the maximum of all pixels in a given image. It will be stored in a new row of ImageJs Results table in the column ‘Max’.

Parameters: ClearCLBuffer clImage

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer clImage = clij.push(clImageImagePlus);
// Execute operation on GPU
double resultMaximumOfAllPixels = clij.op().maximumOfAllPixels(clImage);
//show result
System.out.println(resultMaximumOfAllPixels);

// cleanup memory on GPU
clImage.close();

maximumSliceBySliceSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local maximum of a pixels ellipsoidal 2D neighborhood in an image stack slice by slice. The ellipses size is specified by its half-width and half-height (radius).

This filter is applied slice by slice in 2D.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().maximumSliceBySliceSphere(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

maximumSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local maximum of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().maximumSphere(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

maximumSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ )

Computes the local maximum of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
int kernelSizeZ = 30;
// Execute operation on GPU
clij.op().maximumSphere(src, dst, kernelSizeX, kernelSizeY, kernelSizeZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

maximumXYZProjection( ClearCLBuffer src, ClearCLBuffer dst_max, Integer projectedDimensionX, Integer projectedDimensionY, Integer projectedDimension )

Determines the maximum projection of an image along a given dimension. Furthermore, the X and Y dimesions of the resulting image must be specified by the user according to its definition: X = 0 Y = 1 Z = 2

Parameters: ClearCLBuffer src, ClearCLBuffer dst_max, Integer projectedDimensionX, Integer projectedDimensionY, Integer projectedDimension

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst_max = clij.create(new long[]{src.getWidth(), src.getHeight()}, src.getNativeType());
int projectedDimensionX = 10;
int projectedDimensionY = 20;
int projectedDimension = 30;
// Execute operation on GPU
clij.op().maximumXYZProjection(src, dst_max, projectedDimensionX, projectedDimensionY, projectedDimension);
//show result
dst_maxImagePlus = clij.pull(dst_max);
dst_maxImagePlus.show();

// cleanup memory on GPU
src.close();
dst_max.close();

maximumZProjection( ClearCLBuffer src, ClearCLBuffer dst_max )

Determines the maximum projection of an image along Z.

Parameters: ClearCLBuffer src, ClearCLBuffer dst_max

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst_max = clij.create(new long[]{src.getWidth(), src.getHeight()}, src.getNativeType());
// Execute operation on GPU
clij.op().maximumZProjection(src, dst_max);
//show result
dst_maxImagePlus = clij.pull(dst_max);
dst_maxImagePlus.show();

// cleanup memory on GPU
src.close();
dst_max.close();

Example programs

meanBox( ClearCLBuffer src, ClearCLBuffer dst, int radiusX, int radiusY, int radiusZ )

Computes the local mean average of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, int radiusX, int radiusY, int radiusZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().meanBox(src, dst, radiusX, radiusY, radiusZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

meanIJ( ClearCLBuffer src, ClearCLBuffer dst, Integer radius )

This method is deprecated. Consider using meanBox or meanSphere instead.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
// Execute operation on GPU
clij.op().meanIJ(src, dst, radius);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

meanSliceBySliceSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local mean average of a pixels ellipsoidal 2D neighborhood in an image stack slice by slice. The ellipses size is specified by its half-width and half-height (radius).

This filter is applied slice by slice in 2D.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().meanSliceBySliceSphere(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

meanSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local mean average of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().meanSphere(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

meanSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ )

Computes the local mean average of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
int kernelSizeZ = 30;
// Execute operation on GPU
clij.op().meanSphere(src, dst, kernelSizeX, kernelSizeY, kernelSizeZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

meanZProjection( ClearCLBuffer src, ClearCLBuffer dst )

Determines the mean average projection of an image along Z.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(new long[]{src.getWidth(), src.getHeight()}, src.getNativeType());
// Execute operation on GPU
clij.op().meanZProjection(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

medianBox( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local median of a pixels rectangular neighborhood. The rectangle is specified by its half-width and half-height (radius).

For technical reasons, the area of the rectangle must have less than 1000 pixels.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().medianBox(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

medianBox( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ )

Computes the local median of a pixels rectangular neighborhood. The rectangle is specified by its half-width and half-height (radius).

For technical reasons, the area of the rectangle must have less than 1000 pixels.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
int kernelSizeZ = 30;
// Execute operation on GPU
clij.op().medianBox(src, dst, kernelSizeX, kernelSizeY, kernelSizeZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

medianSliceBySliceBox( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local median of a pixels rectangular neighborhood. This is done slice-by-slice in a 3D image stack. The rectangle is specified by its half-width and half-height (radius).

For technical reasons, the area of the rectangle must have less than 1000 pixels.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().medianSliceBySliceBox(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

medianSliceBySliceSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local median of a pixels ellipsoidal neighborhood. This is done slice-by-slice in a 3D image stack. The ellipses size is specified by its half-width and half-height (radius).

For technical reasons, the area of the ellipse must have less than 1000 pixels.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().medianSliceBySliceSphere(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

medianSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local median of a pixels rectangular neighborhood. The rectangle is specified by its half-width and half-height (radius).

For technical reasons, the area of the rectangle must have less than 1000 pixels.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().medianSphere(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

medianSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ )

Computes the local median of a pixels rectangular neighborhood. The rectangle is specified by its half-width and half-height (radius).

For technical reasons, the area of the rectangle must have less than 1000 pixels.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
int kernelSizeZ = 30;
// Execute operation on GPU
clij.op().medianSphere(src, dst, kernelSizeX, kernelSizeY, kernelSizeZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

minimumBox( ClearCLBuffer src, ClearCLBuffer dst, int radiusX, int radiusY, int radiusZ )

Computes the local minimum of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, int radiusX, int radiusY, int radiusZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().minimumBox(src, dst, radiusX, radiusY, radiusZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

minimumIJ( ClearCLBuffer src, ClearCLBuffer dst, Integer radius )

This method is deprecated. Consider using minimumBox or minimumSphere instead.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer radius

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int radius = 10;
// Execute operation on GPU
clij.op().minimumIJ(src, dst, radius);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

minimumImageAndScalar( ClearCLBuffer src, ClearCLBuffer dst, Float valueB )

Computes the maximum of a constant scalar s and each pixel value x in a given image X.

f(x, s) = min(x, s)

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float valueB

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float valueB = 1.0;
// Execute operation on GPU
clij.op().minimumImageAndScalar(src, dst, valueB);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

minimumImages( ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst )

Computes the minimum of a pair of pixel values x, y from two given images X and Y.

f(x, y) = min(x, y)

Parameters: ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer src1 = clij.push(src1ImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().minimumImages(src, src1, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
src1.close();
dst.close();

minimumOfAllPixels( ClearCLBuffer clImage )

Determines the minimum of all pixels in a given image. It will be stored in a new row of ImageJs Results table in the column ‘Min’.

Parameters: ClearCLBuffer clImage

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer clImage = clij.push(clImageImagePlus);
// Execute operation on GPU
double resultMinimumOfAllPixels = clij.op().minimumOfAllPixels(clImage);
//show result
System.out.println(resultMinimumOfAllPixels);

// cleanup memory on GPU
clImage.close();

minimumSliceBySliceSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local minimum of a pixels ellipsoidal 2D neighborhood in an image stack slice by slice. The ellipses size is specified by its half-width and half-height (radius).

This filter is applied slice by slice in 2D.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().minimumSliceBySliceSphere(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

minimumSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY )

Computes the local minimum of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
// Execute operation on GPU
clij.op().minimumSphere(src, dst, kernelSizeX, kernelSizeY);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

minimumSphere( ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ )

Computes the local minimum of a pixels rectangular neighborhood. The rectangles size is specified by its half-width and half-height (radius).

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer kernelSizeX, Integer kernelSizeY, Integer kernelSizeZ

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int kernelSizeX = 10;
int kernelSizeY = 20;
int kernelSizeZ = 30;
// Execute operation on GPU
clij.op().minimumSphere(src, dst, kernelSizeX, kernelSizeY, kernelSizeZ);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

minimumZProjection( ClearCLBuffer src, ClearCLBuffer dst_min )

Determines the minimum projection of an image along Z.

Parameters: ClearCLBuffer src, ClearCLBuffer dst_min

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst_min = clij.create(new long[]{src.getWidth(), src.getHeight()}, src.getNativeType());
// Execute operation on GPU
clij.op().minimumZProjection(src, dst_min);
//show result
dst_minImagePlus = clij.pull(dst_min);
dst_minImagePlus.show();

// cleanup memory on GPU
src.close();
dst_min.close();

multiplyImageAndCoordinate( ClearCLBuffer src, ClearCLBuffer dst, Integer dimension )

Multiply every pixel intensity with its X/Y/Z coordinate depending on given dimension. This method can be used to calculate the center of mass of an image.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Integer dimension

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
int dimension = 10;
// Execute operation on GPU
clij.op().multiplyImageAndCoordinate(src, dst, dimension);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

multiplyImageAndScalar( ClearCLBuffer src, ClearCLBuffer dst, Float scalar )

Multiplies all pixels value x in a given image X with a constant scalar s.

f(x, s) = x * s

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float scalar

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float scalar = 1.0;
// Execute operation on GPU
clij.op().multiplyImageAndScalar(src, dst, scalar);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

multiplyImages( ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst )

Multiplies all pairs of pixel values x and y from two image X and Y.

f(x, y) = x * y

Parameters: ClearCLBuffer src, ClearCLBuffer src1, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
ClearCLBuffer src1 = clij.push(src1ImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().multiplyImages(src, src1, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
src1.close();
dst.close();

Example programs

multiplySliceBySliceWithScalars( ClearCLBuffer src, ClearCLBuffer dst, float[] scalars )

Multiplies all pixels value x in input image X with a scalar s given as an array with values for every z-slice.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, float[] scalars

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().multiplySliceBySliceWithScalars(src, dst, scalars);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

multiplyStackWithPlane( ClearCLBuffer input3d, ClearCLBuffer input2d, ClearCLBuffer output3d )

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

Parameters: ClearCLBuffer input3d, ClearCLBuffer input2d, ClearCLBuffer output3d

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer input3d = clij.push(input3dImagePlus);
ClearCLBuffer input2d = clij.push(input2dImagePlus);
output3d = clij.create(input3d);
// Execute operation on GPU
clij.op().multiplyStackWithPlane(input3d, input2d, output3d);
//show result
output3dImagePlus = clij.pull(output3d);
output3dImagePlus.show();

// cleanup memory on GPU
input3d.close();
input2d.close();
output3d.close();

power( ClearCLBuffer src, ClearCLBuffer dst, Float exponent )

Computes all pixels value x to the power of a given exponent a.

f(x, a) = x ^ a

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float exponent

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float exponent = 1.0;
// Execute operation on GPU
clij.op().power(src, dst, exponent);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

radialProjection( ClearCLBuffer src, ClearCLBuffer dst, Float deltaAngle )

Computes a radial projection of an image stack. Starting point for the line is the center in any X/Y-plane of a given input image stack. This operation is similar to ImageJs ‘Radial Reslice’ method but offers less flexibility.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float deltaAngle

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float deltaAngle = 1.0;
// Execute operation on GPU
clij.op().radialProjection(src, dst, deltaAngle);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

resliceBottom( ClearCLBuffer src, ClearCLBuffer dst )

Flippes Y and Z axis of an image stack. This operation is similar to ImageJs ‘Reslice [/]’ method but offers less flexibility such as interpolation.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(new long[]{src.getWidth(), src.getDepth(), src.getHeight()}, src.getNativeType());
// Execute operation on GPU
clij.op().resliceBottom(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

resliceLeft( ClearCLBuffer src, ClearCLBuffer dst )

Flippes X, Y and Z axis of an image stack. This operation is similar to ImageJs ‘Reslice [/]’ method but offers less flexibility such as interpolation.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(new long[]{src.getHeight(), src.getDepth(), src.getWidth()}, src.getNativeType());
// Execute operation on GPU
clij.op().resliceLeft(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

resliceRight( ClearCLBuffer src, ClearCLBuffer dst )

Flippes X, Y and Z axis of an image stack. This operation is similar to ImageJs ‘Reslice [/]’ method but offers less flexibility such as interpolation.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(new long[]{src.getHeight(), src.getDepth(), src.getWidth()}, src.getNativeType());
// Execute operation on GPU
clij.op().resliceRight(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

resliceTop( ClearCLBuffer src, ClearCLBuffer dst )

Flippes Y and Z axis of an image stack. This operation is similar to ImageJs ‘Reslice [/]’ method but offers less flexibility such as interpolation.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(new long[]{src.getWidth(), src.getDepth(), src.getHeight()}, src.getNativeType());
// Execute operation on GPU
clij.op().resliceTop(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

rotateLeft( ClearCLBuffer src, ClearCLBuffer dst )

Rotates a given input image by 90 degrees counter-clockwise. For that, X and Y axis of an image stack are flipped. This operation is similar to ImageJs ‘Reslice [/]’ method but offers less flexibility such as interpolation.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().rotateLeft(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

rotateRight( ClearCLBuffer src, ClearCLBuffer dst )

Rotates a given input image by 90 degrees clockwise. For that, X and Y axis of an image stack are flipped. This operation is similar to ImageJs ‘Reslice [/]’ method but offers less flexibility such as interpolation.

Parameters: ClearCLBuffer src, ClearCLBuffer dst

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
// Execute operation on GPU
clij.op().rotateRight(src, dst);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

set( ClearCLBuffer clImage, Float value )

Sets all pixel values x of a given image X to a constant value v.

f(x) = v

Parameters: ClearCLBuffer clImage, Float value

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer clImage = clij.push(clImageImagePlus);
float value = 1.0;
// Execute operation on GPU
clij.op().set(clImage, value);
//show result

// cleanup memory on GPU
clImage.close();

splitStack( ClearCLBuffer clImageIn, ClearCLBuffer… clImagesOut )

Splits an input stack into #n# image stacks.

Parameters: ClearCLBuffer clImageIn, ClearCLBuffer… clImagesOut

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer clImageIn = clij.push(clImageInImagePlus);
ClearCLBuffer clImagesOut = clij.push(clImagesOutImagePlus);
// Execute operation on GPU
clij.op().splitStack(clImageIn, clImagesOut);
//show result

// cleanup memory on GPU
clImageIn.close();
clImagesOut.close();

subtract( ClearCLBuffer source1, ClearCLBuffer source2, ClearCLBuffer destination )

Subtracts one image X from another image Y pixel wise.

f(x, y) = x - y

Parameters: ClearCLBuffer source1, ClearCLBuffer source2, ClearCLBuffer destination

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer source1 = clij.push(source1ImagePlus);
ClearCLBuffer source2 = clij.push(source2ImagePlus);
destination = clij.create(source1);
// Execute operation on GPU
clij.op().subtract(source1, source2, destination);
//show result
destinationImagePlus = clij.pull(destination);
destinationImagePlus.show();

// cleanup memory on GPU
source1.close();
source2.close();
destination.close();

Example programs

subtractImages( ClearCLBuffer subtrahend, ClearCLBuffer minuend, ClearCLBuffer destination )

Subtracts one image X from another image Y pixel wise.

f(x, y) = x - y

Parameters: ClearCLBuffer subtrahend, ClearCLBuffer minuend, ClearCLBuffer destination

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer subtrahend = clij.push(subtrahendImagePlus);
ClearCLBuffer minuend = clij.push(minuendImagePlus);
destination = clij.create(subtrahend);
// Execute operation on GPU
clij.op().subtractImages(subtrahend, minuend, destination);
//show result
destinationImagePlus = clij.pull(destination);
destinationImagePlus.show();

// cleanup memory on GPU
subtrahend.close();
minuend.close();
destination.close();

sumPixels( ClearCLBuffer clImage )

Determines the sum of all pixels in a given image. It will be stored in a new row of ImageJs Results table in the column ‘Sum’.

Parameters: ClearCLBuffer clImage

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer clImage = clij.push(clImageImagePlus);
// Execute operation on GPU
double resultSumPixels = clij.op().sumPixels(clImage);
//show result
System.out.println(resultSumPixels);

// cleanup memory on GPU
clImage.close();

sumPixelsSliceBySlice( ClearCLBuffer input )

Sums all pixels in X and Y slice by slice and returns the resulting numbers for all slices as an array.

Parameters: ClearCLBuffer input

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer input = clij.push(inputImagePlus);
// Execute operation on GPU
double[] resultSumPixelsSliceBySlice = clij.op().sumPixelsSliceBySlice(input);
//show result
System.out.println(resultSumPixelsSliceBySlice);

// cleanup memory on GPU
input.close();

sumZProjection( ClearCLBuffer clImage, ClearCLBuffer clReducedImage )

Determines the sum projection of an image along Z.

Parameters: ClearCLBuffer clImage, ClearCLBuffer clReducedImage

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer clImage = clij.push(clImageImagePlus);
ClearCLBuffer clReducedImage = clij.push(clReducedImageImagePlus);
// Execute operation on GPU
clij.op().sumZProjection(clImage, clReducedImage);
//show result

// cleanup memory on GPU
clImage.close();
clReducedImage.close();

threshold( ClearCLBuffer src, ClearCLBuffer dst, Float threshold )

Computes a binary image with pixel values 0 and 1. All pixel values x of a given input image with value larger or equal to a given threshold t will be set to 1.

f(x,t) = (1 if (x >= t); (0 otherwise))

This plugin is comparable to setting a raw threshold in ImageJ and using the ‘Convert to Mask’ menu.

Parameters: ClearCLBuffer src, ClearCLBuffer dst, Float threshold

Java example:

// init CLIJ and GPU
import net.haesleinhuepf.clij.CLIJ;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ clij = CLIJ.getInstance();

// get input parameters
ClearCLBuffer src = clij.push(srcImagePlus);
dst = clij.create(src);
float threshold = 1.0;
// Execute operation on GPU
clij.op().threshold(src, dst, threshold);
//show result
dstImagePlus = clij.pull(dst);
dstImagePlus.show();

// cleanup memory on GPU
src.close();
dst.close();

Example programs

Documented 112 methods. Back to CLIJ documentation

Imprint