cmb.segment_cerebellum#
- cmb.segment_cerebellum(subject, subjects_dir=None, cmb_dir=None, segmentation_fname=None, save_segmentation=True, recompute=False, intermediate_caching=False)[source]#
Compute or load the cerebellar segmentation for a subject.
Existing saved segmentations are reused by default;
save_segmentationonly controls whether newly computed results are written to disk.- Parameters:
- subject
str The FreeSurfer subject name.
- subjects_dirpath-like |
None The path to the directory containing the FreeSurfer subjects reconstructions. If None, defaults to the SUBJECTS_DIR environment variable.
- cmb_dirpath-like |
None Path to the CMB data directory. If None (default), uses the default CMB data directory.
- segmentation_fnamepath-like |
None The path to load/save the segmentation. If None (default), uses the path
<subjects_dir>/<subject>/mri/cerebellum_segmentation.nii.gz.- save_segmentationbool
If True (default), saves a newly computed segmentation to disk. If False, newly computed segmentations are returned without saving. This flag does not prevent loading an existing segmentation from
segmentation_fnamewhenrecompute=False.- recomputebool
If True, always computes a new segmentation. If
save_segmentation=True, the result is written tosegmentation_fnameand overwrites any existing file there. If False (default), an existing segmentation atsegmentation_fnameis loaded and returned if present.- intermediate_cachingbool
If True, reuses existing intermediate registration and nnU-Net predictions from
<cmb_dir>/data/segm_folder/tmpand keeps newly generated intermediates there. If False (default), uses a temporary work directory for this run without touching any existing intermediate cache.
- subject
- Returns:
nibabel.Nifti1ImageThe cerebellar segmentation as a NIfTI image object.