GPU-accelerated image processing in Icy using CLIJ
clicy is a bridge between Icy and clij.
It is recommmended to record workflows with the clij2 Recorder by calling Operations from the menu:
##Scripting For scripting GPU-accelerated workflows in Icy using JavaScript, you should first initalize the GPU:
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);
// init clicy
clij2 = CLICY.getInstance();
// check which GPU we're using
print(clij2.getGPUName());
Then, you can push sequences to GPU memory and allocate space for more images:
// get current image from Icy
sequence = getSequence();
// push image to GPU
inputBuffer = clij2.pushSequence(sequence);
// allocate memory on GPU for the result
outputBuffer = clij2.create(inputBuffer);
You can process them using the CLIJ2 API:
// process image on GPU
clij2.gaussianBlur(inputBuffer, outputBuffer, 5, 5);
Afterwards, pull the result back and show it in Icy:
// pull result back from GPU
output = clij2.pullSequence(outputBuffer);
// Show result
Icy.addSequence(output);
By the end, always clean up GPU memory:
// free memory of specific images
clij2.release(inputBuffer);
// clean up all images
clij2.clear():
Download Icy. Enter “clicy” in Icys search field on top and click on install. Voilà.
If you want to have the ClIcy toolbar as well, run the “InstallClicyToolbar” plugin:
Afterwards, a message should appear:
After restarting Icy, you should see the toolbar:
Example code for Icys script editor can be found in the javascript directory. Example Icy protocols can be found in the protocols directory. Also feel free to copy paste from the CLIJ2 documentation, it contains Icy code snippets.