Need help to bring web interface to Fiji/ImageJ with ImJoy

Hi all,

As a complementary solution to current image analysis software, ImJoy bridges web technology and the Python ecosystem. We have been thinking about extending the support to Fiji/ImageJ, to take advantage of the current advancement of the Fiji/ImageJ world. On the other hand, we will be able to add web interface to Fiji/ImageJ scripts/plugins easily.

Specifically, the goal is to support a new ImJoy plugin type written in any/most of the supported Fiji scripting languages, these plugins will be able to interact with ImJoy and other plugins through the api object. I have created an github issue to track the progress of this:

A critical design in ImJoy is to enforce the separation of UI and computational backend, this allows user to use any device with browser including mobile phone to interact with the computational part running on a desktop, workstation or remote servers.

ImJoy currently support the following computational backends: webworker (JS), web-python (powered by pyodide), and native-python(powered by ImJoy-Engine). Despite the differences of these backends, we still support a set of unified api for all the backends.

Implementing the Fiji/ImageJ backend will be similar as the ImJoy Python Engine. The easiest way to support ImageJ backend is to port this worker template file to ImageJ ( as in Jython). We also need to add socketio client to imagej.

For each ImJoy plugin with type=imagej, we will launch a subprocess from the plugin engine. It will be just a command like ./ImageJ-linux64 -Xss2m -- /path/to/

In principle this will give us a minimal visible product(MVP) relatively soon.
However, to make it complete, there is still some problem hard to solve, ideally we would like to use conda to manage the virtual environment for Fiji and also solve fiji plugin dependency just like in Python.

However, I am not sure whether this is possible, easy or hard to support. I myself have very limited experience in working with Fiji/ImageJ, would be great that if someone experienced could provide some suggestions, ideally working with me to solve this.

  1. How to make Fiji work in the conda virtual environments? Potentially, we can just use (conda install -c bioconda fiji), but I have no idea how to run the Fiji installed by conda.

  2. For the Fiji instance in each conda virtual environment, is there an alternative to pip install XXXX_plugin to pull plugins from fiji update website?

  3. Which data type in Fiji is the most suitable for exchange nd-arrays with the web interface? In python we encode numpy array into a dictionary object with shape, dtype and the raw bytes (implementation), can we do the same for nd-images?

Please provide your comment/suggestion on how to proceed, thanks in advance.


I did not know that Fiji was on bioconda !
I know that you can now have ImageJ in a Jupyter notebook, maybe you would find some useful information
Maybe something for @imagejan or @ctrueden to comment on.

1 Like

@oeway Very sorry for the long delay in reply!

I also was unaware about the bioconda packaging of Fiji. It is not an officially supported thing, so be careful with it.

If you are looking for a way to access Java functionality from Python, I’d suggest to use scyjava, which leans on jgo, to download Java components from remote Maven repositories and load them into Python via pyjnius. This is how pyimagej works.

If you want to access ImageJ from JavaScript, I’d point you at the imagej-node project. It uses node-java. And you can load Maven artifacts from remote repositories using node-java-maven.

The imagej-node project would definitely benefit from continued development. Please feel welcome to hack on it, since I think ImJoy could be a good use case for it. (My original reason for creating it was to create an ImageJ-powered Electron app, but I haven’t had time to pursue it lately.)

By using Maven, you don’t have to repackage everything for conda—we have talked about doing that but it is a tall order and I think it’s easier to lean on Maven as much as possible, since the entire core ImageJ and Fiji ecosystems are published successfully that way already.

The PyImageJ project includes conversion between NumPy arrays and ImgLib2 images. So you could look at that as a starting point. The closest thing ImageJ has to a metadata-rich image exchange format is OME-TIFF, which you can write using the SCIFIO library. But it really depends what metadata you need. If all you want to exchange is raw pixels, it will be easier to invent your own thing.