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 422 - LSM reader doesn't work with setBatchMode(true)
LSM reader doesn't work with setBatchMode(true)
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
Macintosh Mac OS
: P2 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2012-04-27 16:18 CDT by Jan Eglinger
Modified: 2012-05-16 20:13 CDT
0 users

See Also:

Description Jan Eglinger 2012-04-27 16:18:58 CDT
Executing this macro:

setBatchMode(true); //set it to false and it will work
open("/path/to/file.lsm");
setBatchMode(false);

results in the following exception:

java.lang.NullPointerException: null
	 at org.imagearchive.lsm.reader.Reader.open(Reader.java:62)
	 at LSM_Reader.run(LSM_Reader.java:46)
	 at ij.IJ.runUserPlugIn(IJ.java:184)
	 at ij.IJ.runPlugIn(IJ.java:151)
	 at ij.IJ.runPlugIn(IJ.java:140)
	 at HandleExtraFileTypes.tryPlugIn(HandleExtraFileTypes.java:402)
	 at HandleExtraFileTypes.tryOpen(HandleExtraFileTypes.java:170)
	 at HandleExtraFileTypes.openImage(HandleExtraFileTypes.java:364)
	 at HandleExtraFileTypes.run(HandleExtraFileTypes.java:53)
	 at ij.IJ.runUserPlugIn(IJ.java:184)
	 at ij.IJ.runPlugIn(IJ.java:151)
	 at ij.IJ.runPlugIn(IJ.java:140)
	 at ij.io.Opener.openWithHandleExtraFileTypes(Opener.java:413)
	 at ij.io.Opener.openImage(Opener.java:288)
	 at ij.io.Opener.openImage(Opener.java:309)
	 at ij.io.Opener.open(Opener.java:138)
	 at ij.IJ.open(IJ.java:1482)
	 at ij.macro.Functions.open(Functions.java:2325)
	 at ij.macro.Functions.doFunction(Functions.java:141)
	 at ij.macro.Interpreter.doStatement(Interpreter.java:214)
	 at ij.macro.Interpreter.doStatements(Interpreter.java:202)
	 at ij.macro.Interpreter.run(Interpreter.java:103)
	 at ij.macro.Interpreter.run(Interpreter.java:73)
	 at CLI.Refresh_Macros.runScript(Refresh_Macros.java:56)
	 at common.RefreshScripts.runScript(RefreshScripts.java:325)
	 at fiji.scripting.TextEditor$Tab$6.execute(TextEditor.java:1216)
	 at fiji.scripting.TextEditor$Executer$1.run(TextEditor.java:1776)

As pointed out in this discussion on the fiji-users list:
https://groups.google.com/d/topic/fiji-users/hfD3PHsaQXA/discussion
a workaround is to use the Bio-Formats importer. Nevertheless, users using the Macro recorder stumble upon this issue getting the impression that the BatchMode just doesn't work as it should.

Cheers,
Jan
Comment 1 Wayne Rasband 2012-04-27 16:56:49 CDT
I am unable to reproduce this bug using the LSM_Reader included with ImageJ or with the LSM reader at

    http://imagej.nih.gov/ij/plugins/lsm-reader.html

I can reproduce it when using Fiji.

-wayne
Comment 2 Johannes Schindelin 2012-04-29 08:34:16 CDT
Wayne, executing

java -Dplugins.dir=$(pwd) -classpath jars/ij.jar ij.ImageJ -macro jan.ijm -batch

in my Fiji directory (i.e. not running any Fiji-specific stuff at all) with ij.jar just updated to 1.46m via Help>Update ImageJ (it was already at 1.46m as built by Jenkins but i updated it just to make sure), I get exactly the same issue as Jan.

Apparently, the ImagePlus instance did not get any ImageWindow yet.

I fear that the LSM Reader code is incorrect there. A fix is available here:

http://fiji.sc/cgi-bin/gitweb.cgi?p=fiji.git;a=commitdiff;h=549e80aa09a8234b12fd6519de6696fb9ff93dec
Comment 3 Johannes Schindelin 2012-05-16 20:13:33 CDT
As requested by Jerome Mutterer in a private mail, I applied the fix and uploaded a new .jar into the Updater.