Ticket #1478 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

Overlay harmonization might cause issues

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b7-ndim-data
Component: Legacy Compatibility Version: 2.0.0-beta4
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #285, #1484, #1563

Description

Open Boats. Run Salt and Pepper. Despeckle. Salt/pepper pixels go away.

Open Boats. Find Maxima (takes a long time). Run Salt and Pepper. Despeckle. Salt/pepper pixels don't go away. It may be running and not finishing before I give up. Or not.

Change History

comment:1 Changed 7 years ago by bdezonia

  • Blocking 1459 added

comment:2 Changed 7 years ago by bdezonia

I've spent a lot of effort debugging this. I've verified that the despeckle command is changing pixels in both cases but if the Find Maxima command was run before then the difference in pixels is quite small. I can't exactly determine why yet.

I did verify that no commands are hung up. All of them complete.

Note that commenting out the OverlayHarmonizer calls in Harmonizer "fixes" the problem. So that part of harmonization is key.

Moving the order of overlay harmonization in the Harmonizer code to before pixel harmonization doesn't make any difference.

Note however that overlay harmonization, when it happens, tries to display the overlays through the DefaultOverlayService which calls ImageDisplay::display(overlay). This does a rebuild() every time an OverlayView is added. In this case, with Boats, that is over 1400 times. This presents a problem by itself (there is a ticket to create 1 multipoint overlay rather than 1400 of them) but the excessive display()'ing might lead to an event storm that messes up display/imageplus synchronization.

Last edited 7 years ago by bdezonia (previous) (diff)

comment:3 Changed 7 years ago by bdezonia

  • Blocking 285, 1484 added; 1459 removed

comment:4 Changed 7 years ago by bdezonia

Moved to beta 6 as this involves ROIs and we may be changing the overlay harmonization scheme then anyways

comment:5 Changed 7 years ago by bdezonia

  • Milestone changed from imagej-2.0.0-beta5 to imagej-2.0.0-beta6

comment:6 Changed 7 years ago by bdezonia

Note that the issue seems fixed pre beta 6. But there is another issue: comodification errors. Doing the same set of steps (open boats, find maxima and wait, run S&P, despeckle) looks correct. But exceptions can be thrown during process:

Uncaught exception in thread Thread[AWT-EventQueue-0,6,main]
java.util.ConcurrentModificationException

at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at imagej.display.AbstractDisplay.toString(AbstractDisplay.java:93)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at imagej.display.event.DisplayEvent.toString(DisplayEvent.java:62)
at imagej.display.event.input.InputEvent.toString(InputEvent.java:78)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at imagej.event.DefaultEventBus$1.run(DefaultEventBus.java:199)
at imagej.thread.DefaultThreadService.invoke(DefaultThreadService.java:86)
at imagej.event.DefaultEventBus.publishNow(DefaultEventBus.java:195)
at imagej.event.DefaultEventBus.publishNow(DefaultEventBus.java:87)
at imagej.event.DefaultEventService.publish(DefaultEventService.java:79)
at imagej.ui.common.awt.AWTInputEventDispatcher.mouseMoved(AWTInputEventDispatcher.java:261)
at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:313)
at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:312)
at java.awt.Component.processMouseMotionEvent(Component.java:6427)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3293)
at java.awt.Component.processEvent(Component.java:6151)
at java.awt.Container.processEvent(Container.java:2083)
at java.awt.Component.dispatchEventImpl(Component.java:4744)
at java.awt.Container.dispatchEventImpl(Container.java:2141)
at java.awt.Component.dispatchEvent(Component.java:4572)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4619)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4293)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4210)
at java.awt.Container.dispatchEventImpl(Container.java:2127)
at java.awt.Window.dispatchEventImpl(Window.java:2489)
at java.awt.Component.dispatchEvent(Component.java:4572)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:704)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:663)
at java.awt.EventQueue$2.run(EventQueue.java:661)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:677)
at java.awt.EventQueue$3.run(EventQueue.java:675)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:674)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

ImageJ 1.x plugin threw exception
java.util.ConcurrentModificationException

at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at imagej.data.display.DefaultImageDisplay.update(DefaultImageDisplay.java:259)
at imagej.data.display.DefaultOverlayService.removeOverlay(DefaultOverlayService.java:172)
at imagej.legacy.translate.OverlayHarmonizer.updateDisplay(OverlayHarmonizer.java:120)
at imagej.legacy.translate.Harmonizer.updateDisplay(Harmonizer.java:195)
at imagej.legacy.plugin.LegacyCommand$LegacyCommandThread.updateDisplaysFromImagePluses(LegacyCommand.java:375)
at imagej.legacy.plugin.LegacyCommand$LegacyCommandThread.run(LegacyCommand.java:213)

comment:7 Changed 6 years ago by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from imagej2-b9-rois to imagej2-b6-legacy-undo

The comodification errors are being handled by ticket #1606.

Note that the issue here is that the maintenance of the point overlays is very time consuming (which is detailed in ticket #1103). So each harmonization back from IJ1 deletes all the overlays and adds them again (totaling hundreds or more display rebuild events). So the code might be in the harmonizing state when Despeckle is run and pixel harmonization has not yet correctly happened. However locking of ImagesPluses and Displays would fix this somewhat too (this part of the issue is documented in ticket #1192).

There is nothing specific to this ticket that is not handled elsewhere. Closing.

comment:8 Changed 6 years ago by bdezonia

  • Milestone changed from imagej2-b6-legacy-undo to imagej2-b9-rois

comment:9 Changed 6 years ago by bdezonia

  • Blocking 1563 added
  • Milestone changed from imagej2-b9-rois to imagej2-b7-ndim-data
Note: See TracTickets for help on using tickets.