Skip to content

Command line parsing issues

Philip Cook edited this page Feb 28, 2020 · 3 revisions

This page lists some known issues with ANTs command line parsing.

Shell expansion of square brackets

Bash and related shells interpret arguments containing square brackets as a pattern, and attempt to perform filename expansion. This creates a problem if there is a file matching one of the characters in the brackets. For example, the argument -c [100x100x100] passed to antsRegistration will be incorrect if a file named "1", "0", or "x" exists in the current working directory.

Solution for ANTs executables

The easiest way to avoid glob problems is to include white space inside the square brackets in ANTs parameters when calling ANTs executables. For example -c [ 100x100x100 ] or -t SyN[ 0.1 ] passed to antsRegistration.

If you are using zsh as your shell, you may prepend the call to your executable with the noglob command. Instead of calling antsRegistration, for example, call noglob antsRegistration.

Solution for ANTs scripts

Script arguments with spaced brackets should be quoted, for example antsCorticalThickness -c "WM[ 4 ]".

ANTs scripts have been updated to avoid unwanted filename expansion (f154285).

File names containing multiple extensions

This should not be a problem any longer but may affect older versions. Multiple extensions, or even just periods, in file names used to cause errors. Some known issues have been fixed (for example 568 and 658).

Clone this wiki locally