Scripting: the easy way to extend ImageJ

Parameterized scripting!

In [1]:
%classpath config resolver scijava.public https://maven.scijava.org/content/groups/public
%classpath add mvn net.imagej imagej 2.0.0-rc-71
ij = new net.imagej.ImageJ()
"ImageJ v${ij.getVersion()} is ready to go."
Added new repo: scijava.public
Out[1]:
ImageJ v2.0.0-rc-71 is ready to go.
In [2]:
script = """
#@String name
#@output String greeting
greeting = "Hello, " + name + "!"
"""
task = ij.script().run("hello.groovy", script, true, ["name": "Johnny"])
// it runs asynchronously! let's wait for it to complete.
module = task.get()
// let's see what it computed
module.getOutputs()