Running NiFreeze¶
Command line interface¶
A model-based algorithm for the realignment of 4D brain images.
usage: nifreeze [-h] [--brainmask BRAINMASK] [--backend {ants,elastix,itk}]
[--align-config FILE] [--gem-passes N] [--eddy [FILE]]
[--eddy-model MODEL] [--models MODELS [MODELS ...]]
[--gp-hyperparameters FILE] [--nvox-prefit NVOX_PREFIT]
[--nthreads NTHREADS] [-J N_JOBS] [--seed SEED]
[--output-dir OUTPUT_DIR] [--write-hdf5]
[--debug-dir DEBUG_DIR] [--no-instant-update]
[--gradient-file FILE [FILE ...]] [--b0-file FILE]
[--ignore-b0] [--phase-encoding DIRECTION]
[--timing-file FILE]
input_file
Positional Arguments¶
- input_file
Path to the HDF5 file containing the original 4D data.
Named Arguments¶
- --brainmask
Path to a brain mask in NIfTI format.
- --backend
Possible choices: ants, elastix, itk
The registration backend, which registers each volume on its own (default: elastix).
- --align-config
A YAML file of registration settings, with a section per backend, for every level of the –models cascade (default: the packaged nifreeze/registration/config/rigid.yaml). To change a setting, copy and edit that file.
- --gem-passes
Estimate the eddy currents of a DWI with N passes of the global eddy model (GEM), after the –models cascade: each pass predicts every volume, from the volumes the pass before corrected, and fits one model of the fields to all of them. 0 turns GEM off. GEM needs the phase-encoding direction: without it, the default run estimates head motion only, with a warning (default: 3 on dMRI inputs, none on others).
- --eddy
Estimate the eddy currents of a DWI by registering each volume on its own, in place of GEM (with –gem-passes 0): after the –models cascade, one more pass, started from the motion estimates, with the settings of FILE (default: the packaged nifreeze/registration/config/affine.yaml).
- --eddy-model
The model of the eddy-current passes, GEM’s or –eddy’s, apart from the –models cascade (as named there, the ‘single’ prefix included). It should predict the diffusion signal: the trivial model registers every volume to the b=0 reference (default: the cascade’s last model).
- --models
Select the data model(s) used to generate registration targets; multiple models run as a cascade. By default each model runs in Leave-One-Volume-Out mode (refit per held-out volume). Prefix a model name with ‘single’ (e.g. ‘singledti’) to run it in single-fit mode: fit once on all volumes and reuse that locked fit (still predicting per volume from it). Single-fit is faster but leaks the queried volume into its own target (biasing motion toward zero); use it for development, testing, or coarse initialization only, not for accuracy-critical estimation. The closed-form LOVO models (‘gp-loo’, ‘gqi-krr’) predict every held-out volume exactly from one matrix, so the ‘single’ prefix makes no difference for them.
- --gp-hyperparameters
JSON file with Gaussian process hyperparameters for the ‘gp-loo’ model (e.g., pooled across the subjects of an acquisition protocol). When given, no hyperparameter is fitted at run time.
- --nvox-prefit
Number of random voxels used to fit the hyperparameters of the Gaussian process models (‘gp’, ‘gp-loo’).
- --nthreads, --omp-nthreads, --ncpus
Maximum number of threads an individual process may use.
- -J, --n-jobs, --njobs
Number of parallel jobs.
- --seed
Seed the random number generator for deterministic estimation.
- --output-dir
Path to the output directory. Defaults to the current directory.The output file will have the same name as the input file.
- --write-hdf5
Generate an HDF5 file also.
- --debug-dir
Keep the registration working files of each model in a folder of this directory, with an ‘aligned_<index>.nii’ image per volume: the registered volume with its affine corrected by the estimated motion (no resampling), which a viewer shows on top of its target ‘predicted_<index>.nii’.
- --no-instant-update
Train the models on the original volumes only. By default, as soon as a volume is registered, the models see it realigned (resampled once from the original, with its rotated b-vector) when predicting the remaining volumes.
Options for dMRI inputs¶
- --gradient-file
The gradient table: one RAS+B file (MRtrix’s .b, or NiPreps’ .tsv), or FSL’s .bvec and .bval files, in that order
- --b0-file
A NIfTI file containing the b-zero reference
- --ignore-b0
Ignore the low-b reference and use the robust signal maximum
- --phase-encoding
Possible choices: i, i-, j, j-, k, k-
The phase-encoding direction, as BIDS’s PhaseEncodingDirection: an axis of the data array (i, j or k: its first, second or third), with a trailing ‘-’ for the reverse sign (e.g., j-). It overrides the input’s metadata (default: PhaseEncodingDirection from the input’s BIDS sidecar, or from its nfHDF5 file).
Options for PET inputs¶
- --timing-file
A NIfTI file containing the timing information (onsets and durations) corresponding to the input file