SciJava equivalent to `Interpreter.setAdditionalFunctions()`

Tags: #<Tag:0x00007fb881cacce0> #<Tag:0x00007fb881cacb50>


Hi all,

A while back, we made a small IJ1 plugin that could load and expand on the ImageJ macros by calling
Interpreter.setAdditionalFunctions(String someIJ1functions)

Seeing all that’s done with Contexts, finding scripts, and the likes, is there a more ImageJ2 way of doing this?

I was diving into the org.scijava.plugins.scripting classes, and looking at the ScriptService to see if I could do the same kind of thing, but have not found much of relevance.

We are fine with the current way of doing things, but if we could Register new macro functions from a text file so that any macro interpreter launched on this instance of Fiji could have access to them in a better way, I’m happy to be pointed in the right direction.




Thanks for pointing to that method of Interpreter, I didn’t know this one yet :slight_smile:

I think for extending the IJ1 Macro language that’s still the easiest way to go.

That goes in the direction of autoincludes as suggested by @ctrueden here:

But as he says, that can be dangerous (similiar to auto-imports) because it makes the behavior of your macros dependent on the current state/configuration of ImageJ.

I would rather prefer requiring an #@ include ("myFunctions") annotation inside those macros that want to use common modules.