User Tools

Site Tools


documents:20190416ijmacro_passingarguments

Passing stdout to ImageJ / Fiji

In case you want to pass stdout to ImageJ macro headlessly, use 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.

documents/20190416ijmacro_passingarguments.1555417896.txt.gz · Last modified: 2019/04/16 12:31 by kota

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki