Fiji Java heap memory issue and the matter of efficiency advice

Hi everyone,

I am just curious to know how you analyze your images in batch.
I am currently using Ubuntu to run both Fiji and Cellprofiler in headless mode.
I finally got my code to run Fiji and Cellprofiler sequentially (headless), but I ran into an issue with “java.lang.OutOfMemoryError: Java heap space” when I was analyzing 4 images with stacks (czi file).
Before I try to figure this memory issue out, I was wondering if you could give me some advice on whether running Fiji and Cellprofiler both in headless mode to process multiple images.

Is there a more efficient way to do that?
I was originally trying to write a python code to call local libraries of both, but different python versions for both had me switch to running in headless in Ubuntu.

Any advice would be greatly appreciated!

##EDIT##
Since ImageJ Wiki is down, I was wondering if anyone has documentation for Bio-Formats plugin.
I am trying to use “Bio-Formats Macro Extensions” in Fiji macro, but I can only use a very few extensions commands that other people have posted online.
Please let me know if anyone has the documentation!
Thank you.

EDIT 2

I realized that the issue with the memory was due to opened images in Fiji (I assume). I had the macro to properly close image windows and the memory issue went away.
I also found where to look for commands for the macro extensions.
I guess my main question remains as such: Is it more efficient to run Fiji and Cellprofiler in headless mode for batch processing?
Or is it more efficient to code in python with calling separate libraries, such as
import imagej
ij.init()
ij.py.run_macro

Any advice would be greatly appreciated!
Thank you.

cheers,

You can find some simple Bio-Formats macros and plugins at https://docs.openmicroscopy.org/bio-formats/6.5.1/users/imagej/index.html

You can also use jython scripts to use the Bio-Formats API directly and depending on what you are doing this may allow you to be more efficient than using purely Macro extensions. There are some examples of using the API here: https://github.com/dgault/bio-formats-examples/tree/ngffWorkshop/src/main/macros/jython

Thank you!
That’s helpful.

V/r,
Hyun