Return value to macro from java plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Return value to macro from java plugin

jumpfunky
Hi,

it is possible to return a value from an imagej java plugin to an imagej
macro?

I've written an imagej plugin which estimates the noise sigma from a
single image. What I want to do inside the macro is:

sigma = MyNoiseEstimationPlugin();

Is that possible?

Cheers,
Thorsten

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Return value to macro from java plugin

Gabriel Landini
On Sunday 30 Nov 2014 15:25:39 Thorsten Wagner wrote:

> it is possible to return a value from an imagej java plugin to an imagej
> macro?

You can  set a 'property' to the image that you are processing from a plugin
or macro and then get that property from another macro:

http://rsb.info.nih.gov/ij/plugins/imp-props.html

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Return value to macro from java plugin

Niko Ehrenfeuchter
Hi Thorsten,

On 30.11.2014 15:46, Gabriel Landini wrote:
> On Sunday 30 Nov 2014 15:25:39 Thorsten Wagner wrote:
>
>> it is possible to return a value from an imagej java plugin to an imagej
>> macro?
>
> You can  set a 'property' to the image that you are processing from a plugin
> or macro and then get that property from another macro:
>
> http://rsb.info.nih.gov/ij/plugins/imp-props.html

you might also consider using JavaScript instead of the ImageJ Macro
Language in such a case. It's still pretty simple and straightforward,
and can even be generated by the ImageJ Macro Recorder.

Cheers
Niko

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Return value to macro from java plugin

Michael Schmid
>> On Sunday 30 Nov 2014 15:25:39 Thorsten Wagner wrote:
>>
>>> it is possible to return a value from an imagej java plugin to an
>>> imagej macro?
>
> On 30.11.2014 15:46, Gabriel Landini wrote:
>>
>> You can  set a 'property' to the image that you are processing from a
>> plugin
>> or macro and then get that property from another macro:
>>
>> http://rsb.info.nih.gov/ij/plugins/imp-props.html

On Sun, November 30, 2014 16:10, Niko Ehrenfeuchter wrote:
>
> you might also consider using JavaScript instead of the ImageJ Macro
> Language in such a case. It's still pretty simple and straightforward,
> and can even be generated by the ImageJ Macro Recorder.

Hi Thorsten,

one more possibility: you can return a String value in a static method of
the macro:

result = call("myClass.myMethod", arg1, arg2, ...);

Your plugin (here 'myClass.java') should have a method
    public static myMethod(String arg1, String arg2, ...)

Of course, the Strings may be also numbers converted to Strings.

Michael

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Return value to macro from java plugin

jumpfunky
Hi Michael,

that is what I was looking for! Thanks!

Thank you Gabriel and Niko for your answers too!

Cheers,
Thorsten


Am Sonntag, den 30.11.2014, 17:32 +0100 schrieb Michael Schmid:

> >> On Sunday 30 Nov 2014 15:25:39 Thorsten Wagner wrote:
> >>
> >>> it is possible to return a value from an imagej java plugin to an
> >>> imagej macro?
> >
> > On 30.11.2014 15:46, Gabriel Landini wrote:
> >>
> >> You can  set a 'property' to the image that you are processing from a
> >> plugin
> >> or macro and then get that property from another macro:
> >>
> >> http://rsb.info.nih.gov/ij/plugins/imp-props.html
>
> On Sun, November 30, 2014 16:10, Niko Ehrenfeuchter wrote:
> >
> > you might also consider using JavaScript instead of the ImageJ Macro
> > Language in such a case. It's still pretty simple and straightforward,
> > and can even be generated by the ImageJ Macro Recorder.
>
> Hi Thorsten,
>
> one more possibility: you can return a String value in a static method of
> the macro:
>
> result = call("myClass.myMethod", arg1, arg2, ...);
>
> Your plugin (here 'myClass.java') should have a method
>     public static myMethod(String arg1, String arg2, ...)
>
> Of course, the Strings may be also numbers converted to Strings.
>
> Michael
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html