java complaints in headless mode

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

java complaints in headless mode

Michael Elbaum
Hi all,


I'm running a simple macro to apply a Fourier-space filter to every slice in a stack. It runs quietly in the regular GUI mode. When I run headless there is a complaint about number formats. The sore point is in passing an integer parameter (pixel count) into a function using the &param syntax. The parameter is an integer, but it seems as if java expects a float. The error is unpleasant but not fatal. Any thoughts how to fix?

regards,
Michael




java.lang.NumberFormatException: For input string: "&fftwidth"
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
    at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
    at java.lang.Double.parseDouble(Double.java:538)
    at net.imagej.patcher.HeadlessGenericDialog.getMacroParameter(HeadlessGenericDialog.java:348)
    at net.imagej.patcher.HeadlessGenericDialog.addNumericField(HeadlessGenericDialog.java:128)
    at ij.plugin.SpecifyROI.showDialog(SpecifyROI.java:107)
    at ij.plugin.SpecifyROI.run(SpecifyROI.java:80)
    at ij.IJ.runPlugIn(IJ.java:199)
    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.doBlock(Interpreter.java:671)
    at ij.macro.Interpreter.doStatement(Interpreter.java:320)
    at ij.macro.Interpreter.doFor(Interpreter.java:593)
    at ij.macro.Interpreter.doStatement(Interpreter.java:302)
    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)




--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: java complaints in headless mode

Wayne Rasband-2
> On Feb 5, 2020, at 1:04 AM, Michael Elbaum <[hidden email]> wrote:
>
> Hi all,
>
> I'm running a simple macro to apply a Fourier-space filter to every slice in a stack. It runs quietly in the regular GUI mode. When I run headless there is a complaint about number formats. The sore point is in passing an integer parameter (pixel count) into a function using the &param syntax. The parameter is an integer, but it seems as if java expects a float. The error is unpleasant but not fatal. Any thoughts how to fix?

The HeadlessGenericDialog used by Fiji in headless mode does not support the &param parameter passing syntax so you need to change

   run("Specify...", "width=&fftwidth height=&fftheight x=150 y=150”);

in your macro to

   run("Specify...", "width="+fftwidth+" height="+fftheight+" x=150 y=150”);

Or, even better, use

   makeRectangle(150,150, fftwidth, fftheight);

-wayne

> java.lang.NumberFormatException: For input string: "&fftwidth"
>    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
>    at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
>    at java.lang.Double.parseDouble(Double.java:538)
>    at net.imagej.patcher.HeadlessGenericDialog.getMacroParameter(HeadlessGenericDialog.java:348)
>    at net.imagej.patcher.HeadlessGenericDialog.addNumericField(HeadlessGenericDialog.java:128)
>    at ij.plugin.SpecifyROI.showDialog(SpecifyROI.java:107)
>    at ij.plugin.SpecifyROI.run(SpecifyROI.java:80)
>    at ij.IJ.runPlugIn(IJ.java:199)
>    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.doBlock(Interpreter.java:671)
>    at ij.macro.Interpreter.doStatement(Interpreter.java:320)
>    at ij.macro.Interpreter.doFor(Interpreter.java:593)
>    at ij.macro.Interpreter.doStatement(Interpreter.java:302)
>    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)

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html