Python(Jython) script to run DeconvolutionLab2 and Coloc2 from Fiji

Hello everyone, I am new to this website.

I have been working for almost 6 years with confocal microscopy images using ImageJ (Fiji) and recently started to create some scripts to automate some of the processing I do to a lot of individual images of cells. I made progress with some things but, I have not been able to get the Python code to run the DeconvolutionLab2 and Coloc2 plug-ins.

I know there is an option to record macros and some plug-ins (like DeconvolutionLab2) have a tab with some code for scripting, but nothing I’ve tried has worked (DL2 gave me some code in Python but didn’t work when I pasted it in the developer/editor window on Fiji). I have seen with the macro recorder a Java code for those plug-ins (I ran it in Fiji’s developer and works), but I really need in Python(Jython) and I don’t know how to translate that to be able to run it from the Fiji developer window.

Does anyone know how to do this or somewhere I can find the code? (I already tried to find it in the plug-in website and lots of forums, first time asking for help). Thanks in advance.

Hi and welcome to the forum !
In theory you can use the recorded Java code almost directly using Jython, after reformating to respect the python syntax (removing the { }, the new keywords and reformating the import statements).
For the latter, if you have import package.class.* in java it can be turned into from package.class import * in python.

I put here to the link to the scripting doc, but also have a look at the dedicated Jython section :wink:
Good luck !