ilastik / ilastik4ij

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

update pom scijava and adds converter from String to Dataset #52

Closed NicoKiaru closed 4 years ago

NicoKiaru commented 4 years ago

Adds a converter needed for IJ1 macro scripting:

Converts a String (provided by an IJ1 macro script) to a Dataset by delegating the conversion to a String to ImagePlus converter chained to an {@link ImagePlus} to {@link Dataset} converter

This converter should be removed once this issue : https://github.com/imagej/imagej-legacy/issues/246 is resolved

See also : https://forum.image.sc/t/plugin-with-two-datasets-parameters-will-always-pop-up-gui-in-macro-runs/36637/11

https://forum.image.sc/t/object-classification-using-the-ilastik-plugin-for-fiji/32997

I did not try completely whether all issues were resolved with this - can you test whether that solves the batch issues you were mentioning @k-dominik ?

@imagejan I tried to put as much documentation as possible on the converter and also post on the issue in imagej-legacy. What do you think ? Does that sound reasonable for the moment ?

k-dominik commented 4 years ago

Okay I want to give this a spin before merging. After the maven build I copied the jar to my fiji plugins. When starting fiji I then get the following error:

```java [ERROR] Cannot create plugin: class='org.ilastik.ilastik4ij.util.StringToDatasetConverter', priority=10000.0, enabled=true, pluginType=Converter org.scijava.InstantiableException: Class not found: org.ilastik.ilastik4ij.util.StringToDatasetConverter at org.scijava.plugin.PluginInfo.loadClass(PluginInfo.java:292) at org.scijava.plugin.PluginInfo.createInstance(PluginInfo.java:301) at org.scijava.plugin.DefaultPluginService.createInstance(DefaultPluginService.java:237) at org.scijava.plugin.DefaultPluginService.createInstances(DefaultPluginService.java:226) at org.scijava.plugin.DefaultPluginService.createInstancesOfType(DefaultPluginService.java:217) at org.scijava.plugin.AbstractSingletonService.initInstances(AbstractSingletonService.java:138) at org.scijava.plugin.AbstractSingletonService.getInstances(AbstractSingletonService.java:77) at org.scijava.plugin.HandlerService.getHandler(HandlerService.java:59) at org.scijava.util.ConversionUtils.handler(ConversionUtils.java:222) at org.scijava.util.ConversionUtils.convert(ConversionUtils.java:91) at org.scijava.command.CommandModuleItem.tValue(CommandModuleItem.java:257) at org.scijava.command.CommandModuleItem.tValue(CommandModuleItem.java:251) at org.scijava.command.CommandModuleItem.getMinimumValue(CommandModuleItem.java:143) at org.scijava.module.DefaultMutableModuleItem.(DefaultMutableModuleItem.java:125) at org.scijava.command.DynamicCommandInfo.copy(DynamicCommandInfo.java:314) at org.scijava.command.DynamicCommandInfo.populateItems(DynamicCommandInfo.java:305) at org.scijava.command.DynamicCommandInfo.(DynamicCommandInfo.java:74) at org.scijava.command.DynamicCommand.getInfo(DynamicCommand.java:83) at org.scijava.options.OptionsPlugin.load(OptionsPlugin.java:90) at org.scijava.options.DefaultOptionsService.getInstances(DefaultOptionsService.java:84) at org.scijava.plugin.SingletonService.lambda$initialize$0(SingletonService.java:97) at org.scijava.object.ObjectIndex.resolvePending(ObjectIndex.java:388) at org.scijava.object.ObjectIndex.get(ObjectIndex.java:133) at org.scijava.object.DefaultObjectService.getObjects(DefaultObjectService.java:87) at org.scijava.display.DefaultDisplayService.getDisplays(DefaultDisplayService.java:166) at org.scijava.ui.DefaultUIService.showUI(DefaultUIService.java:159) at org.scijava.ui.DefaultUIService.showUI(DefaultUIService.java:142) at org.scijava.AbstractGateway.launch(AbstractGateway.java:104) at net.imagej.Main.main(Main.java:55) 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 net.imagej.launcher.ClassLauncher.launch(ClassLauncher.java:279) at net.imagej.launcher.ClassLauncher.run(ClassLauncher.java:186) at net.imagej.launcher.ClassLauncher.main(ClassLauncher.java:77) Caused by: java.lang.IllegalArgumentException: Cannot load class: org.ilastik.ilastik4ij.util.StringToDatasetConverter at org.scijava.util.Types.iae(Types.java:975) at org.scijava.util.Types.load(Types.java:234) at org.scijava.plugin.PluginInfo.loadClass(PluginInfo.java:286) ... 35 more Caused by: java.lang.NoClassDefFoundError: org/scijava/convert/AbstractDelegateConverter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.scijava.util.Types.load(Types.java:226) ... 36 more Caused by: java.lang.ClassNotFoundException: org.scijava.convert.AbstractDelegateConverter at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 49 more ```

any hint on how I would get this to work?

NicoKiaru commented 4 years ago

Ah, I believe it's the bumping to pom-scijava 28.0.0 that was required for the AbstractDelegateConverter, and which did not exist in previous version.

I guess your FIJI is up-to-date @k-dominik but can you confirm it ?

This probably means that Fiji is not yet using scijava 28, do you think it's the case @imagejan ?

I could change the converter to use the old API... for now

imagejan commented 4 years ago

This probably means that Fiji is not yet using scijava 28

The goal is to synchronize the state of the Java-8 update site with the current maven release, but currently, Fiji ships scijava-common-2.80.1.jar, whereas the AbstractDelegateConverter is only available with version 2.81.0 and later.

Uploads of all the core components to the update site will like have to wait until mid-July.

So for now, I suggest to ship your dependencies on your update site and let them shadow the respective jars from the Java-8 update site. But of course, implementing it with older API is also an option.

k-dominik commented 4 years ago

So for now, I suggest to ship your dependencies on your update site and let them shadow the respective jars from the Java-8 update site.

Hey, so for me, not being fully immersed in the fiji/ij/scijava world, what would this actually mean? Would everyone who installs the ilastik plugin also then install our scijava package (and would, in turn all the plugins for this person "link" against it)?

k-dominik commented 4 years ago

tested and it works!!! Thank you very much @NicoKiaru