scijava / scijava-common

A plugin framework and application container with built-in extensibility mechanism :electric_plug:
BSD 2-Clause "Simplified" License
91 stars 52 forks source link

UIService UnsupportedOperationException with tif-images depending on IJ-Options #351

Open fmeyenhofer opened 5 years ago

fmeyenhofer commented 5 years ago

EDIT: with an open tif-image (drag and drop) ij-version: 1.52i

The following groovy script

#@UIService ui
#@ImgPlus img

ui.show(img)

... works when in the configuration dialog Menu > Edit > Options > ImageJ2... the checkbox Use SCIFIO when opening image files (BETA) is unchecked.
But it does not work if Use SCIFIO when opening image files (BETA) is checked and fails with the following error:

[ERROR] Exception during event handling:
    [Event] org.scijava.display.event.DisplayCreatedEvent
    context = org.scijava.Context@546263d0
    consumed = false
    object = crym(cy3)_gng2(A488)_IHC(150914)_DGC4_1 - 2016-01-28 05.03.56-FITC_ROI-00 - series 4.tif-2
    [Subscriber] org.scijava.ui.DefaultUIService [priority = 0.0]
    [Method] protected void org.scijava.ui.DefaultUIService.onEvent(org.scijava.display.event.DisplayCreatedEvent)
java.lang.UnsupportedOperationException
    at java.util.AbstractList.set(AbstractList.java:132)
    at net.imglib2.img.planar.PlanarImg.setPlane(PlanarImg.java:256)
    at net.imglib2.img.planar.PlanarImg.setPlane(PlanarImg.java:66)
    at net.imglib2.img.display.imagej.PlanarImgToVirtualStack.setPlaneCastType(PlanarImgToVirtualStack.java:168)
    at net.imglib2.img.display.imagej.PlanarImgToVirtualStack.setPixelsZeroBasedIndex(PlanarImgToVirtualStack.java:163)
    at net.imglib2.img.display.imagej.AbstractVirtualStack.setPixels(AbstractVirtualStack.java:95)
    at ij.ImagePlus.setProcessor2(ImagePlus.java:636)
    at ij.ImagePlus.setStack(ImagePlus.java:700)
    at ij.ImagePlus.<init>(ImagePlus.java:154)
    at net.imglib2.img.display.imagej.PlanarImgToVirtualStack.wrap(PlanarImgToVirtualStack.java:115)
    at net.imagej.legacy.translate.ImagePlusCreator.createImagePlus(ImagePlusCreator.java:114)
    at net.imagej.legacy.translate.ImagePlusCreator.createLegacyImage(ImagePlusCreator.java:98)
    at net.imagej.legacy.translate.ImagePlusCreator.createLegacyImage(ImagePlusCreator.java:87)
    at net.imagej.legacy.translate.ImageTranslator.createLegacyImage(ImageTranslator.java:74)
    at net.imagej.legacy.LegacyImageMap.registerDisplay(LegacyImageMap.java:267)
    at net.imagej.legacy.LegacyImageMap.registerDisplay(LegacyImageMap.java:254)
    at net.imagej.legacy.display.LegacyImageDisplayViewer.view(LegacyImageDisplayViewer.java:140)
    at net.imagej.legacy.display.LegacyImageDisplayViewer.view(LegacyImageDisplayViewer.java:109)
    at net.imagej.legacy.ui.LegacyUI$1.run(LegacyUI.java:197)
    at org.scijava.thread.DefaultThreadService.invoke(DefaultThreadService.java:114)
    at net.imagej.legacy.ui.LegacyUI.show(LegacyUI.java:193)
    at org.scijava.ui.DefaultUIService.onEvent(DefaultUIService.java:381)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:301)
    at org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:275)
    at org.bushe.swing.event.ThreadSafeEventService.publish(ThreadSafeEventService.java:971)
    at org.scijava.event.DefaultEventBus.access$101(DefaultEventBus.java:57)
    at org.scijava.event.DefaultEventBus$1.run(DefaultEventBus.java:191)
    at org.scijava.thread.DefaultThreadService$2.run(DefaultThreadService.java:221)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    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:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    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)
ctrueden commented 5 years ago

Wow, that's terrible, thanks for reporting @fmeyenhofer. I will try to reproduce and fix once I am in the office.