Making ImJoy plugins with Fiji scripts for running remotely

Hi, I posted this in the scijava gitter channel, and now think maybe here would be a good place to share this progress.

Thanks to @ctrueden 's kind help, you can now build ImJoy plugins with Fiji scripts (including imagej macro, javascript, groovy etc.), and this make it easier to launch Fiji plugins remotely while controlled with your browser.

This is done via a PyImageJ based SciJava plugin engine for ImJoy to support Fiji scripts, source code here.

Here is an hello world example plugin in ImJoy:

<config lang="json">
{
  "name": "FijiScriptHelloWorld",
  "type": "scijava",
  "tags": [],
  "ui": "",
  "version": "0.1.0",
  "cover": "",
  "description": "A hello world example for running fiji script in ImJoy.",
  "icon": "extension",
  "inputs": null,
  "outputs": null,
  "api_version": "0.1.8",
  "env": "",
  "permissions": [],
  "requirements": [],
  "dependencies": ["https://gist.githubusercontent.com/oeway/157b970d2ab993084a2ac650197c077c/raw/SciJavaEngine.imjoy.html"]
}
</config>

<script lang="ijm">
 
#@ String name
#@ int age
#@ String city
#@output Object greeting
greeting = "Hi " + name + ". You are " + age + " years old, and live in " + city + "."

</script>

Try this with the Binder engine by clicking: https://imjoy.io/#/app?plugin=https://gist.githubusercontent.com/oeway/157b970d2ab993084a2ac650197c077c/raw/FijiScriptHelloWorld.imjoy.html&workspace=scijava

You just need to wait for a while to let Binder spin up a PyImageJ server for you, then click the hello world example in the plugin menu.

Also feel free to you click the icon beside the plugin name and choose “Edit” if you want to play with the code.

As you see, this enables running SciJava/Fiji script in ImJoy as a plugin, and the #@ notion will be rendered as a form in HTML.

The next steps are:

  1. support render UI form for more data types (currently only numbers and strings)
  2. support solving dependencies of the script via imagej.init() function, this will be useful when your Fiji scripts requires some extra plugin to be loaded.
  3. support interacting with all other imjoy plugins, such that you can for example, show a 3D volume from the Fiji scripts with the Kaibu image viewer (powered by itk-vtk-viewer @thewtex ) or the vitessce image viewer(by Ilan Gold and Trevor Manz) in your browser (while having the Fiji running remotely on a server).

Please feel free to try it out and let me know what you think.

7 Likes

Awesome progress, @oeway! :bouquet: :star_struck: :1st_place_medal: :trophy: :beers: