CLIJ deconvolution

Hi, I have been trying to use the CLIJ Richardson-Lucy deconvolution plugin on my 3D stacks without success. DeconvolutionLab2 works fine, but takes forever, so I thought I would try the CLIJ approach. However, the CLIJ Deconvolution plugin crashes Fiji on my Mac (48 GB 1066 MHz DDR3, 2 x 2.4 GHz Quad-Core Intel Xeon, ATI Radeon HD 5770 1024 MB, running High Sierra 10.13.6). As a basic test, I tried it on a stack made from channel 2 of the “Confocal Series” sample file, using a PSF made using Cookbook > Deconvolution > Diffraction PSF 3D. Still crashes.

1 Like

Hi @Guy,

thanks for trying out CLIJ and reporting back! Would you mind sharing the error message you observed? Furthermore, depending on the size of the PSF image, it might take quite a while, also using CLIJ. A faster deconvolution plugin is on the way - we actually have a thread here in the forum where we discuss about it.

In another thread, there are also other options discussed, for example deconvolution using ImageJ-ops:

Maybe you want to give this a try as well?

Let us know if this helps.

Cheers,
Robert

2 Likes

Hi @Guy

I’ve compiled some instructions that show how to install and run a CLIJ compatible OpenCL deconvolution. The instructions are here

Unfortunately this may not be of use for you, as I don’t have a Mac version. The plugin has some native (ie c++) parts that need to compiled for each specific operating system, and I don’t have access to a Mac. I’ll have to start thinking about how to build a Mac version…

If you have access to a Windows or Linux machine I could get you a fast OpenCL deconvolution.

Alternitively you can try out the script @haesleinhuepf referenced. It’s much slower than the OpenCl version, but is pure java so should work fine on a Mac.

Brian

3 Likes

Hi @haesleinhuepf, @bnorthan,

First of all, thanks for developing the CLIJ initiative - it should be a game-changer for desk-top image analysis. Slow processing during analysis can be more time-limiting for me and other biologists than data acquisition. I’m looking forward to trying the CLIJ TrainableWeka segmentation, too.

@haesleinhuepf, there is no error message from Fiji - it’s a straight crash before it gets to send a message. I have attached a system report of the crash. I’ll try the Python script.

@bnorthan, the PSF file was 150 x 150 x 25 (X, Y, Z). Is this a reasonable size? I am waiting for a Windows desktop with some grunt to be delivered. When it arrives, I could try the OpenCL deconvolution method you mentioned. No telling when it will arrive, though, with the current situation for international manufacturing and transportation.

Mac OS-X Crash report:

CLIJ_deconv_crash_sys_report.txt (232.5 KB)

1 Like

Hi @Guy,

I just googled this graphics card: It’s from 2009, right? So I would assume it’s just too old for decent GPU-acceleration. Of course, Fiji shouldn’t crash, but I’d say fixing bugs related to hardware which goes out of the market is not worth the effort. Sorry for the inconvenience.

Furthermore, with its 1GB of memory, you could anyway just process pretty small images. I’d suggest we wait for your Windows system to arrive :wink:

Let me know how it goes on this one!
Cheers,
Robert

Hi @bnorthan

thank you very much for putting together these instructions. I was interested in running the CLIJ example (on Windows):

As per instructions I downloaded the *.jars and copied them into the jars directory of a vanilla Fiji with clij and clij2 update sites installed.
Whenever prompted, I overwrote existing jars.
I then run the python script on your test images, but this fails with an error:

  File "V:\CLIJDecon\CLIJDecon.py", line 28, in <module>
    gpuImg = OpenCLFFTUtility.padInputFFTAndPush(imgF, imgF, ops, clij);
AttributeError: type object 'net.imagej.ops.experiments.filter.deconvolve.OpenC' has no attribute 'padInputFFTAndPush'

	at org.python.core.Py.AttributeError(Py.java:207)
	at org.python.core.PyType.noAttributeError(PyType.java:1994)
	at org.python.core.PyObject.__getattr__(PyObject.java:1027)
	at org.python.pycode._pyx0.f$0(V:/CLIJDecon/CLIJDecon.py:41)
	at org.python.pycode._pyx0.call_function(V:/CLIJDecon/CLIJDecon.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1614)
	at org.python.core.__builtin__.eval(__builtin__.java:497)
	at org.python.core.__builtin__.eval(__builtin__.java:501)
	at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

according to this error report 'net.imagej.ops.experiments.filter.deconvolve.OpenC' is truncated,but suppose that is not the issue since the module imported fine. It seems to rather not be able to find padInputFFTAndPush, which is confusing to me since its clearly there at least on github.
do you have an idea what might have gone wrong in my case? Thank you for your help.

1 Like

Hi @CellKai

I just tested on a fresh install of Fiji… I downloaded a brand new copy, activated the CLIJ update site, then copied over the jars I have on drop box. It seemed to work. Can you check over the versions of all clij related jars, as well as imglib2, and javacpp and verify they are the same as mine and also that you only have one copy of each??

image

1 Like

Hi,

thank you for the reply!

i have done just that, one more time, but the the same error persits. I have the following jars in Fiji.app/jars:

  • clij-ops-1.5.8
  • clij-core-1.5.8
  • clij-coremem-0.6.0
  • clij-clearcl-0.10.10
  • imglib2-5.8.0
  • imglib2-5.6.3 (i deleted this one as well for a test but the error remained)
  • javacpp-1.4.4

If it is not too inconvenient, could you maybe share your entire Fiji.app folder with me, in case you have a working installation for Windows? Maybe it would help to test if there is something more general missing on my end.
Thank you for your help!

1 Like

Hi @CellKai

I just uploaded a copy of the Fiji.app folder I was testing in into the windows-march-27-2020 folder.

What type of graphics card do you have?? I may have messed up the script a bit, in that I am trying to select an ‘RTX’ device. Try running this line in a different script and see if it works…

print CLIJ.getAvailableDeviceNames();

If so change the clij = CLIJ.getInstance("RTX"); call so that gets your card type (I think you just have to replace “RTX” with part of the name of your card, @haesleinhuepf can clarify).

1 Like

You can enter anything there, or just nothing: clij = CLIJ.getInstance();. If you enter something like RTX, it will try to find a GPU containing that name. If none is found, it picks the first one found. You find this and some more CLIJ basics explained in the macro intro. Java/Jython/Groovy specific stuff is explained on the website as well.

Hi @bnorthan

thank you for the kind reply and upload of your Fiji.app folder.

I wanted to run the script directly with your Fiji installation, but unfortunately I got errors when opening the script, as if the script editor was missing in this installation. I could not open this or any script (e.g., ctrl+shift+n did not open the editor but gave an error).

I updated the installation, after which I could run the script as per usual, but I received the same error.

Thanks also @haesleinhuepf for jumping in, I indeed already priviously changed the line to clij = CLIJ.getInstance(); as you have outlined in your nice clij macro intro. For completeness, my card is [GRID RTX8000-6Q].
I am sorry for this hard to troubleshoot problem, and I really appreciate your help!

1 Like

Hey @CellKai,

thanks for trying with us. I’m about to bundle everything and make it easy-to-install and use…

In the meantime, would you mind testing if a simple Gaussian Blur (Menu Plugins > ImageJ on GPU > Filter > Blur 2D on GPU) works on images. Such as the Blobs example image (File > Samples > Blobs)?

We had some issues with GPUs having “GRID” in their name… :wink: It’s a virtual machine you are running on, right? Or some cluster system?

Thanks for your patience!

Cheers,
Robert

Hi @haesleinhuepf
no problem, I am happy to help if I can. CLIJ is really a fantastic project!
Blur 2D on GPU works without problem, see screenshot below:

that’s correct, yes :). Let me know if you need further details on that.

1 Like

I will :wink: Would you in the meantime send me this RTX8000 via mail? :wink:

1 Like

Hi @CellKai

I just noticed that the version of the script I put on drop-box is different than the one on git… that was my bad. I should of made sure they were synced.

Can you see if the drop-box one here works??

It seems I can now repeat the error you are seeing, when I use the git version. I’ll figure out what is happening and let you know.

1 Like

Hi @CellKai and @bnorthan,

alternatively, just update Fiji. All necessary files are shipped via the CLIJ2 update site. You can then run this script:

This should work on Windows and Mac, Intel and NVidia. Technical details here.

Thanks again for testing, feedback, support and patience! :wink:

Cheers,
Robert

1 Like

Hi again @haesleinhuepf and @bnorthan, thank you so much for your help and the updates!
I now tried:

and was successful :star_struck:

very cool!

2 Likes

I know. @bnorthan programmed it and he made also my dreams come true! :star_struck:

1 Like

thank you both again for this great effort @bnorthan @haesleinhuepf!

I tested the second test-image in @bnorthan’s drop-box, for which the CLIJ script seems to work fine as well, at least it runs without any error message that I could see:

However, the resulting deconvolved image seems to be empty/all black.

Do you know what might be the issue here? Thank you again for all the support and this cool project!

1 Like

Hi @CellKai

When you have a moment could you try the original version of the script from here.

I think the issue may have something to do with a small extra factor that needs to be added to the extended size, to make sure it is a CLFFT compatible size.

@haesleinhuepf do you get additional debugging info when running the decon plugin from your IDE??

I am outputting some error information from the native part, and I know it shows up in the Eclipse Console but not the ImageJ log. If you run the CElegans image and PSF does it work for you??

1 Like