[ImageJ-devel] Scripts calling scripts with @Parameters

Curtis Rueden ctrueden at wisc.edu
Wed Aug 26 17:16:59 CDT 2015


Hi Jan,

> Is there a way to configure an ImagePlus (or Dataset or File) in this
> case?

Thanks for reporting this issue!

It is (partially) fixed in:
https://github.com/imagej/imagej-legacy/commit/8cc4e7f37777bfe4d391e147d515238a8d0eaa23

At the moment, you will have to write:

  imp=blobs.gif

Or:

  imp=-2

(where -2 is the image ID you want)

instead of the string generated by the recorder.

I guess we could make that string (which is what ImagePlus.toString()
produces, probably) work as well, if you feel strongly. Though IMO it just
clutters the macro.

Regards,
Curtis

On Wed, Aug 26, 2015 at 9:46 AM, Jan Eglinger <jan.eglinger at gmail.com>
wrote:

> Hi all,
>
> how can I call a script using @Parameters (e.g. @ij.ImagePlus) from
> another script? Is this possible already?
>
> I tried the following Javascript:
>
>     // @ij.ImagePlus imp
>     // @String name
>     // @OUTPUT String result
>
>     result = "Hello, " + name + ", the title is " + imp.getTitle();
>
>
> and saved it into ./plugins/Print_Title.js
> When I run it, the macro recorder records something like:
>
>     IJ.run(imp, "Print Title", "imp=[img[blobs.gif (256x254x1x1x1)]]
> name=Jan");
>
>
> When I now run this (Beanshell) script (with blobs.gif still open):
>
>     import ij.IJ;
>
>     imp = IJ.getImage();
>     IJ.run(imp, "Print Title", "imp=[img[blobs.gif (256x254x1x1x1)]]
> name=Jan");
>
> the String is initialized correctly, but `imp` seems to be `null`.
> (Leaving away the imp=.. yields an error "'imp' is required but unset.")
>
> Is there a way to configure an ImagePlus (or Dataset or File) in this case?
>
> Thx,
> Jan
>
> _______________________________________________
> ImageJ-devel mailing list
> ImageJ-devel at imagej.net
> http://imagej.net/mailman/listinfo/imagej-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20150826/8ddb3200/attachment.html>


More information about the ImageJ-devel mailing list