ilastik / ilastik4ij

ImageJ plugins to run ilastik workflows
MIT License
22 stars 17 forks source link

New dialog for import #66

Closed m-novikov closed 3 years ago

m-novikov commented 4 years ago

Closes: #37

k-dominik commented 4 years ago

first of all cool that this works at all. I could confirm with a random h5 file that it first inspects the file and updates the dialog accordingly.

During my test-ride, I found that it doesn't seem to work with outputs from ilastik; I'll send you an example. edit: this was due to maven problems on my side which I seem to have resolved.

Traceback: ``` Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/json/JSONObject at org.ilastik.ilastik4ij.hdf5.HDF5DatasetEntryProvider.parseAxisTags(HDF5DatasetEntryProvider.java:93) at org.ilastik.ilastik4ij.hdf5.HDF5DatasetEntryProvider.getDatasetInfo(HDF5DatasetEntryProvider.java:36) at org.ilastik.ilastik4ij.hdf5.HDF5DatasetEntryProvider.findAvailableDatasets(HDF5DatasetEntryProvider.java:79) at org.ilastik.ilastik4ij.hdf5.HDF5DatasetEntryProvider.findAvailableDatasets(HDF5DatasetEntryProvider.java:26) at org.ilastik.ilastik4ij.ui.IlastikImportDialog.updateDatasets(IlastikImportDialog.java:99) at org.ilastik.ilastik4ij.ui.IlastikImportDialog.access$000(IlastikImportDialog.java:15) at org.ilastik.ilastik4ij.ui.IlastikImportDialog$1.insertUpdate(IlastikImportDialog.java:132) at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:201) at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:748) at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707) at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130) at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:669) at javax.swing.text.JTextComponent.setText(JTextComponent.java:1717) at org.ilastik.ilastik4ij.ui.IlastikImportDialog.lambda$new$1(IlastikImportDialog.java:125) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6541) at javax.swing.JComponent.processMouseEvent(JComponent.java:3325) at java.awt.Component.processEvent(Component.java:6306) at java.awt.Container.processEvent(Container.java:2237) at java.awt.Component.dispatchEventImpl(Component.java:4897) at java.awt.Container.dispatchEventImpl(Container.java:2295) at java.awt.Component.dispatchEvent(Component.java:4719) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467) at java.awt.Container.dispatchEventImpl(Container.java:2281) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4719) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90) at java.awt.EventQueue$4.run(EventQueue.java:737) at java.awt.EventQueue$4.run(EventQueue.java:735) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:734) 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) Caused by: java.lang.ClassNotFoundException: org.json.JSONObject at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 50 more ```

And second observation is the file selection widget - would it be possible to use something more native looking (like the one that is automatically used by scijava org.scijava.widget.FileWidget?)

imagesc-bot commented 4 years ago

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/combining-swing-form-and-command-parameters/41264/1

k-dominik commented 3 years ago

Hey @m-novikov, I couldn't get this to load a file via the gui (dataset, axes were detected just fine, but no matter what button I clicked the loading got cancelled).

m-novikov commented 3 years ago

Hey @m-novikov, I couldn't get this to load a file via the gui (dataset, axes were detected just fine, but no matter what button I clicked the loading got cancelled).

Sorry messed up flag logic, with the last commit it should work

k-dominik commented 3 years ago

Hi @m-novikov,

it's really cool how you managed to get everything into a single dialog. Macro recording and playback works beautifully and is almost fully compatible with the old implementation. The only pathological case I could come up is directly recording a macro in the old version, and executing this with your PR:

run("Import HDF5", "select=.../sample_data.h5 datasetname=[/test_image: (17, 37, 127, 137, 7) uint8] axisorder=tzyxc");

the "old" plugin recorded the dataset name a little bit differently, including the internal path, shape and data type. I am not sure at the moment how many macros have not removed that information, which will only work if your data doesn't change dimensions (or dtype) over different files, which, to be fair, might often be the case. So I'm not sure users would remove that because it just works. Do you think it would be hard to support this?

k-dominik commented 3 years ago

this looks good to go - @m-novikov, do you want to add anything else here?