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: <sxh> tt = getArgument(); print(tt); </sxh>

Then the bash command for passing stdout to this macro headlessly is: <sxh> echo “hello” | (read arg; fiji –headless -macro test.ijm “$arg”) </sxh>

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 <sxh> alias fiji='/Applications/Fiji.app/Contents/MacOS/ImageJ-macosx' </sxh> … you need to change the path above according to the place where your Fiji resides.

The command could also be <sxh> echo “hello” | (read arg; fiji -batch test.ijm “$arg”) </sxh>

but it's slower somehow.

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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki