Running DeconvolutionLab2 through a macro




I am new to writing macros in ImageJ and am currently trying to use the DeconvolutionLab2 plugin within a macro I am writing such that no user interaction is required (I have a large directory of images to process). My current code I am trying to use (at least the part where I think the problem lies) is below;

if(endsWith(title1, “DAPI.tif”)){
image = “-image file “+path1+””;
psf = “-psf file “+path2+””;
algorithm = “-algorithm RL 15”;
run(“DeconvolutionLab2 Run”, image+psf+algorithm);

Yet, when this runs it seems to append the psf and algorithm information onto the end of the file name such that DeconvolutionLab2 has the wrong file name and cannot open the desired file, showing the error message ‘Image: Not valid’ in the monitor window.

I have more than likely made a ridiculously silly mistake as I am new to this! I would greatly appreciate any and all help to point out where I’m going wrong - thanks in advance!



Good day Alex,

inserting print-statements may help to check for the correct file paths.




Hi Herbie,

Thank you for your response. Yes, I checked the file paths with the print statements and they are correct. I have a strong suspicion the problem lies in the line run(“DeconvolutionLab2 Run”, image+psf+algorithm). I’m working off the example from the DeconvolutionLab2 website ( for the command format. However, it doesn’t seem to work for me.

Thanks for taking the time to respond though, it is much appreciated!