When I use the FUJI GUI to run the "Apply saved SIOX segmentator" it works well, and the 'macro record' produces:
run("Apply saved SIOX segmentator", "browse=[D:\\My Documents\\My Pictures\\FISH\\seggreen.siox] siox=[D:\My Documents\My Pictures\FISH\\seggreen.siox]"); When I try to run that one-line macro I get errors: java.lang.NullPointerException at fiji.scripting.ExceptionHandler.handle(ExceptionHandler.java:102) at fiji.scripting.ExceptionHandler.handle(ExceptionHandler.java:86) at ij.IJ.handleException(IJ.java:1791) at ij.Command.runPlugIn(Command.java:149) at ij.Command.runCommand(Command.java:95) at ij.Executer.run(Executer.java:61) at ij.IJ.run(IJ.java:249) at ij.macro.Functions.doRun(Functions.java:579) at ij.macro.Functions.doFunction(Functions.java:82) I tried using a single"\" in the siox=[] part, based on a suggestion on the web, but that didn't work. Any suggestions? Charles |
Hello Charles,
It looks an error related with the script interpreter. It works fine for me in Linux. Do you run the macro from the Script Editor or from where? ignacio On Thu, Feb 9, 2012 at 2:34 PM, Anderson, Charles (DNR) < [hidden email]> wrote: > When I use the FUJI GUI to run the "Apply saved SIOX segmentator" it works > well, and the 'macro record' produces: > > run("Apply saved SIOX segmentator", "browse=[D:\\My Documents\\My > Pictures\\FISH\\seggreen.siox] siox=[D:\My Documents\My > Pictures\FISH\\seggreen.siox]"); > > When I try to run that one-line macro I get errors: > > java.lang.NullPointerException > at fiji.scripting.ExceptionHandler.handle(ExceptionHandler.java:102) > at fiji.scripting.ExceptionHandler.handle(ExceptionHandler.java:86) > at ij.IJ.handleException(IJ.java:1791) > at ij.Command.runPlugIn(Command.java:149) > at ij.Command.runCommand(Command.java:95) > at ij.Executer.run(Executer.java:61) > at ij.IJ.run(IJ.java:249) > at ij.macro.Functions.doRun(Functions.java:579) > at ij.macro.Functions.doFunction(Functions.java:82) > > I tried using a single"\" in the siox=[] part, based on a suggestion on > the web, but that didn't work. > > Any suggestions? > > Charles > -- Ignacio Arganda-Carreras, Ph.D. Seung's lab, 46-5065 Department of Brain and Cognitive Sciences Massachusetts Institute of Technology 43 Vassar St. Cambridge, MA 02139 USA Phone: (001) 617-324-3747 Website: http://bioweb.cnb.csic.es/~iarganda/index_EN.html |
In reply to this post by Anderson, Charles (DNR)
Hi Charles,
On Thu, 9 Feb 2012, Anderson, Charles (DNR) wrote: > When I use the FUJI GUI to run the "Apply saved SIOX segmentator" it works well, and the 'macro record' produces: > > run("Apply saved SIOX segmentator", "browse=[D:\\My Documents\\My Pictures\\FISH\\seggreen.siox] siox=[D:\My Documents\My Pictures\FISH\\seggreen.siox]"); > > When I try to run that one-line macro I get errors: > > java.lang.NullPointerException > at fiji.scripting.ExceptionHandler.handle(ExceptionHandler.java:102) > at fiji.scripting.ExceptionHandler.handle(ExceptionHandler.java:86) > at ij.IJ.handleException(IJ.java:1791) > at ij.Command.runPlugIn(Command.java:149) > at ij.Command.runCommand(Command.java:95) > at ij.Executer.run(Executer.java:61) > at ij.IJ.run(IJ.java:249) > at ij.macro.Functions.doRun(Functions.java:579) > at ij.macro.Functions.doFunction(Functions.java:82) I suspect that I did not get the full story (even if I think I understand that you used the Fiji distribution of ImageJ ;-) That stack trace seems to suggest that the macro was run from within the Fiji Script Editor, but that at the time of the exception, there was no editor tab left. Did you close the Script Editor while the macro was running? Did you try to restart Fiji and run the macro again? Just in case, I think I fixed the bug in the most recent changesets of the Fiji source code repository (should anybody be interested in the technical details) and uploaded a fixed Script Editor. After Help>Update Fiji, the exception handling should work even if the Script Editor was closed (since the code looked as if it did the correct thing, I added extra-defensive error handling). By the way, if you must use backslashes in strings, you should always escape them (i.e. prefix them by another backslash). So: single backslashes will almost certainly not work. Ciao, Johannes |
Thank you to the ImageJ/FIJI community and Johannes and Ignacio in particular.
I found a crude work-around based on Johannes Schindelin's comment that single backslashes in strings will almost certainly not work. (So why does the macro recorder produce single backslashes?) (And why, except for the backslashes, does it have both browse= and siox= with the same path?) I had used the plugin | macro | record feature which produced the one-line run("Apply saved SIOX segmentator", "browse=[D:\\My Documents\\My Pictures\\FISH\\seggreen.siox] siox=[D:\My Documents\My Pictures\FISH\\seggreen.siox]"); which I saved as seggreen.ijm and as seggreen.txt. [Running Windows XP Pro] Today I did the FIJI update, opened seggreen.txt, changed each single backslash '\' to a double backslash '\\', and saved that as seggreendblslash.txt. I select my image, then try 1) plugins | macros| run | select seggreen.txt or seggreen.ijm. Each fails. 2) plugins | macros | run | select seggreendblslash.txt. IT WORKS. Same general results for plugins | macros | install, and plugins | macros | edit (highlight and run) if memory serves. And you thought it was idiot proof! ;-) I did close and restart FIJI several times yesterday, although perhaps not every time I tried and failed to run the macros with single backslashes. As I'm just starting to make the transition to FIJI, I'm vastly ignorant of scripting. I have been in the habit of working with txt files and the macro editor. FIJI script editor? Editor tab? I did attempt to run the line from the macro.ijm thing, and that may have been the point I copied the error messages. Failures 1) produced these exceptions today. java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at ij.Command.runPlugIn(Command.java:146) at ij.Command.runCommand(Command.java:95) at ij.Executer.run(Executer.java:61) at ij.IJ.run(IJ.java:249) at ij.macro.Functions.doRun(Functions.java:579) at ij.macro.Functions.doFunction(Functions.java:82) at ij.macro.Interpreter.doStatement(Interpreter.java:203) at ij.macro.Interpreter.doStatements(Interpreter.java:191) at ij.macro.Interpreter.run(Interpreter.java:102) at ij.macro.Interpreter.run(Interpreter.java:72) at ij.macro.Interpreter.run(Interpreter.java:83) at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:102) at ij.plugin.Macro_Runner.runMacroFile(Macro_Runner.java:87) at ij.plugin.Macro_Runner.run(Macro_Runner.java:28) at ij.IJ.runPlugIn(IJ.java:156) at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at ij.Command.runPlugIn(Command.java:146) at ij.Command.runCommand(Command.java:95) at ij.Executer.run(Executer.java:61) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.NullPointerException at siox.Load_Segmentation.execute(Load_Segmentation.java:127) at siox.Load_Segmentation.run(Load_Segmentation.java:86) at ij.IJ.runUserPlugIn(IJ.java:183) at ij.IJ.runPlugIn(IJ.java:150) ... 25 more Hope you enjoyed the rest of the story, Johannes, or at least the part that is fit to print. Charles -----Original Message----- From: Johannes Schindelin [mailto:[hidden email]] Sent: Thursday, February 09, 2012 3:46 PM To: Anderson, Charles (DNR) Cc: [hidden email] Subject: Re: problem with Apply saved SIOX segmentator from macro Hi Charles, On Thu, 9 Feb 2012, Anderson, Charles (DNR) wrote: > When I use the FUJI GUI to run the "Apply saved SIOX segmentator" it works well, and the 'macro record' produces: > > run("Apply saved SIOX segmentator", "browse=[D:\\My Documents\\My > Pictures\\FISH\\seggreen.siox] siox=[D:\My Documents\My > Pictures\FISH\\seggreen.siox]"); > > When I try to run that one-line macro I get errors: > > java.lang.NullPointerException > at fiji.scripting.ExceptionHandler.handle(ExceptionHandler.java:102) > at fiji.scripting.ExceptionHandler.handle(ExceptionHandler.java:86) > at ij.IJ.handleException(IJ.java:1791) > at ij.Command.runPlugIn(Command.java:149) > at ij.Command.runCommand(Command.java:95) > at ij.Executer.run(Executer.java:61) > at ij.IJ.run(IJ.java:249) > at ij.macro.Functions.doRun(Functions.java:579) > at ij.macro.Functions.doFunction(Functions.java:82) I suspect that I did not get the full story (even if I think I understand that you used the Fiji distribution of ImageJ ;-) That stack trace seems to suggest that the macro was run from within the Fiji Script Editor, but that at the time of the exception, there was no editor tab left. Did you close the Script Editor while the macro was running? Did you try to restart Fiji and run the macro again? Just in case, I think I fixed the bug in the most recent changesets of the Fiji source code repository (should anybody be interested in the technical details) and uploaded a fixed Script Editor. After Help>Update Fiji, the exception handling should work even if the Script Editor was closed (since the code looked as if it did the correct thing, I added extra-defensive error handling). By the way, if you must use backslashes in strings, you should always escape them (i.e. prefix them by another backslash). So: single backslashes will almost certainly not work. Ciao, Johannes |
Free forum by Nabble | Edit this page |