Command line usage - Diffusion MRI

Command line usage - Diffusion MRI

Command line usage - Diffusion MRI

visualqc_diffusion_mri: rate quality of diffusion MR scan.

usage: visualqc_diffusion [-h] [-b BIDS_DIR] [-o OUT_DIR] [-i ID_LIST] [-n NAME_PATTERN] [-ap] [-dl DELAY_IN_ANIMATION]
                          [-vt {Align_b0_edges}] [-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

-o, --out_dir Output folder to store the visualizations & ratings. Default: a new folder called visualqc will be created inside the input dir.
-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:

  • 'dwi.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*_dwi_*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

-ap, --apply_preproc
 

Whether to apply basic preprocessing steps (detrend, slice timing correction etc), before building the carpet image.

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

Default is NOT to apply any preprocessing (detrending etc) before showing images for review.

Visualization

Customize behaviour of comparisons

-dl, --delay_in_animation
 

Specifies the delay in animation of the display of two images (like in a GIF).

Default: 0.1 (units in seconds).

-vt, --vis_type
 

Possible choices: Align_b0_edges

Type of visualization to start review with, or for screenshots. Allowed options: (‘Align_b0_edges’,)

Default: Align_b0_edges.

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 arrangement 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 initiating the review.

-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.