[ImageJ-devel] Scripting examples
Johannes Schindelin
Johannes.Schindelin at gmx.de
Tue Feb 18 12:06:12 CST 2014
Hi Brian,
On Tue, 18 Feb 2014, Brian Northan wrote:
> Now I am trying to understand how one should be accessing ImageJ2
> functionality from the scripts. In ImageJ1 I use the static functions in
> the IJ class, IJ.run, IJ.openImage etc.
Yeah, in IJ2 you have to use a context. The static functions of ImageJ 1.x
do not allow you to insulate separate processes from each other. That
leads to surprising results, e.g. when you try to put more than one
ImageJ 1.x applet into the same web page: it simply won't work, ever.
> So far in ImageJ2 I have been writing java applications that start by
> instantiating an ImageJ app and then use that to access services and run
> commands. Basically following the tutorials.
>
> So how are things intended to work in a script?? Is there a simpler api
> somewhere like the IJ API?? Or does one still need to use the service APIs
> in a script??
This is a work in progress right now, under heavy construction.
Eventually, something like this will work:
-- snip --
# @StatusService status
# @OUTPUT String greeting
status.showStatus(1, 2, "In progress...")
status.warn("This is a gentle warning")
status.showStatus(2, 2)
greeting = "Hello, world!"
-- snap --
In other words, your input and output parameters will be specified using a
syntax similar to ImageJ2 commands' at the top of the script.
Ciao,
Johannes
More information about the ImageJ-devel
mailing list