Jython scripting using Visual Studio Code Editor

Hi, I like to move forward from ImageJ macros to developing plugins. Python is my choice for the script language. I want to use the Visual Studio Code Editor for writing scripts and have succeeded in installing the editor. Next I downloaded and installed Jython 2.7.0 and selected that as the interpreter to use in the VS editor.

But now I bumped into the next step. How to let FIJI/ImageJ start or use the VS editor and environment instead of the build-in editor?

Hello Martin -

I’m not aware of a way to tell Fiji to use a custom editor. (There might
be one – I just don’t know.)

However, I think of plugins as completed pieces of code, rather than
individual lines of code that get run (interpreted) one by one as you
type them in. So it makes perfect sense (to me) to write plugins in
an editor that is not attached to Fiji.

Specifically, Visual Studio (like other IDEs) has a notion of a build
process (e.g., compile, link, install). In the case of python, there’s
no compilation, so all you need is to “install” your plugin by copying
it to Fiji’s plugins directory.

So your build process could potentially be as simple as a single

copy my_plugin.py <path_to_fijis_plugin_directory>

Start Visual Studio and edit and “build” your plugin. Start (or
restart) Fiji so it picks up the new version of your plugin, and run
your plugin from the Plugins menu, Plugins > my plugin.

The only “linkage” between Fiji and your editor is that your “build”
command copies your plugin to Fiji’s plugins directory, but that’s
all you need. It’s annoying to have to restart Fiji when you add or
modify a plugin, but I’m not aware of any way to avoid this step.
(You could try to get fancy and add a “kill Fiji / start Fiji” step to
your build process, but I never felt this was worth the bother.)

Thanks, mm

Good day,

a more general question/comment regarding:

I like to move forward from ImageJ macros to developing plugins.

ImageJ-plugins, at least those coded the ImageJ-1 way, are coded exclusively in Java and not in a scripting language. (Not sure how things look like for ImageJ-2.)



Hi @kostermw,

welcome on the path from IJ macro to IJ plugins :wink: Before you start walking a path that nobody explored yet (Visual Studio plays no big role in ImageJ development and python is also not the most common way for plugin development), may I point you to a little video a student at MPI CBG did to introduce people to how plugins are made:

This video reflects the most common way of how to develop plugins for ImageJ and Fiji these days. But any working alternate path is welcome! So in case you continue with Visual Studio, please let us know how it’s going!