Login  Register

Re: Wishlist: GOTO in an ImageJ macro

Posted by Michael Schmid on Jan 31, 2016; 4:20pm
URL: http://imagej.273.s1.nabble.com/Wishlist-GOTO-in-an-ImageJ-macro-tp5015489p5015498.html

On Sat, January 30, 2016 05:38, Daddymoen wrote:
> If there is a separate web page for posting Wishlist items my first wish
> would be to know how to find it.  In the old days BASIC had a GOTO(line
> number) command.  There are some situations where it would make macro
> programming so much easier to have that command instead of the
> lame-Function-kind-of-useful-command.  That's my second wish.  My third is
> to have a real array command that allows at least a 2D array, without
> using the present, also lame, work around.

Hi Daddymoen,

there are good reasons for not having GOTO:
  https://en.wikipedia.org/wiki/Goto

Concerning 2D arrays, simply create a 32-bit image in BatchMode (so the
image does not get displayed).
This gives you a 2D array that can be addressed with setPixel(x, y, value)
and getPixel(x, y).  Using an image instead of an array, you get a number
of operations for free, e.g. arithmetic operations on each array element
(Process>Math) and arithmetic element-by-element operations of two 2D
arrays (Image Calculator). I don't think that creating an image is slower
(more lame) than creating a large 2D array in Java.
The main restriction is that images use only 32-bit floats, while the
macro language uses numbers with 64 bits precision.

Michael

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