Re: How to pass an array from a plugin to a macro?

Posted by dscho on
URL: http://imagej.273.s1.nabble.com/How-to-pass-an-array-from-a-plugin-to-a-macro-tp5002492p5002496.html

Hi Emmanuel,

On Mon, 1 Apr 2013, Emmanuel Levy wrote:

> I wrote a simple plugin that puts all pixel values of a selected ROI
> into a 1D table. What I can't figure out is how to pass the resulting 1D
> array to a macro calling the plugin? i.e., similarly to getStatistics,
> which makes a histogram array available in the macro calling the
> function for example.

I fear that you are trying to do something with the macro language that it
was not designed for. Remember, the macro language is meant to be very
simple so it is easy to learn, it is not meant to be fast (and it is
indeed not fast) nor a fully-fledged scripting language. Javascript is.

Sure, you may get Wayne to extend the macro language, but everytime the
syntax gets extended, the macro interpreter becomes more brittle since the
original design was not intended to be extended in that way.

In your case, the easiest may be a work-around: you *can* set the ROI
thusly:

        dummy = new float[myT.length];
        image.setRoi(new PointRoi(myT, dummy, dummy.length));

Ciao,
Johannes

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