SciJava scripts are designed to operate independently of user interface—including headless, with no user interface. This is made easy with the use of script parameters.
To start Fiji in headless mode, run:
By default, when Fiji runs headlessly it acts like a one-off program: it will only perform the requested operations, then quit. To run a script headlessly, use:
In many cases, it is necessary to enclose the entire list of key/value pairs in single quotes, to avoid shell expansion. See the following examples.
Basic run
Let’s say we have the following Python script saved in a file, hello.py:
we could run this script with the command on Linux:
Note that the name parameter must be enclosed in double quotes, since it is a string literal.
On Windows systems, single/double quotes might be inverted though, such that strings are enclosed in single quotes while the list of argument as well as the path to the py script are in double quotes.
On macOS systems, the command can run in with the same quoting as on Linux:
Multiple parameters
If your script has more than one parameter:
then these are filled by using a comma-separated list of parameter pairs—e.g.:
Similarly for Windows (again respect single/double quotes) or macOS,
Controlling the Updater
To prevent unnecessary server connections to update sites in headless mode you can set the imagej.updater.disableAutocheck java parameter true:
Often headless mode is used to run many scripts in parallel that could result in huge numbers of server connections. Setting this parameter will prevent this issue. This parameter does not persist between launches and must be included every time server connections to update sites should be prevented.
The Updater can also be controlled in headless mode.