imagej / imagej-server

A RESTful web server for ImageJ [EXPERIMENTAL]
Apache License 2.0
39 stars 17 forks source link

Imglib plugins no longer available via ImageJ Server #21

Open PetrBainar opened 6 years ago

PetrBainar commented 6 years ago

Hi all,

A couple of days ago, the ImageJ Server has been improved by @ctrueden and become an ImageJ extension with great plugins allowing the user to start or to stop the server, for example.

However, some modules are no longer available via ImageJ Server. For example, I used to rotate images via the net.imagej.plugins.commands.imglib.RotateImageXY plugin, but it looks like that no imglib plugins are found by the respective service anymore.

Is this a bug or rather a logical consequence of other things? Can anyone see this plugin listed in his/her environment?

Many thanks for your help.

Best regards, Petr

ctrueden commented 6 years ago

Firstly, note that the class net.imagej.plugins.commands.imglib.RotateImageXY is part of imagej-plugins-commands. (I discerned this by searching on maven.imagej.net.) This component is part of the standard ImageJ distribution, shipped via the Java-8 update site. It is highly likely to be present in your installation.

I believe the issue here is the no-legacy tag, which tells ImageJ not to expose this module when running in legacy mode. The idea was to suppress these ImageJ2-only commands when ImageJ1 equivalents were also available. Unfortunately, the current scheme suppresses these modules completely (see here), such that they are not available via the server, either.

Off the top of my head I do not have an easy workaround. We could change this blacklisting logic to keep them out of the menus, but still keep them in the module index. But IIRC, the reason they were removed from the index is because it confused users who searched e.g. for "Duplicate" in the search bar, and got both ij.plugin.Duplicator and net.imagej.plugins.commands.DuplicateImage as matches. The former is the IJ1 plugin, and the latter is the IJ2 replacement. The IJ2 version is what should be available via the ImageJ Server. So maybe what is needed is an ImageJ-Server-specific hack to reintroduce these modules only from the server? But my instincts are telling me such a solution would be wrong.

PetrBainar commented 6 years ago

Thank you very much @ctrueden for your detailed answer.

I have tried to switch ImageJ into the modern mode as well as to launch it with the --ij2 argument but neither seemed to have any effect on modules availability via the ImageJ Server.

Do you think that introducing a console argument responsible for not blacklisting no-legacy modules would be a viable option? For example, starting ImageJ with --allModules argument would cause ModuleService to add all modules back again? Such implementation of ConsoleArgument could be part of the ImageJ Server package, leaving the rest of the environment relatively untouched.

ctrueden commented 6 years ago

Good idea, @PetrBainar. With imagej/imagej-legacy@23998c27264237a569f1a9bb9352e3568bb4c6ce there is now a system property you can set to suppress the blacklisting behavior. Invoke from the CLI via something like this:

Fiji.app/Contents/MacOS/ImageJ-macosx -Dimagej.legacy.modernOnlyCommands=true -- --server

It would still be nice to find a nicer way to make these commands available from the server without exposing them in the legacy UI, though. I'll leave this issue open for now as a reminder to solve this problem in a better way.

PetrBainar commented 6 years ago

Thank you very much @ctrueden for implementing the workaround, it works like a charm!

PetrBainar commented 6 years ago

Just bumping this thread to let everyone know that this functionality is available in image-legacy-0.30.0.