Issue with PolygonROI

imagej1
imagej
roi
polygon

#1

Hey developers,

I’m having a issue with code of an old plugin which was working until recently and now throws error messages. It has something to do with ImageJ1 PolygonRoi, and likely with this commit:

It is very hard to build a minimum working example. Also because the line number in the thrown message apparently doesn’t match any reasonable line to what’s distributed in the ij1.52g.jar. Furthermore, current pom-scijava distributes ij1.52e.jar.

Exception in thread "Run$_AWT-EventQueue-0" java.lang.NullPointerException
	at ij.gui.PolygonRoi.getTracedPerimeter(PolygonRoi.java:1252)
	at ij.gui.PolygonRoi.getLength(PolygonRoi.java:1287)
	at ij.gui.Roi.equals(Roi.java:1872)
	at java.util.Vector.indexOf(Vector.java:411)
	at java.util.Vector.contains(Vector.java:370)
	at ij.gui.Overlay.contains(Overlay.java:106)
	at ij.gui.Roi.isActiveOverlayRoi(Roi.java:1859)
	at ij.gui.PolygonRoi.draw(PolygonRoi.java:198)
	at ij.gui.ImageCanvas.drawRoi(ImageCanvas.java:275)
	at ij.gui.ImageCanvas.paintDoubleBuffered(ImageCanvas.java:536)
	at ij.gui.ImageCanvas.paint(ImageCanvas.java:218)
	at ij.gui.ImageCanvas.update(ImageCanvas.java:205)
	at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)
	at sun.awt.RepaintArea.paint(RepaintArea.java:232)
	at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:358)
	at java.awt.Component.dispatchEventImpl(Component.java:4965)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	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:74)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
	at java.awt.EventQueue$4.run(EventQueue.java:733)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	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)

The error appears, when Polygons are drawn in an overlay of a multi-channel/multi-slice image. But again, the related code lives deep inside a plugin and I wasn’t able to make a minimum working example. Does anybody (@Wayne maybe?) know, what might go wrong in PolgronRoi.java at line 1252?

Thanks!

Cheers,
Robert


#2

Try the latest ImageJ daily build (1.52h35). It adds a bug fix that may prevent this exception. View the code changes at


#3

Hi @wayne,

great! That solved the issue :slight_smile:

Thanks for that light-speed fast bugfix!

Cheers,
Robert