ome / openmicroscopy

OME (Open Microscopy Environment) develops open-source software and data format standards for the storage and manipulation of biological light microscopy data. A joint project between universities, research establishments and industry in Europe and the USA, OME has over 20 active researchers with strong links to the microscopy community. Funded by private and public research grants, OME has been a major force on the international microscopy stage since 2000.
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
202 stars 102 forks source link

Importing images from ImageJ fails if they are loaded from non-OME TIFFs #4033

Closed stelfrich closed 9 years ago

stelfrich commented 9 years ago

It is not possible to import images that have been loaded from a TIFF file to OMERO with OMERO.insight-ij.5.1.3. The result is an exception:

[Fatal Error] :1:1: Content is not allowed in prolog.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at org.openmicroscopy.shoola.env.data.model.FileObject.isNewImage(FileObject.java:264)
    at org.openmicroscopy.shoola.agents.fsimporter.chooser.FileSelectionTable.allowAddToQueue(FileSelectionTable.java:399)
    at org.openmicroscopy.shoola.agents.fsimporter.chooser.FileSelectionTable.addFiles(FileSelectionTable.java:579)
    at org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.addImageJFiles(ImportDialog.java:1608)
    at org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.propertyChange(ImportDialog.java:1671)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
    at java.awt.Component.firePropertyChange(Component.java:8154)
    at org.openmicroscopy.shoola.agents.fsimporter.chooser.LocationDialog.actionPerformed(LocationDialog.java:950)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
    at java.awt.Component.processMouseEvent(Component.java:6289)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6054)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4652)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4482)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4482)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
    at java.awt.EventQueue.access$000(EventQueue.java:85)
    at java.awt.EventQueue$1.run(EventQueue.java:603)
    at java.awt.EventQueue$1.run(EventQueue.java:601)
    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$2.run(EventQueue.java:617)
    at java.awt.EventQueue$2.run(EventQueue.java:615)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

I have tracked down the issue to commit 0c39c236a0e7fa07513f89b22734f20a5e20c714, where the method isNewImage() is introduced. The method makes the assumption in L259 that info.description returns a description that is well formed XML (which is true for files loaded from OME-TIFF). This seems not to be the case for files that have been stored to plain TIFF with ImageJ, as the description for such files usually looks like this:

ImageJ=1.50a
images=50
frames=50
unit=micron
finterval=1200.4774169921875
loop=false
min=2126.0
max=16383.0

To reproduce the issue, open any image an save it to TIFF. After loading that image, try to save that image to OMERO (Plugins > OMERO > Save Image(s) to OMERO).

jburel commented 9 years ago

Thanks for reporting the issue. I will have a look at it.

stelfrich commented 9 years ago

@jburel If you need any help, let me know! I am working on improving the import of ROIs at the moment and I don't really want to rebase that on 5.1.2 just to rebase it again once that bug is fixed..

jburel commented 9 years ago

@stelfrich: note that I have also made small changes on roi handling both on OMERO side and Bio-Formats side. see https://github.com/openmicroscopy/openmicroscopy/pull/4032 and https://github.com/openmicroscopy/bioformats/pull/1924

jburel commented 9 years ago

Fixed see gh-4034