From ImageJ documentation, -macro
and -batch
command line arguments should be very similar. -batch
will disable ImageJ GUI and exit ImageJ at the end of the script. run("Fill", "slice");
should have the same output in -macro
and -batch
mode.
Consider the following minimal working example, mwe.ijm
:
open("single-dot.png");
roiManager("Open", "single-dot.roi");
setAutoThreshold("Default dark");
//run("Threshold...");
//setThreshold(0, 133);
setOption("BlackBackground", false);
run("Convert to Mask");
roiManager("Select", 0); // Select ROI from file
run("Analyze Particles...", "display exclude clear include add");
run("RGB Color");
roiManager("Select", 0); // Select ROI from Analyze Particles
run("Fill", "slice");
run("Flatten");
saveAs("PNG", "output.png");
input.zip (3.6 KB) has single-dot.png
(illustrate below) and single-dot.roi
(rectangle region around the white circle).
For
$ imagej --headless --console -eval "print(getVersion());" | tail -n 1
2.1.0/1.53g
$ imagej -macro mwe.ijm && mv output.png macro.png
$ imagej -batch mwe.ijm && mv output.png batch.png
I have macro.png
and batch.png
Is this a bug? Or am I missing something from how -macro
and -batch
work?