Problem calling erf java method from macro

Hi all,

I’m trying to call the java “erf” method from a macro. …I’m new to calling java methods from macros, so I’m not sure what’s going wrong.

The java page https://imagej.nih.gov/ij/developer/api/ij/util/IJMath.html says it’s @ ij.util.IJMath with method erf

So I’m trying this:

ret = call(“ij.util.IJMath.erf”, 20);

but when I run, I get “could not find the method erf with 1 parameter in class ij.util.IJMath”

Could anyone help me out?

thanks,
Richard

Hi Richard (@yahbai),

I observe the same issue. :-/

What’s curious, is that call seems to work in other cases where the argument is a string, e.g.:
call("ij.util.Tools.parseDouble", "0.12" )

Calling that function from another language seems to work straightforwardly, in groovy, for example:
println( ij.util.IJMath.erf( 0.12 ))

So switching languages could work if that’s an option. Otherwise, I’m not sure.

John

Yes, the call macro function requires String arguments for the function being called. See the documentation (emphasis added my me):

call(“class.method”, arg1, arg2, …)
Calls a public static method in a Java class, passing an arbitrary number of string arguments, and returning a string.


Yes, I’d also recommend using one of the full-fledged supported languages :slight_smile:

1 Like

Thanks - I actually dug that up a day or so after trying

I’ll be switching to a proper language at some point - just trying to get some scripts fully implementing what I’d like as a first pass.

Is there any difference in any of the languages? …mainly in terms of documentation/examples etc.

I’m pretty familiar with javascript from a bunch of nodeJS work, so I’d probably default to that unless there was some compelling region not to.

thanks all,
Richard