Batch processing in Headless mode

Tags: #<Tag:0x00007fa300772978> #<Tag:0x00007fa300772838>


Let say I have a nice macro, that takes one image as input and perform some processing.
Now I want to apply this processing to a bunch of images ie Batch processing, in headless mode since
the commands will be called by another program.

I though of 2 ways of doing this :

1) Calling the macro in headless mode as many time as there are images
Yet, I was wondering if this could be slow because some ImageJ routine is initialised and closed every time.
Unless if there are some flag that I can add in the command to prevent the closing of the underlying ImageJ processes.

2) Using an extra batch-processing macro
So that I only do one command line call to Fiji, and this batch macro itself calls the routine script. This would prevent to initialise/terminate the Fiji process every time.

Yet in the second option I loop sequentially on the image while in the first option maybe I can call the script with another image before the previous one is over, doing some kind of parallel execution to some extent.

What about with other programming languages ? let say I use a real python installation, is it fine to do

python -Image1
python -Image2

or is it better to have

python -ImageList.txt