Command line usage - Functional MRI

Command line usage - Functional MRI

Command line usage - Functional MRI

visualqc_func_mri: rate quality of functional MR scan.

usage: visualqc_func_mri [-h] [-b BIDS_DIR] [-u USER_DIR] [-o OUT_DIR] [-i ID_LIST] [-n NAME_PATTERN] [-np]
                         [-olm OUTLIER_METHOD] [-olf OUTLIER_FRACTION] [-olt OUTLIER_FEAT_TYPES] [-old]
                         [-w VIEWS [VIEWS ...]] [-s NUM_SLICES] [-r NUM_ROWS] [-p] [-so]

Input and output

-b, --bids_dir

Absolute path to the root folder of the dataset formatted with the BIDS spec. See bids.neuroimaging.io for more info.

E.g. --bids_dir /project/new_big_idea/ds042

-u, --user_dir

Absolute path to an input folder containing the MRI scan. Each subject will be queried after its ID in the metadata file, and is expected to have a file, uniquely specified --name_pattern), in its own folder under this path --user_dir.

E.g. --user_dir /project/images_to_QC

-o, --out_dir Output folder to store the visualizations & ratings. Default: a new folder called visualqc will be created inside the input folder
-i, --id_list

Abs path to file containing list of subject IDs to be processed. If not provided, all the subjects with required files will be processed.

E.g.

sub001
sub002
cn_003
cn_004
-n, --name_pattern
 

Specifies the regex to be used to search for the image to be reviewed. Typical options include:

  • 'bold.nii', when name is common across subjects
  • '*_preproc_*.nii', when filenames have additional info encoded (such as redundant subject ID as in BIDS format)
  • 'func/sub*_bold_*space-MNI152*_preproc.nii.gz' when you need to additional levels deeper (with a / in regex)
    or control different versions (atlas space) of the same type of file.

Ensure the regex is tight enough to result in only one file for each ID in the id_list. You can do this by giving it a try in the shell and counting the number of results against the number of IDs in id_list. If you have more results than the IDs, then there are duplicates. You can use https://regex101.com to construct your pattern to tightly match your requirements. If multiple matches are found, the first one will be used.

Make sure to use single quotes to avoid the shell globbing before visualqc receives it.

Default: ‘*.nii’

Preprocessing

options related to preprocessing before review

-np, --no_preproc
 

Whether to apply basic preprocessing steps (detrending etc), before building the carpet image. Check https://nilearn.github.io/stable/modules/generated/nilearn.signal.clean.html for more details.

If the images are already preprocessed elsewhere, use this flag --no_preproc

Default is to apply minimal preprocessing (detrend, low- and high-pass butterworth filter) before showing images for review.

Outlier detection

options related to automatically detecting possible outliers

-olm, --outlier_method
 

Method used to detect the outliers.

For more info, read http://scikit-learn.org/stable/modules/outlier_detection.html

Default: isolation_forest.

-olf, --outlier_fraction
 

Fraction of outliers expected in the given sample. Must be >= 1/n and <= (n-1)/n, where n is the number of samples in the current sample.

For more info, read http://scikit-learn.org/stable/modules/outlier_detection.html

Default: 0.2.

-olt, --outlier_feat_types
 

Type of features to be employed in training the outlier detection method. It could be one of ‘cortical’ (aparc.stats: mean thickness and other geometrical features from each cortical label), ‘subcortical’ (aseg.stats: volumes of several subcortical structures), or ‘both’ (using both aseg and aparc stats).

Default: (‘dvars’,).

-old, --disable_outlier_detection
 This flag disables outlier detection and alerts altogether.

Layout options

Slice layout arragement when zooming in on a time point,
or show to the std. dev plot.
-w, --views Specifies the set of views to display - could be just 1 view, or 2 or all 3. Example: –views 0 (typically sagittal) or –views 1 2 (axial and coronal) Default: 0 1 2 (show all the views in the selected segmentation)
-s, --num_slices
 Specifies the number of slices to display per each view. This must be even to facilitate better division. Default: 12.
-r, --num_rows Specifies the number of rows to display per each axis. Default: 2.

Workflow

Options related to workflow e.g. to pre-compute resource-intensive features, and pre-generate all the visualizations required before bringin up the review interface.

-p, --prepare_first
 

This flag enables batch-generation of 3d surface visualizations, prior to starting any review and rating operations.

This makes the switch from one subject to the next, even more seamless (saving few seconds :) ).

Default: False (required visualizations are generated only on demand, which can take 5-10 seconds for each subject).

-so, --screenshot_only
 This flag enables the batch generation of screenshots of the visualizations generated, for archival purposes. This would skip the interactive and deeper review of the visualizations, and directly saves the screenshots to the output folder. Hence, only some static options would work, and dynamic animations would not. This is NOT recommended as a QC procedure as the generated screenshots can become out of sync with the actual data for a number of reasons, and for reliable and accurate QC, we recommend interactive review which presents fresh visualizations based on latest version of data on disk.