Use Extended Depth of Focus (BIG) in macro

Tags: #<Tag:0x00007fa30471cf10> #<Tag:0x00007fa30471cdd0>


I would like to use the expert mode EDF from BIG in a macro, the recorder returns only :"Extended Depth of Field (Expert mode)...", "")
which opens the GUI to set up the projection, but then pressing ok does not generate a new entry in the recorder…

The idea would be to skip the GUI and run directly the projection with a set of parameters.
I think I read a post once about the macro execution of this edf plugin but I cant find it anymore.


The EDF plugin was programmed without any macro scriptability in mind, obviously. It uses its own custom GUI (instead of ImageJ’s GenericDialog) and is therefore not recordable with the macro recorder.

Looking at the source code, you should however be able to call the ExtendedDepthOfField class and interact with its API directly:

new ExtendedDepthOfField(imp, parameters).process()


Cool that was a bit easier than what I though, here is the result with Jython. I only changed the detection method to Variance and checked the size of the window for the variance but all other attribute of parameters can be edited the same way.

#@ImagePlus imp
from edfgui import Parameters, ExtendedDepthOfField 

# Create and setup the Parameters object
param = Parameters()

# List its attributes or see
#print dir(param)

# Set projection method
param.edfMethod = 1    # 0=Sobel, 1=Variance, 2=RealWavelet (default), 3=ComplexWavelet
#print param.edfMethod  # worked

# Check window size for Variance
#print param.varWindowSize # Window size for Variance 3(default), 5, 7 or 9

# Create and set up the EDF object
EDF = ExtendedDepthOfField(imp,param)

# Run the projection (can takeseveral seconds depending on the stack size)
# it seems like nothing is happening but the cpu/ram load should increase
EDF.process() # returns void, only display the image

However, the process method do not return the imp object, only display it, which is not so convenient for a batch processing…
Do you think I could suggest a modification of the source code on GitHub ?
I am not confident in my java skills to do it myself but I could maybe raise an issue :thinking:


The BIG-EPFL plugins aren’t being developed in this github organization (fiji-BIG), but in the Biomedical Imaging Group at EPFL. The reason that the fiji-BIG github org exists is because Fiji once got the permission from the authors to distribute the BIG plugins with Fiji. But that does not mean that they are open-source licensed. In fact they still are under a restrictive license:

That means that for any change that you make to this software, you’ll have to ask the original authors for permission to distribute it. This makes cooperative development a bit cumbersome, because you cannot rely on a license granting you the right to distribute the result of your contributions.

Your best bet might be to ask the authors directly (@daniel.sage is registered on this forum, but I don’t know if he is actively following; for the other authors’ contacts, please see the plugin homepage).