CLI Overview¶
csttool is invoked as a single binary with a family of subcommands. Each subcommand corresponds to one stage of the corticospinal-tract analysis pipeline (or to orchestration of all stages). The entry point is defined in src/csttool/cli/__init__.py and dispatched via argparse.
Commands at a glance¶
The commands fall into four functional groups.
Environment & data preparation¶
| Command | Purpose |
|---|---|
check |
Verify the Python environment and required dependencies. |
check-dataset |
Assess DWI acquisition quality and recommend processing options. |
fetch-data |
Download FSL-licensed atlases (FMRIB58_FA, Harvard-Oxford). |
import |
Convert DICOM to NIfTI or validate an existing NIfTI dataset. |
Processing stages¶
| Command | Purpose |
|---|---|
preprocess |
Denoise, unring, motion-correct and brain-mask the DWI series. |
track |
Whole-brain deterministic tractography with the CSA-ODF model. |
extract |
Atlas-based ROI filtering to isolate the bilateral CST. |
metrics |
Compute scalar metrics, tract profiles and a PDF/HTML report. |
validate |
Compare extracted bundles against reference tractograms. |
Orchestration¶
| Command | Purpose |
|---|---|
run |
Execute the full pipeline (check → import → preprocess → track → extract → metrics) for one subject. |
batch |
Run the pipeline over many subjects via manifest or BIDS auto-discovery. |
Typical workflows¶
Single subject, end-to-end
csttool fetch-data --accept-fsl-license
csttool run --dicom /data/raw/sub-001 --out ./derivatives \
--denoise-method patch2self --perform-motion-correction --generate-pdf
Stage-by-stage (interactive debugging)
csttool import --dicom /data/raw/sub-001 --out ./work --subject-id sub-001
csttool preprocess --nifti ./work/sub-001/dwi/sub-001_dwi.nii.gz --out ./work/sub-001/preproc
csttool track --nifti ./work/sub-001/preproc/dti_preproc.nii.gz --out ./work/sub-001/tracking
csttool extract --tractogram ./work/sub-001/tracking/whole_brain.trk \
--fa ./work/sub-001/tracking/dti_FA.nii.gz \
--out ./work/sub-001/extract
csttool metrics --cst-left ./work/sub-001/extract/cst_left.trk \
--cst-right ./work/sub-001/extract/cst_right.trk \
--fa ./work/sub-001/tracking/dti_FA.nii.gz \
--out ./work/sub-001/metrics --generate-pdf
Batch over a BIDS dataset
Global conventions¶
- Paths: every
--*option that names a file accepts an absolute or relative path; output directories are created on demand. - Verbosity: most commands accept
--verboseand--quiet(the latter overrides). - Determinism: tracking is seeded with
--rng-seed(default42); pass--randomto disable seeding. - BIDS output:
runandbatchaccept--bids-outto emit a BIDS-Derivatives layout.
See Parameters for a single-page reference of every flag.