[ImageJ-devel] Scripts calling scripts with @Parameters

Curtis Rueden ctrueden at wisc.edu
Wed Aug 26 21:44:10 CDT 2015


Hi again Jan,

I have now changed the macro recording to generate the correct string, with
image title as the value [1]. So when you record your Print Title script,
you will now see:

  run("Print Title", "imp=blobs.gif name=Jan");

And executing that line will repeat the action as expected.

These changes will be released and uploaded within the next few days.

Regards,
Curtis

[1]
https://github.com/imagej/imagej-legacy/commit/61a004c40988581529c35c0d1e312b0d20c0a7bb

On Wed, Aug 26, 2015 at 5:16 PM, Curtis Rueden <ctrueden at wisc.edu> wrote:

> 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/221e9f66/attachment.html>


More information about the ImageJ-devel mailing list