Fiji Headless Java Error

Can anyone makes sense of this?
I checked that the folders input/output et al work but still…

(base) dekellers-MacBook-Pro:~ dekeller$ fiji --ij2 --headless --console --run "/Users/dekeller/Desktop/NEUBIAS TS13/TS13.1.1 - Advanced ImageJ/headless/03_SciJava.ijm" 'input="/Users/dekeller/Desktop/NEUBIAS TS13/TS13.1.1 - Advanced ImageJ/images/",output="/Users/dekeller/Desktop/NEUBIAS TS13/TS13.1.1 - Advanced ImageJ/catchupOutput/"'
java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
	at java.awt.Window.<init>(Window.java:536)
	at java.awt.Frame.<init>(Frame.java:420)
	at ij.plugin.frame.PlugInFrame.<init>(PlugInFrame.java:13)
	at ij.plugin.frame.RoiManager.<init>(RoiManager.java:102)
	at ij.macro.Interpreter.getBatchModeRoiManager(Interpreter.java:2079)
	at ij.plugin.frame.RoiManager.getInstance(RoiManager.java:1867)
	at ij.macro.Functions.roiManager(Functions.java:2929)
	at ij.macro.Functions.getFunctionValue(Functions.java:231)
	at ij.macro.Interpreter.getFactor(Interpreter.java:1512)
	at ij.macro.Interpreter.getTerm(Interpreter.java:1483)
	at ij.macro.Interpreter.getStringExpression(Interpreter.java:1636)
	at ij.macro.Interpreter.getStringTerm(Interpreter.java:1440)
	at ij.macro.Interpreter.getString(Interpreter.java:1385)
	at ij.macro.Interpreter.doStatement(Interpreter.java:329)
	at ij.macro.Interpreter.doStatements(Interpreter.java:261)
	at ij.macro.Interpreter.run(Interpreter.java:157)
	at ij.macro.Interpreter.run(Interpreter.java:91)
	at ij.macro.Interpreter.run(Interpreter.java:102)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)
	at ij.IJ.runMacro(IJ.java:148)
	at ij.IJ.runMacro(IJ.java:137)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1108)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1104)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1055)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1104)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:147)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

(base) dekellers-MacBook-Pro:~ dekeller$ 

2 Likes

The ImageJ1.x ROI Manager is not compatible with headless processing, unfortunately.

There’s an issue tracking this on the imagej-legacy project:

As mentioned in this issue, you’ll have to adjust the macro to use overlays instead of ROIs to make it work in headless mode. See Overlay Functions in the macro function documentation.

1 Like