NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 958 - Gray Morphology throws exception in Batch Mode
Gray Morphology throws exception in Batch Mode
Status: CONFIRMED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
Macintosh Mac OS
: P4 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2014-11-11 14:15 CST by stealthyspambox
Modified: 2014-11-12 08:12 CST
2 users (show)

See Also:

Description stealthyspambox 2014-11-11 14:15:39 CST
The following example macro script throws an exception on my Mac.  The exception is copied below.

myImage = File.openDialog("Choose Image");
setBatchMode(true);
open(myImage);
run("Gray Morphology", "radius=1 type=circle operator=erode");
setBatchMode(false);

Here is the exception:
(Fiji Is Just) ImageJ 2.0.0-rc-15/1.49k; Java 1.6.0_65 [64-bit]; Mac OS X 10.9.5; 30MB of 4283MB (<1%)
 
java.lang.NullPointerException
	at GrayMorphology_.setup(GrayMorphology_.java:89)
	at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:47)
	at ij.IJ.runUserPlugIn(IJ.java:204)
	at ij.IJ.runPlugIn(IJ.java:166)
	at ij.Executer.runCommand(Executer.java:131)
	at ij.Executer.run(Executer.java:64)
	at ij.IJ.run(IJ.java:272)
	at ij.macro.Functions.doRun(Functions.java:591)
	at ij.macro.Functions.doFunction(Functions.java:89)
	at ij.macro.Interpreter.doStatement(Interpreter.java:226)
	at ij.macro.Interpreter.doStatements(Interpreter.java:214)
	at ij.macro.Interpreter.run(Interpreter.java:111)
	at ij.macro.Interpreter.run(Interpreter.java:81)
	at ij.macro.Interpreter.run(Interpreter.java:92)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:153)
	at ij.IJ.runMacro(IJ.java:119)
	at ij.IJ.runMacro(IJ.java:108)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:782)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:116)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:156)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
	at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:164)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
	at java.lang.Thread.run(Thread.java:695)

Information about your version of Java:

  os.arch => x86_64
  os.name => Mac OS X
  os.version => 10.9.5
  java.version => 1.6.0_65
  java.vendor => Apple Inc.
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.6.0_65-b14-462-11M4609
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 20.65-b04-462
  java.vm.vendor => Apple Inc.
  java.vm.info => mixed mode
  java.awt.graphicsenv => apple.awt.CGraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.6
  sun.cpu.endian => little
  sun.desktop => null
  file.separator => /

The up-to-date check says: REMIND_LATER

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: null
  imagej.dir => /Users/jameskrom/Applications/Fiji/Fiji.app

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20141110001443)
Fiji: http://fiji.sc/update/ (last check:20141110105222)
Comment 1 Mark Hiner 2014-11-12 08:12:01 CST
I did some quick debugging and it is not clear why this error is occurring as, according to my debugger, nothing is null at that point.

However, I did notice that this only happens for me when batchMode is true. Are you trying to write a plugin that operates on many images? You could potentially work around this issue by removing the two setBatchMode calls from your script, until it is fully diagnosed and resolved.