Bug in MaximaFinder headless mode

Dear @Wayne,

I think we found a bug in the MaximaFinder relevant only in headless mode. When running this macro:

run("Blobs (25K)");
run("Find Maxima...", "prominence=10 output=[Point Selection]");

Using this command line:

C:\Programs\fiji-win64\Fiji.app\ImageJ-win64.exe --console --headless -macro C:\structure\temp\findMaxima.ijm

I get this error message:

java.lang.NullPointerException
        at ij.plugin.filter.MaximumFinder.analyzeAndMarkMaxima(MaximumFinder.java:816)
        at ij.plugin.filter.MaximumFinder.findMaxima(MaximumFinder.java:516)
        at ij.plugin.filter.MaximumFinder.run(MaximumFinder.java:226)
        at ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.java:266)
        at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:114)
        at ij.IJ.runPlugIn(IJ.java:201)
        at ij.Executer.runCommand(Executer.java:137)
        at ij.Executer.run(Executer.java:66)
        at ij.IJ.run(IJ.java:312)
        at ij.IJ.run(IJ.java:323)
        at ij.macro.Functions.doRun(Functions.java:624)
        at ij.macro.Functions.doFunction(Functions.java:97)
        at ij.macro.Interpreter.doStatement(Interpreter.java:275)
        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.plugin.Macro_Runner.runMacroFile(Macro_Runner.java:145)
        at ij.IJ.runMacroFile(IJ.java:160)
        at net.imagej.legacy.IJ1Helper$4.call(IJ1Helper.java:1125)
        at net.imagej.legacy.IJ1Helper$4.call(IJ1Helper.java:1121)
        at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1055)
        at net.imagej.legacy.IJ1Helper.runMacroFile(IJ1Helper.java:1121)
        at net.imagej.legacy.LegacyCommandline$Macro.handle(LegacyCommandline.java:187)
        at org.scijava.console.DefaultConsoleService.processArgs(DefaultConsoleService.java:102)
        at org.scijava.AbstractGateway.launch(AbstractGateway.java:97)
        at net.imagej.Main.main(Main.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at net.imagej.launcher.ClassLauncher.launch(ClassLauncher.java:279)
        at net.imagej.launcher.ClassLauncher.run(ClassLauncher.java:186)
        at net.imagej.launcher.ClassLauncher.main(ClassLauncher.java:77)

Pointing at this line:

I also would have a suggestion for a bug fix: Changing line 815 (one above) to this:

if (previewing && messageArea != null)

fixes the bug.

What do you think - does that make sense? If yes, could you please incorporate this in ImageJ?

Thanks!

Cheers,
Robert

This bug fix is in the latest ImageJ daily build (1.52q31).

1 Like

Great, thanks @Wayne!