Closed imagejan closed 5 years ago
I've chosen vanilla Java instead of the ImageJ's macro language, cause I couldn't make string interpolations work in the macro, e.g.:
name = ...
for (i=0; i<list.length; i++) {
run("Command", "param1=$sname param2=output$i"
}
just won't work and I wanted to avoid ugly string concatenations.
run("Command", "param1=$sname param2=output$i"
This works (see also the docs):
param1=&name
(mind the &
instead of $
)
but something like output$i
will not work in macros.
String concatenations are a common thing in macros, why do risk to lose the largest part of ImageJ users, just to have "nice-looking" Java code?
While I share some of the concerns about the IJ macro language, I'd suggest to include a Groovy example. Java is really the worst choice IMHO, when talking about "macro"-like batch processing without an IDE.
String concatenations are a common thing in macros, why do risk to lose the largest part of ImageJ users, just to have "nice-looking" Java code?
totally agree with the above. It should not be hard to rewrite the Java script example with the macro language and Groovy so we should do just that. Thanks
The "Java macro" example in the README is a poor choice because of following reasons:
IJ.getImage()
, thereby relying on the UI displaying an image. This won't work in headless mode and is therefore unsuitable for batch processing. The macro language, in contrast, supports a batch mode that works in headless environment.I suggest to replace the code by a real macro, and supplement it with code in a supported scripting language such as Groovy, to illustrate more advanced interaction with this plugin's API (if applicable).
I'll try to come up with an illustrative example when I find the time.