CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

convertRGBStackToGraySlice

Converts a three channel image (stack with three slices) to a single channel image (2D image) by multiplying with factors 0.299, 0.587, 0.114.

Availability: Available in Fiji by activating the update sites clij and clij2. This function is part of clijx_-0.32.0.1.jar.

Usage in ImageJ macro

Ext.CLIJx_convertRGBStackToGraySlice(Image stack_source, Image slice_destination);

Usage in object oriented programming languages

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

// get input parameters
ClearCLBuffer stack_source = clijx.push(stack_sourceImagePlus);
slice_destination = clijx.create(stack_source);
// Execute operation on GPU
clijx.convertRGBStackToGraySlice(stack_source, slice_destination);
// show result
slice_destinationImagePlus = clijx.pull(slice_destination);
slice_destinationImagePlus.show();

// cleanup memory on GPU
clijx.release(stack_source);
clijx.release(slice_destination);
Matlab
% init CLIJ and GPU
clijx = init_clatlabx();

% get input parameters
stack_source = clijx.pushMat(stack_source_matrix);
slice_destination = clijx.create(stack_source);
% Execute operation on GPU
clijx.convertRGBStackToGraySlice(stack_source, slice_destination);
% show result
slice_destination = clijx.pullMat(slice_destination)

% cleanup memory on GPU
clijx.release(stack_source);
clijx.release(slice_destination);

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint