Announcing ImageJ.JS: ImageJ running in the browser!

Hi all, I am happy to announce ImageJ.JS (https://ij.imjoy.io): ImageJ compiled into Javascript and integrated with ImJoy, please check this twitter thread for more details:

and follow our official twitter account @ImJoyTeam!

Happy to hear what you think about it and join us to make it better!

21 Likes

This is awesome! :tada:

3 Likes

Hi @oeway,

This is amazing! It’s great to see ImageJ running in browsers again, as it did for many years as a Java applet.

Could you make the JavaScript code available? I would love to see what it looks like. I tried to use CheerpJ (https://www.leaningtech.com/pages/cheerpj.html) to convert ij.jar into JavaScript, but it requires Python 3, which I don’t have on my Mac, and there does not appear to be an easy way to install it.

5 Likes

You should be able find everything in the two github repo: the js part ImageJ.JS and the java part ImageJA.JS. I wrote some rough guidelines here.

If you don’t want to compile anything locally, you can download the compiled js+html+css+jar+jar.js files-- everything you need to run ImageJ.JS locally as a zip with this link. Unzip it and serve it locally with Python:

# If you have python3
python3 -m http.server

# On windows try "python" instead of "python3", or "py -3"

# If you only have python2
python -m SimpleHTTPServer

Then go to http://127.0.0.1:8000 and you should get your local imagej.js.

Worth mentioning, if you fork the two repos, and the Github Actions CI will automatically download cheerpj, compile it and deploy.

5 Likes

Hi @oeway,

I’m continuing testing and being amazed by the open possibilities!

Let’s say we have a course with some macros in a github repo, what would be your recommendation to use ImageJ.JS:

  • rely on your instance
  • install our own version and handle it ourselves

Do you plan to have more pre-installed plugins? Like Bio-formats for example?

Thank you again for settings up this awesome tool!

Cheers,

R

4 Likes

Hi Romain,

Thanks and I am glad that you liked it!

Thanks for bringing this up, and please allow me to expand a bit to the topic first and provide my suggestion.

I think the long-term goal of ImageJ.JS is to provide Fiji-in-the-browser to be backed by a plugin server (use Github releases or potentially reusing the Fiji update site).

To get rid of “thousands” of menu items in Fiji, it will be cool to also support custom reproducible environment like MyBinder, i.e., treat browser as a docker-like environment (not completely true but more or less) and load configuration files from user’s github repo to build a customized ImageJ environment. When the user click a link point to that environment config file, all the preconfigured plugins are downloaded to the browser file system automatically. This will be ideally suited for publications and teaching purpose.

However, there are some limitations with the current cheerpj compiler runtime which prevent us from support these already: 1) we need to be able to load plugin files from user’s browser database (IndexedDB) and local file system, but it is not supported right now 2) we need to be able to patch jar files during compilation time or runtime to make sure the plugin files are compatible with the browser environment (typically the file handling part). Without this, we will need to dig into each plugin and change from their source directly, and this can be done for a few important plugins (e.g. bioformats), but not sustainable for managing many plugins. In addition, 3) we want to support progressive reading of large files (e.g. > 4GB) directly from the disk

We are discussing with the company who made the compiler to add these features and they made a rough estimation of a few weeks of work, so we are now try to secure some funding for the development. You may also wondering why we choose to use a closed source compiler, the short answer is there is no comparable open source alternative yet, but there can be soon in the future, potentially powered by WebAssembly. Also see a message here in the imagej gitter.

For now, my suggestion is to use the ij.imjoy.io version if it contains everything you need, since we will continuously working on new features and bug fixes. You don’t need to worry about the number of visitors to the website because they are just static files hosted on CDNs and Github, the site is scalable to a large number of users.

If you want to make changes (e.g. install a new plugin), feel free to fork the project and mess it around, use it for your own purpose or ideally send a PR to the official repo if you think it will be useful for larger audience. I am happy to help if you have any issue.

To include preinstalled plugin, please take a look here if you are interested in compiling yourself: https://github.com/imjoy-team/imagej.js#development

Otherwise, submit an issue: https://github.com/imjoy-team/imagej.js#install-new-imagej-plugins

To clarify, not every plugin will work directly after compilation, we only support imagej-1 plugin for now and not all of them can work out of the box. For Bioformats, I think it’s quite useful to have it, but because the size is huge, we might need to wait until we support loading plugin from browser database so we don’t need to download it everytime, and there might be other issues related to file handling. I will look into bioformats and keep you updated.

These is just what I am thinking, please feel free to contribute ideas!

5 Likes