Command Line Interface (CLI)

Autoafids CLI

The following can also be seen by entering autoafids -h into your terminal.

These are all the required and optional arguments Autoafids accepts in order to run flexibly on many different input data types and with many options. In most cases, only the required arguments are needed.

usage: autoafids [-h]
                 [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]]
                 [--exclude-participant-label EXCLUDE_PARTICIPANT_LABEL [EXCLUDE_PARTICIPANT_LABEL ...]]
                 [--acq [ACQ]] [--procprofile {slow,medium,fast,superfast}]
                 [--norm {0,1}] [--res RES] [--modality {T1w,T2w,FLAIR,ct}]
                 [--derivatives DERIVATIVES [DERIVATIVES ...]] [--model MODEL]
                 [--enable_bids_validation] [--stereotaxy {STN,cZI}]
                 [--template-flow {MNI152Lin,MNI152NLin2009cAsym,MNI152NLin6Sym,OASIS30ANTs,MNI152NLin2009cSym,MNI305,fsaverage,MNI152NLin2009bSym,MNI152NLin6Asym,MNIColin27}]
                 [--fidqc] [--LEAD-DBS-DIR LEAD_DBS_DIR]
                 [--FMRIPREP-DIR FMRIPREP_DIR] [--workdir WORKDIR]
                 [--detect-with-nnlm] [--nnlm-fold NNLM_FOLD]
                 [--nnlm_plans NNLM_PLANS] [--nnlm_checkpoint NNLM_CHECKPOINT]
                 [--nnlm_device NNLM_DEVICE] [--pybidsdb-dir PATH]
                 [--pybidsdb-reset] [--filter-T1w ENTITY[:METHOD][=VALUE]
                 [ENTITY[:METHOD][=VALUE] ...]]
                 [--filter-T2w ENTITY[:METHOD][=VALUE]
                 [ENTITY[:METHOD][=VALUE] ...]]
                 [--filter-FLAIR ENTITY[:METHOD][=VALUE]
                 [ENTITY[:METHOD][=VALUE] ...]]
                 [--filter-ct ENTITY[:METHOD][=VALUE] [ENTITY[:METHOD][=VALUE]
                 ...]] [--wildcards-T1w WILDCARD [WILDCARD ...]]
                 [--wildcards-T2w WILDCARD [WILDCARD ...]]
                 [--wildcards-FLAIR WILDCARD [WILDCARD ...]]
                 [--wildcards-ct WILDCARD [WILDCARD ...]] [--path-T1w PATH]
                 [--path-T2w PATH] [--path-FLAIR PATH] [--path-ct PATH]
                 [--help-snakemake] [--force-output]
                 bids_dir output_dir {participant}

Positional Arguments

bids_dir

The directory with the input dataset formatted according to the BIDS standard.

output_dir

The directory where the output files should be stored. If you are running group level analysis this folder should be prepopulated with the results of the participant level analysis.

analysis_level

Possible choices: participant

Level of the analysis that will be performed

Named Arguments

--participant_label, --participant-label

The label(s) of the participant(s) that should be analyzed. The label corresponds to sub-<participant_label> from the BIDS spec (so it does not include “sub-“). If this parameter is not provided, all subjects will be analyzed. Multiple participants can be specified with a space seperated list.

--exclude-participant-label, --exclude_participant_label

The label(s) of the participant(s) that should be excluded. The label corresponds to sub-<participant_label> from the BIDS spec (so it does not include “sub-“). If this parameter is not provided, all subjects will be analyzed. Multiple participants can be specified with a space sepearated list.

--acq

The acquisition sequence of the T1w image (e.g. MP2RAGE). (default: “MP2RAGE”)

Default: “MP2RAGE”

--procprofile

Possible choices: slow, medium, fast, superfast

Specify the profile and configration for preprocessing. (default: “fast”)

Default: “fast”

--norm

Possible choices: 0, 1

Specify the normalization scheme for images as a binary choice. {0 = z-score, 1 = min-max , 2 = tissue-based [notavailable]}. (default: “0”)

Default: “0”

--res

Specify the resampling resolution (e.g. “100” for 1mm) for images, any resolution is supported but limited to isotropic resampling. (default: “100”)

Default: “100”

--modality

Possible choices: T1w, T2w, FLAIR, ct

Specify the modality to use (e.g., T1w, T2w, FLAIR, or CT).

Default: “T1w”

--derivatives

Path(s) to a derivatives dataset, for folder(s) that contains multiple derivatives datasets (default: False)

Default: False

--model

Type of machine learning model to apply.

Default: “default”

--enable_bids_validation, --enable-bids-validation

Enable validation of BIDS dataset. BIDS validation would be performed using the bids-validator plugin (if installed/enabled) or with the pybids validator implementation (if bids-validator is not installed/enabled).

Default: True

--stereotaxy

Possible choices: STN, cZI

Predict stereotactic target coordinates from output AFIDs. Also supplies AC-PC transform matrix (4x4) in the process.{STN = subthalamic nucelus, cZI = caudal zona incerta}

Default: False

--template-flow, --template_flow

Possible choices: MNI152Lin, MNI152NLin2009cAsym, MNI152NLin6Sym, OASIS30ANTs, MNI152NLin2009cSym, MNI305, fsaverage, MNI152NLin2009bSym, MNI152NLin6Asym, MNIColin27

Downloads a template from templateflow and uses it to assess the quality of registration.

Default: False

--fidqc

Generate *.html files for QC of AutoAFIDs outputs. (default: False)

Default: False

--LEAD-DBS-DIR, --LEAD_DBS_DIR

Path to a LEAD-DBS derivatives dataset, for folder(s) that contains multiple derivatives datasets (default: False)

Default: False

--FMRIPREP-DIR, --FMRIPREP_DIR

Path to a fMRIPrep derivatives dataset, for folder(s) that contains multiple derivatives datasets (default: False)

Default: False

--workdir

Folder for storing working files. If not specified, will be in “work/” subfolder in the output folder. You can also use environment variables when setting the workdir, e.g. –workdir ‘$SLURM_TMPDIR’.

Default: “work”

--detect-with-nnlm, --detect_with_nnlm

Use nnLandmark (nnLM) for whole-volume, single-pass AFID detection. All 32 AFIDs are predicted in one nnU-Net forward pass. The model is downloaded automatically on first use.

--nnlm-fold, --nnlm_fold

nnLM fold to use for prediction. (default: “0”)

Default: “0”

--nnlm_plans, --nnlm-plans

nnLM plans identifier. (default: “nnUNetResEncUNetMPlans”)

Default: “nnUNetResEncUNetMPlans”

--nnlm_checkpoint, --nnlm-checkpoint

nnLM checkpoint filename inside the model folder. (default: “checkpoint_final.pth”)

Default: “checkpoint_final.pth”

--nnlm_device, --nnlm-device

Device for nnLM inference: cuda or cpu. (default: “cpu”)

Default: “cpu”

--pybidsdb-dir, --pybidsdb_dir

Optional path to directory of SQLite databasefile for PyBIDS. If directory is passed and folder exists, indexing is skipped. If pybidsdb_reset is called, indexing will persist

--pybidsdb-reset, --pybidsdb_reset

Reindex existing PyBIDS SQLite database

Default: False

--help-snakemake, --help_snakemake

Options to Snakemake can also be passed directly at the command-line, use this to print Snakemake usage

--force-output, --force_output

Force output in a new directory that already has contents

Default: False

BIDS FILTERS

Update filters for input components. Each filter can be specified as a ENTITY=VALUE pair to select an value directly. To use regex filtering, ENTITY:match=REGEX or ENTITY:search=REGEX can be used for re.match() or re.search() respectively. Regex can also be used to select multiple values, e.g. ‘session:match=01|02’. ENTITY:required and ENTITY:none can be used to require or prohibit presence of an entity in selected paths, respectively. ENTITY:optional can be used to remove a filter.

--filter-T1w, --filter_T1w

(default: suffix=T1w extension=.nii.gz datatype=anat)

--filter-T2w, --filter_T2w

(default: suffix=T2w extension=.nii.gz datatype=anat)

--filter-FLAIR, --filter_FLAIR

(default: suffix=FLAIR extension=.nii.gz datatype=anat)

--filter-ct, --filter_ct

(default: suffix=ct extension=.nii.gz datatype=anat)

INPUT WILDCARDS

Provide entities to be used as wildcards.

--wildcards-T1w, --wildcards_T1w

(default: subject session acquisition reconstruction run)

--wildcards-T2w, --wildcards_T2w

(default: subject session acquisition reconstruction run)

--wildcards-FLAIR, --wildcards_FLAIR

(default: subject session acquisition reconstruction run)

--wildcards-ct, --wildcards_ct

(default: subject session acquisition reconstruction run)

PATH OVERRIDE

Options for overriding BIDS by specifying absolute paths that include wildcards, e.g.: /path/to/my_data/{subject}/t1.nii.gz

--path-T1w, --path_T1w
--path-T2w, --path_T2w
--path-FLAIR, --path_FLAIR
--path-ct, --path_ct

Snakemake CLI

In addition to the above command line arguments, Snakemake arguments can also be passed at the Autoafids command line.

The most critical of these is the --cores / -c and --force-output arguments, which are required arguments for Autoafids.

The complete list of Snakemake arguments are below, and most act to determine your environment and app behaviours. They will likely only need to be used for running in cloud environments or troubleshooting. These can be listed from the command line with autoafids --help-snakemake.