Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

brainprep.interfaces.freesurfer.freesurfer_tissues

brainprep.interfaces.freesurfer.freesurfer_tissues(workspace_dir, output_dir, entities, include_cerebellum=False, dryrun=False)[source]

Binary masks for white matter (WM), gray matter (GM), cerebrospinal fluid (CSF), and whole brain based on FreeSurfer ribbon and wmparc segmentations.

Ribbon-based structures:

  • WM - Left/Right Cerebral White Matter.

  • GM - Left/Right Cerebral Cortex.

wmparc-based structures:

  • CC - Fornix, CC-Posterior, CC-Mid-Posterior, CC-Central, CC-Mid-Anterior, CC-Anterior.

  • CSF - Left-Lateral-Ventricle, Left-Inf-Lat-Vent, 3rd-Ventricle, 4th-Ventricle, CSF Left-Choroid-Plexus, Right-Lateral-Ventricle, Right-Inf-Lat-Vent, Right-Choroid-Plexus.

  • WM - Cerebellar-White-Matter-Left, Brain-Stem, Cerebellar-White-Matter-Right.

  • GM - Left-Cerebellar-Cortex, Right-Cerebellar-Cortex, Thalamus-Left, Caudate-Left, Putamen-Left, Pallidum-Left, Hippocampus-Left, Amygdala-Left, Accumbens-Left, Diencephalon-Ventral-Left, Thalamus-Right, Caudate-Right, Putamen-Right, Pallidum-Right, Hippocampus-Right, Amygdala-Right, Accumbens-Right, Diencephalon-Ventral-Right.

Parameters:
workspace_dir: Directory

Working directory where intermediate FreeSurfer outputs are generated.

output_dirDirectory

FreeSurfer working directory containing all the subjects.

entitiesdict

A dictionary of parsed BIDS entities including modality.

include_cerebellumbool

If False, omit cerebellum and brain stem. Default False.

dryrunbool

If True, skip actual computation and file writing. Default False.

Returns:
wm_mask_fileFile

Binary mask of white matter regions.

gm_mask_fileFile

Binary mask of gray matter regions.

csf_mask_fileFile

Binary mask of cerebrospinal fluid regions.

brain_mask_fileFile

Binary mask of the brain.

Notes

This function uses predefined FreeSurfer label indices to classify tissue types. It combines ribbon and wmparc segmentation maps to generate comprehensive masks for downstream analysis or visualization. Use FreeSurfer’s ribbon.mgz and wmparc.mgz files.