ImageJ macro code for publication

Hi all,

I’ve begun working on a paper that describes a method for characterizing particles and want to make the macro publicly available.

  • I’ve read that the best way to make the macro available is through an update site, is this correct? it’s about 200 lines of code.
  • I’ve read that plugins can be 40 times faster than macros, is this true? can this be done by just translating the code to javascript? How easy is it to do this translation?
  • Other tips?

Thanks!

One common way to publish your macro code would be to publish it on Github, Bitbucket, Gitlab or sourceforge. On these sites you can easily create a documentation and citations with markdown.

Yes, plugins can be faster. Is this essential for your code? If you need a faster version the excellent CLIJ plugin from @haesleinhuepf might help (which is a good Github example by the way).

The JavaScript language is very similar to the macro syntax. E.g., I created a macro parser for an ImageJ plugin where I reused a JavaScript parser. However the macro language comes with many default specialized methods (Macro API) which you would have to recode.

I created an Eclipse plugin for ImageJ which is bundled with my application Bio7.

The plugin integrates several advanced macro editor functions like code templates, macro parser for errors, code formatter, etc. You might find it useful to beautify your code and find some hidden syntactical errors (I found some in other available macros). It also comes with a full featured debugger GUI interface, see:

In Eclipse or Bio7 you can then install the egit plugin easily (In some Eclipse variations it is installed already) to upload your macro code directly to Github, Gitlab, etc. In Bio7 markdown (or LaTeX, HTML, etc.) is supported, too to document your code. There are also other Eclipse markdown plugins available.

3 Likes

Welcome to the forum, @Arne!

For a single file shared at the time of publication, without plans to maintain (and possibly improve) it over years, an update site is not necessary (in my opinion). I second the advice by @Bio7 to put it on GitHub and/or directly include it as a supplement to your paper.

Of course, if your code is very general and useful for others, and you expect improvements/feedback from the community as well, it’s certainly a good idea to 1) have the source code on GitHub (for other contributors) and 2) ship it via an update site (for users).

That doesn’t generalize. It all depends on the implementation. The ImageJ macro language is super fast for many applications, but it also depends on which plugins/commands you are calling in the macro.

To gain performance by direct calls into the Java API, or to achieve parallelization of demanding computations, a full-fledged scripting language (such as e.g. Groovy) is fully sufficient as well, and saves you the effort of writing an elaborate plugin.

Migrating from macro to a full-fledged scripting language is certainly doable, and in most cases straight-forward, but there can be obstacles depending on your task. For publication of a method description, I suggest to not invest too much effort in the first place. If it turns out to be useful, others might want to contribute, or you might want to improve performance, then you can still go that route.

In any case, I suggest making the code public and then ask here on the forum for advice how to improve/translate it.

3 Likes

Thank you both for your extensive answers. Really appreciate it! Will be working with GitHub and if the future requires a faster code I’ll do it then.

Best regards,
Arne