Login  Register

Re: Return value to macro from java plugin

Posted by Michael Schmid on Nov 30, 2014; 4:32pm
URL: http://imagej.273.s1.nabble.com/Return-value-to-macro-from-java-plugin-tp5010694p5010697.html

>> 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