Skip to content

CLAIRE: Command Line Options (old and new names)

CLAIRE's programs follow the GNU conventions for command line options:

  • long options start with -- and use lower case words separated by - (--grid-size 64 or --grid-size=64); a few common options also have a one-letter short form (-o, -r, -t, -v)
  • flags take no value; every flag --name also has the form --no-name, which turns it off (e.g., a flag set in a config file)
  • lists are comma separated (--save velocity,jacobian); options that take a list add to it, --save none clears it; grid sizes use x (--grid-size 64x64x32)
  • -- ends the options
  • -h/--help shows the common options (with examples), --help-all all options and their old names, --version the version and the build configuration; claire-tools <command> --help shows the options of one command and an example. The help uses the width of the terminal (60 to 100 columns; otherwise $COLUMNS, or 80)
  • --config <file> reads options from a file (same syntax, # starts a comment; a config file may also give the command of claire-tools, claire-test and claire-benchmark); the options are applied where --config appears, so options given after it override those in the file; --print-config prints the settings in this format
  • exit codes: 0 success, 1 failure while running, 2 invalid command line or config file, 3 the solver did not converge (claire prints "solver not converged", e.g., when the line search fails; stopping at --newton-max-iter counts as converged, as in the output of claire)
  • errors and warnings go to stderr; colors (and bold text in the help) only on a terminal and not if NO_COLOR is set
  • not supported (unlike getopt): bundled short options (-vv; use -v -v), values attached to short options (-oout/; use -o out/), abbreviated long options (--grid for --grid-size)

The programs are claire (registration), claire-tools (post-processing; one command per task), claire-test (unit tests) and claire-benchmark (benchmarks). They were called claire, clairetools, test and benchmark.

The old option names still work: each prints a warning with its new name (on stderr). They will be removed in a later version. Old options that have no effect are still accepted and print "has no effect" (see Options without effect).

Changes in meaning (everything else behaves as before):

  • --preconditioner none means no preconditioner (the old -precond nopc). The old -precond none also replaced the Hessian with the identity (steepest descent); that is now --hessian identity. The old spelling -precond none keeps its old meaning.
  • --config <file>: options given after it override the file. The old -config <file> keeps its old rule (the file overrides the command line, wherever -config appears).
  • -o, --output <path>: if the value ends with / or is an existing directory, the output files are written into it; otherwise the value is a prefix of the file names, as before (-o out/run1_ writes out/run1_velocity-field-x1.nii.gz). Previously -x out wrote outvelocity-field-x1.nii.gz even if out was a directory.
  • claire-tools warns about options that the selected command does not use (e.g., --labels with transport-image); previously they were ignored.
  • --sigma (smoothing of the input images, in voxels) is a real number (previously it was truncated to an integer).
  • --reference and --template can be repeated for several image components; the number of components is the number of files (previously each -mr/-mt set it to 1, so repeating them failed with a size mismatch). --components must match it.

claire

Input

old new notes
-mr <file> -r, --reference <file> repeat for several components; the number of components is the number of files
-mt <file> -t, --template <file>
-mrc <n> <files>, -mtc <n> <files> --reference, --template once per file old form still accepted
-mrf <file> --reference-list <file> text file, one image per line
-mtf <file> --template-list <file>
-mask <file> --mask <file>
-objwts <w1,...> --component-weights <w1,...>
-nc <int> --components <int> synthetic problems (with images, the number of files)
-v1, -v2, -v3 <file> --velocity-x1, --velocity-x2, --velocity-x3 <file> initial guess
-sigma <int>[x<int>x<int>] --sigma <dbl>[x<dbl>x<dbl>] smoothing of the input images (voxels)
-disablesmoothing --no-smoothing
-disablerescaling --no-rescaling intensities are rescaled to [0,1] by default
-probmaps --probability-maps

Output

old new notes
-x <path> -o, --output <path> folder or prefix (see above)
-format <type> --format <type> nifti, netcdf, binary; hdf5 was accepted but writing failed
-velocity --save velocity
-defgrad --save deformation-gradient
-detdefgrad --save jacobian det(grad(y))
-defmap --save deformation-map
-deffield --save displacement also writes its norm
-invdeffield --save inverse-displacement
-divdeffield --save displacement-divergence-norm div(u)·‖u‖ (div-displacement-field-norm); implies displacement
-deftemplate --save deformed-template
-reference, -template --save reference-image, --save template-image not to be confused with --reference <file>, --template <file>
-velnorm --save velocity-norm
-residual, -invresidual --save residual, --save inverse-residual
-iterates --save iterates the iterates (velocity, deformed template) of every iteration
-checkpoints --save checkpoints the iterates after every iteration, overwritten each time (restart after a crash)
-timeseries --save time-series
-logdistance --log distance
-logconvergence --log convergence
-loggradient --log gradient
-logjacobian --log jacobian
-logkrylovres, -logrelkrylovres --log krylov-residual, --log relative-krylov-residual
-logworkload --log workload

The values of --save and --log can be combined: --save velocity,deformed-template,jacobian.

Regularization and distance

old new values (old values still accepted)
-regnorm <type> --regularization <type> h1-seminorm (h1s, h1sn), h2-seminorm (h2s, h2sn), h3-seminorm (h3s, h3sn), h1-norm (h1), h2-norm (h2), h3-norm (h3), h1-seminorm-div (h1s-div; default), h1-seminorm-stokes (h1s-stokes), l2-norm (l2)
-beta <dbl> --beta <dbl>
-beta-div <dbl> --beta-div <dbl>
-distance <type> --distance <type> sl2, ncc
-diffreg <type> --regularization-differentiation <type> spectral, finite, mixed
-train <type> --beta-search <type> binary, binary-beta-div (binary2D: also searches --beta-div), reduce
-jbound <dbl> --jacobian-bound <dbl> lower bound on det(grad(y)) for --beta-search
-betacont <dbl> --beta-target <dbl> continuation in beta down to this value
-betacont2D <dbl> <dbl> --beta-target <dbl> --beta-div-target <dbl> continuation in both; old form still accepted
-betainit <dbl> --beta-init <dbl>
-beta-div-init, -beta-div-min <dbl> --beta-div-init, --beta-div-min <dbl>
-scalecont --scale-continuation
-gridcont --grid-continuation

Optimization

old new values
-optmeth <type> --hessian <type> gauss-newton (gn; default), full (fn, full-newton), identity (steepest descent; no preconditioner; was -precond none)
-opttol <dbl> --newton-rtol <dbl>
-gabs <dbl> --newton-atol <dbl>
-maxit <int>[x<int>...] --newton-max-iter <int>[x<int>...] one value per level with --grid-continuation
-stopcond <int> --stopping-criterion <type> gradient (0; default), gradient-update-objective (1)
-globalization <type> --globalization <type> none, armijo, owarmijo, morethuente, gpcg, ipm
-grad <type> --gradient-type <type> l2 (default), sobolev
-preset <type> --preset <type> fast-aggressive, fast-smooth, accurate-aggressive, accurate-smooth
-fastsolve --preset fast fixed numbers of iterations and loose tolerances (inaccurate)
-presolvetol <dbl> --presolve-rtol <dbl>
-presolvemaxit <int> --presolve-max-iter <int>
-prekrylovmaxit <int> --presolve-krylov-max-iter <int>
-nonzeroinitialguess --initial-gradient-step start from one steepest-descent step instead of zero
-derivativecheck --check-derivatives
-checksymmetry --check-hessian-symmetry

Krylov method and preconditioner

old new values
-krylovmethod <type> --krylov-method <type> pcg, fpcg, gmres, fgmres
-krylovmaxit <int> --krylov-max-iter <int>
-krylovtol <dbl> --krylov-rtol <dbl>
-krylovfseq <type> --krylov-forcing <type> none, quadratic, superlinear (suplinear)
-precond <type> --preconditioner <type> none (nopc), invreg, h0invreg, two-level (2level), h0, h0mg, symmg, syminv, symh0mg; -precond none keeps its old meaning (--hessian identity)
-pcsolver <type> --pc-solver <type> pcg, fpcg, gmres, fgmres, chebyshev (cheb)
-pcsolvermaxit <int> --pc-max-iter <int>
-pctolscale <dbl> --pc-rtol-factor <dbl> tolerance of the inner solve = factor × Krylov tolerance (pcg, gmres)
-pctolint <dbl> --pc-two-level-rtol-factor <dbl> the same for the two-level preconditioner
-pctolintpost <dbl> --pc-two-level-rtol-post <dbl> relative tolerance after the two-level correction
-pcbeta <dbl> --pc-beta-min <dbl> the preconditioner uses max(beta, this value)
-pch0init <type> --pc-h0-init <type> m0, m1
-reesteigvals <type> --pc-reestimate-eigenvalues <type> krylov, newton
-monitorpcsolver --monitor-pc-solver

Transport equations and jacobian

old new values
-pdesolver <type> --pde-solver <type> semi-lagrangian (sl), rk2
-nt <int> --time-steps <int>
-iporder <int> --interp-order <int> 1, 3
-rkorder <int> --rk-order <int>
-diffpde <type> --pde-differentiation <type> spectral, finite
-adapttimestep --adapt-time-steps
-cflnumber <dbl> --cfl <dbl>
-monitorcflnumber --monitor-cfl
-fastpde --fast-pde
-fastleray --fast-leray
-savestategrad --precompute-state-gradient keeps the gradient of the state in memory
-savestategradx --precompute-interpolated-state-gradient
-monitordefgrad --monitor-jacobian
-invdefgrad --jacobian-of-inverse --save jacobian writes det(grad(y)) of the inverse map (mean 1)
-detdefgradfromdeffield --jacobian-from-displacement

Parallelism, synthetic problems, other

old new notes
-nthreads <int> --threads <int>
-np <int>x<int> --mpi-grid <int>x<int>
-nx <int>x<int>x<int> --grid-size <int>x<int>x<int>
-synthetic <int> --synthetic <int>
-nozeroinit --synthetic-exact-init start from the velocity of the synthetic problem instead of zero
-verbosity <int> --verbosity <int>, or -v, --verbose (repeat)
-debug, -develop --debug, --develop verbosity 3, 4
-config <file> --config <file> old -config: the file overrides the command line (see Changes in meaning)
-help, -advanced --help, --help-all
(new) --print-config, --version

Options without effect

Accepted (with the warning "has no effect"), but without a new name: -lowmem, -i <path> (claire and claire-tools), -ffttol <dbl>, -hessshift <dbl>, -gridscale <dbl> (claire), -pctolintpre <dbl>, -saveprob and -velocity (claire-tools).

claire-tools (was clairetools)

claire-tools <command> [options]; the old action flags still select the command.

old flag new command
-defgrad, -detdefgrad, -deffield, -invdeffield, -divdeffield, -defmap deformation-fields --save <list> list values: deformation-gradient, jacobian, displacement, inverse-displacement, displacement-divergence-norm, deformation-map, time-series (old -timeseries)
-invdetdefgrad deformation-fields --save jacobian --jacobian-of-inverse as in claire
-deformimage transport-image
-tlabelmap transport-label-map
-tprobmap transport-probability-maps
-computeravensmap ravens-map
-residual residual
-error error
-resample resample
-smooth <int>[x<int>x<int>] smooth --sigma <dbl>[x<dbl>x<dbl>]
-convert 2nii\|2nc convert --format nifti\|netcdf
-csynvel synthetic-velocity
-analyze analyze
old new used by
-ifile <file> --input <file> most commands
-ifilevec <n> <files> --input once per file old form still accepted
-dice and -iref <file> --dice <file> transport-label-map: Dice score against this reference label map
-xfile <file> --output-file <file>
-x <path> -o, --output <path> folder or prefix, as in claire
-mr, -mt <file> -r, --reference, -t, --template <file> residual, error
-v1, -v2, -v3 <file> --velocity-x1, --velocity-x2, --velocity-x3 <file>
-labels <l1,...> --labels <l1,...>
-bckglabel <int> --background-label <int>
-r2t --reference-to-template
-scale <dbl> --grid-scale <dbl> resample
-nxnew <int>x<int>x<int> --new-grid-size <int>x<int>x<int> resample
-shift <dbl>, -valuescale <dbl> --value-shift <dbl>, --value-scale <dbl>
-norm --rescaling rescale the intensities to [0,1] (claire does this by default)
-fit, -clip --fit-to-input, --clip-negative
-usenc --format netcdf
-pdesolver <type> --pde-solver <type> as in claire, and rk2a (deformation fields only)
shared options as in claire --grid-size, --time-steps, --interp-order, --adapt-time-steps, --cfl, --monitor-cfl, --sigma, --no-smoothing, --jacobian-from-displacement, --jacobian-of-inverse, --threads, --mpi-grid, --verbosity, --debug

claire-test (was test)

claire-test <test> [options], e.g. claire-test regularization --grid-size 64.

old new
-interp, -forward, -trajectory, -gradient, -hessian interpolation, forward, trajectory, gradient, hessian
-reg, -diff, -spec regularization, differentiation, spectral (the old short names also work: reg, diff, spec, interp)
-jacobian, -registration jacobian, registration
-rep <int> --repeats <int>
-optmeth gn\|fn --hessian gauss-newton\|full
other options as in claire

claire-benchmark (was benchmark)

claire-benchmark <benchmark> [options].

old new
-forward, -gradient forward, gradient
-hessmatvec hessian-matvec
-terror transport-error
-repeats <int> --repeats <int>
-logwork --log workload
other options as in claire