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 1220 - RoiEncoder throws NullPointerException when saving multipoint selections
RoiEncoder throws NullPointerException when saving multipoint selections
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: ImageJ1
unspecified
All All
: P5 normal
Assigned To: Wayne Rasband
Depends on:
Blocks:
 
Reported: 2016-02-02 06:06 CST by Jan Eglinger
Modified: 2016-02-03 21:19 CST
1 user (show)

See Also:

Description Jan Eglinger 2016-02-02 06:06:43 CST
Here's a macro to reproduce the issue (just select a few points and click ok on the two dialogs):

    run("Fluorescent Cells (400K)");

    setTool("multipoint");
    run("Select None");
    waitForUser("Select points. Then press 'OK'");
    run("Add to Manager");
    run("Select None");
    c=roiManager("count");
    roiManager("select", c-1);
    roiManager("Rename", "points1");

    makePoint(0, 0);
    run("Add to Manager");
    run("Select None");
    c=roiManager("count");
    roiManager("select", c-1);
    roiManager("Rename", "single_point");

    setTool("multipoint");
    run("Select None");
    waitForUser("Select more points. Then press 'OK'");
    run("Add to Manager");
    run("Select None");
    c=roiManager("count");
    roiManager("select", c-1);
    roiManager("Rename", "points2");

    roiManager("Save", getDirectory("temp") + File.separator + "test_rois.zip");


This will throw the exception below (using up-to-date Fiji as well as the Dec 2015 life-line version), tested on Windows and Mac OSX. The behavior is specific to multi-channel images.
Everything works fine when using the Nov 2014 life-line version of Fiji.


    (Fiji Is Just) ImageJ 2.0.0-rc-44/1.50e; Java 1.8.0_66 [64-bit]; Windows 7 6.1; 425MB of 96000MB (<1%)
 
    java.lang.NullPointerException
	at ij.io.RoiEncoder.putPointCounters(RoiEncoder.java:409)
	at ij.io.RoiEncoder.putHeader2(RoiEncoder.java:384)
	at ij.io.RoiEncoder.write(RoiEncoder.java:230)
	at ij.io.RoiEncoder.write(RoiEncoder.java:56)
	at ij.plugin.frame.RoiManager.saveMultiple(RoiManager.java:827)
	at ij.plugin.frame.RoiManager.save(RoiManager.java:2036)
	at ij.plugin.frame.RoiManager.runCommand(RoiManager.java:1931)
	at ij.macro.Functions.roiManager(Functions.java:2729)
	at ij.macro.Functions.getFunctionValue(Functions.java:230)
	at ij.macro.Interpreter.getFactor(Interpreter.java:1385)
	at ij.macro.Interpreter.getTerm(Interpreter.java:1356)
	at ij.macro.Interpreter.getStringExpression(Interpreter.java:1496)
	at ij.macro.Interpreter.getStringTerm(Interpreter.java:1315)
	at ij.macro.Interpreter.getString(Interpreter.java:1272)
	at ij.macro.Interpreter.doStatement(Interpreter.java:281)
	at ij.macro.Interpreter.doStatements(Interpreter.java:218)
	at ij.macro.Interpreter.run(Interpreter.java:115)
	at ij.macro.Interpreter.run(Interpreter.java:85)
	at ij.macro.Interpreter.run(Interpreter.java:96)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:153)
	at ij.IJ.runMacro(IJ.java:129)
	at ij.IJ.runMacro(IJ.java:118)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:936)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:933)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:899)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:933)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:116)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:163)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:174)
	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:191)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Comment 1 Wayne Rasband 2016-02-03 21:19:43 CST
This bug is fixed in the latest ImageJ daily build (1.50g12).