Bug in roiManager.

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

Bug in roiManager.

Schebique
Dear developers.

I found weird behavior of roiManager which demonstrates this macro:

roiManager("reset");
run("Blobs (25K)");
setAutoThreshold("Default");
run("Create Selection");
roiManager("Add");
roiManager("Select", roiManager("Count")-1);
roiManager("Rename", "Threshold");
makePoint(97, 41);
setKeyDown("Shift");
makePoint(179, 58);
setKeyDown("Shift");
makePoint(150, 136);
setKeyDown("Shift");
makePoint(177, 181);
setKeyDown("Shift");
makePoint(60, 215);
setKeyDown("Shift");
makePoint(42, 148);
//makePoint(50, 50);
roiManager("Add");
roiManager("Select", roiManager("Count")-1);
print(roiManager("Count"));
roiManager("Rename", "Points");
roiManager("Show None");

Note, that despite roiManager("Count") return correct value of 2, second
call of roiManager("Select", roiManager("Count")-1) somehow ignore point
selections and select previous selection in roi manager.

I believe that this can lead in some cases to zero .roi packed in .zip file
created with roi manager, when composite roi and points roi are both in the
list. Unfortunately I am not able to reproduce this error in simple way,
however lower I attached console log and error log I obtained. It is likely
I have bug in my macro, but as long as there are not composite and points
rois in the list together it works correctly.

Console window: (opens first when I iterate several times through roi
manager list, examining and deleting unwanted selections)
Exception in thread "AWT-EventQueue-0"
java.lang.ArrayIndexOutOfBoundsException: 12 >= 12
    at java.util.Vector.elementAt(Vector.java:474)
    at javax.swing.DefaultListModel.getElementAt(DefaultListModel.java:89)
    at javax.swing.plaf.basic.BasicListUI.paintCell(BasicListUI.java:204)
    at javax.swing.plaf.basic.BasicListUI.paintImpl(BasicListUI.java:317)
    at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:240)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
    at javax.swing.JComponent.paintComponent(JComponent.java:780)
    at javax.swing.JComponent.paint(JComponent.java:1056)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JViewport.paint(JViewport.java:728)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JComponent._paintImmediately(JComponent.java:5169)
    at javax.swing.JComponent.paintImmediately(JComponent.java:4969)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:831)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:814)
    at java.security.AccessController.doPrivileged(Native Method)
    at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:789)
    at
javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:738)
    at javax.swing.RepaintManager.access$1200(RepaintManager.java:64)
    at
javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1732)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


Exception window: (when opening .zip with 0b file packed inside)
(Fiji Is Just) ImageJ 2.0.0-rc-49/1.51e2; Java 1.8.0_66 [64-bit]; Linux
3.13.0-24-generic; 42MB of 5400MB (<1%)

java.lang.ArrayIndexOutOfBoundsException: 0
    at ij.io.RoiDecoder.getByte(RoiDecoder.java:521)
    at ij.io.RoiDecoder.getRoi(RoiDecoder.java:151)
    at ij.plugin.frame.RoiManager.openZip(RoiManager.java:760)
    at ij.plugin.frame.RoiManager.open(RoiManager.java:726)
    at ij.plugin.frame.RoiManager.runCommand(RoiManager.java:2004)
    at ij.macro.Functions.roiManager(Functions.java:2755)
    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.doBlock(Interpreter.java:608)
    at ij.macro.Interpreter.doStatement(Interpreter.java:272)
    at ij.macro.Interpreter.doIf(Interpreter.java:966)
    at ij.macro.Interpreter.doStatement(Interpreter.java:248)
    at ij.macro.Interpreter.doIf(Interpreter.java:979)
    at ij.macro.Interpreter.doStatement(Interpreter.java:248)
    at ij.macro.Interpreter.doBlock(Interpreter.java:608)
    at ij.macro.Interpreter.doStatement(Interpreter.java:272)
    at ij.macro.Interpreter.doIf(Interpreter.java:966)
    at ij.macro.Interpreter.doStatement(Interpreter.java:248)
    at ij.macro.Interpreter.doBlock(Interpreter.java:608)
    at ij.macro.Interpreter.runUserFunction(Interpreter.java:311)
    at ij.macro.Interpreter.doUserFunctionAssignment(Interpreter.java:887)
    at ij.macro.Interpreter.doAssignment(Interpreter.java:727)
    at ij.macro.Interpreter.doStatement(Interpreter.java:245)
    at ij.macro.Interpreter.doBlock(Interpreter.java:608)
    at ij.macro.Interpreter.runUserFunction(Interpreter.java:311)
    at ij.macro.Interpreter.doStatement(Interpreter.java:233)
    at ij.macro.Interpreter.doBlock(Interpreter.java:608)
    at ij.macro.Interpreter.runMacro(Interpreter.java:143)
    at ij.macro.MacroRunner.run(MacroRunner.java:152)
    at java.lang.Thread.r un(Thread.java:745)


Thank you for fixing this or explaining me whats going on.
Sincerely Schebique
--
Mgr. Ondřej Šebesta
Laboratory of Confocal and Fluorescence Microscopy
Faculty of Science, Charles University in Prague
Vinicna 7
128 44 Prague
Czech Republic

Phone: +420 2 2195 1061
e-mail: [hidden email]

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