====== Passing stdout to ImageJ / Fiji ======
In case you want to pass stdout to ImageJ macro headlessly, use [[https://imagej.nih.gov/ij/developer/macro/functions.html#getArgument|getArgument]].
For example, create a test macro like this and save it as test.ijm:
tt = getArgument();
print(tt);
Then the bash command for passing stdout to this macro headlessly is:
echo "hello" | (read arg; fiji --headless -macro test.ijm "$arg")
There could be more sophisticated ways, but the command above does work. For the command "fiji" to work, it should be set in your .profile or .bash_profile
alias fiji='/Applications/Fiji.app/Contents/MacOS/ImageJ-macosx'
... you need to change the path above according to the place where your Fiji resides.
The command could also be
echo "hello" | (read arg; fiji -batch test.ijm "$arg")
but it's slower somehow.