csttool.tracking¶
Whole-brain deterministic tractography. The CLI counterpart is track.
from csttool.tracking.modules import run_tracking
run_tracking(
nifti="preproc/dti_preproc.nii.gz",
out="./tracking",
fa_thr=0.2,
seed_density=1,
rng_seed=42,
)
csttool.tracking
¶
Whole-brain deterministic tractography (CSA-ODF).
Functions:¶
resolve_brain_mask(data, gtab, affine, brain_mask_path=None, verbose=False)
¶
Return the brain mask for this run, external if given, automatic if not.
Args:
data (ndarray): 4D DWI array (X, Y, Z, N).
gtab (GradientTable): Gradient table (used only by the automatic path).
affine (ndarray): 4x4 affine of data, for validating an external mask.
brain_mask_path (str | Path | None): Optional external brain mask. When
None, background_segmentation is used exactly as before.
verbose (bool): Print the mask source and statistics.
Returns:
tuple: (masked_data, brain_mask, mask_info) where mask_info is a
dict with brain_mask_source ('automatic_background_segmentation'
or 'external') and brain_mask_path (str or None).