CLIJ2 is a Fiji plugin for GPU-accelerated image processing based on OpenCL. However, it is not necessary to learn OpenCL. CLIJ2 has about 300 predefined functions allowing you to process your images on the GPU.
It is recommended to use it from Fiji script editor using the ImageJ macro language. For the ease of use, auto-completion is enabled for editing CLIJ2 workflows.
Furthermore, CLIJ2 has its own menu:
Plugins > ImageJ on GPU (CLIJ2) with sub menus offering all CLIJ functionality.
When clicking on the menu, you see a dialog asking for the parameters of the specific CLIJ operation. Furthermore, user documentation and parameter exlanation is given in the same dialog.
CLIJ is fully macro-recordable. After recording your workflow, it can be executed right away. Download video
Furthermore, CLIJ2 offers operations for filtering images with non-square shaped pixels managed using the new graph-based processing operations.
CLIJ2 operations use the by-reference concept which is well known in ImageJ macro for images and other parameters. Undefined variables can be passed over and will hold values after the operation finished. This allows simplifying code.
// CLIJ Ext.CLIJ_centerOfMass(binary); mx = getResult("MassX", nResults() - 1); my = getResult("MassY", nResults() - 1); // -------------------------- // CLIJ2 Ext.CLIJ2_getCenterOfMass(binary, mx, my, _);
CLIJ2 offers various methods for easier workflow debugging such has handling arrays and strings
// push array as 2x3 image array = newArray(1, 2, 3, 4, 5, 6); Ext.CLIJ2_pushArray(input, array, 2, 3, 1); // do something with it Ext.CLIJ2_multiplyImageAndScalar(input, result, 3); // print output image Ext.CLIJ2_print(result);
To find out which operations take how much time, you can collect time traces: ```// do something while recording processing duration Ext.CLIJ2_startTimeTracing(); Ext.CLIJ2_multiplyImageAndScalar(input, result, 3); Ext.CLIJ2_stopTimeTracing();
// print out how long operations took Ext.CLIJ2_getTimeTracing(time_traces); print(time_traces);
![image](/clij2-docs/images/time_tracing.png) ### Memory management for Java/Jython/Groovy/JavasSript developers Developers can name images and buffers and list memory consumption
CLIJ2 clij2 = CLIJ2.getInstance();
ClearCLBuffer data = clij2.create(100, 100); data.setName(“My data”);
GPU contains 1 images.
Also the method
clij2.clear(); is new compared to CLIJ, it releases all images/buffers in GPU memory.
The CLIJ2 website offers extensive documentation and tutorials.
The cheat sheets have been updated to list new CLIJ2 operations.