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.workflow.brainprep_sbm¶
- brainprep.workflow.brainprep_sbm(t1_file, output_dir, analysis_type='sbm', do_lgi=False, wm_file=None, keep_intermediate=False, **kwargs)[source]¶
SBM pre-processing.
Applies the brain parcellation pre-processing described in [1]. This includes:
Automated cortical reconstruction and volumetric segmentation from structural T1w MRI data using FreeSurfer’s recon-all.
Compute local Gyrification Index (localGI or lGI) - optional.
Interhemispheric surface-based registration using the fsaverage_sym template.
Project the different cortical features to the ‘fsaverage_sym’ template space.
Convert FreeSurfer images back to original Nifti space.
- Parameters:
- t1_fileFile
Path to the input T1w image file.
- output_dirDirectory
FreeSurfer working directory containing all the subjects.
- analysis_typestr
Type of the analysis that will be performed: ‘sbm’ or ‘nextbrain’. Default ‘sbm’.
- do_lgibool
Perform the Local Gyrification Index (LGI) computation - requires Matlab. Default False.
- wm_fileFile | None
Path to the custom white matter mask - we assume recon-all has been run at least upto the ‘wm.mgz’ file creation. It has to be in the subject’s FreeSurfer space (1mm iso + aligned with brain.mgz) with values in [0, 1] (i.e. probability of being white matter). For example, it can be the ‘brain_pve_2.nii.gz’ white matter probability map created by FSL fast. Default None.
Deprecated since version 1.0.0.
Do not use
wm_file!This option was removed as it is never used in Population Imaging studies. This parameter has no effect!
- keep_intermediatebool
If True, retains intermediate results (i.e., the workspace); useful for debugging. Default False.
- **kwargsdict
- entities: dict
Dictionary of parsed BIDS entities.
- Returns:
- Bunch
A dictionary-like object containing:
subject_dir: Directory - the FreeSurfer subject directory.
left_reg_file : File - left hemisphere registered to fsaverage_sym symmetric template.
right_reg_file : File - right hemisphere registered to fsaverage_sym symmetric template via xhemi.
features : tuple[File] - a tuple containing features in the fsaverage_sym symmetric template - each feature file is a MGH file with the suffix “fsaverage_sym” and is available in the ‘surf’ folder.
images : tuple[File] — a tuple containing converted images - a Nifti file available in the ‘mri’ folder.
brainparc_image_file : File - a PNG image of the GM mask and GM, WM, CSF tissues histograms.
left_seg_file : File - left hemisphere NextBrain atlas.
right_seg_file : File - right hemisphere NextBrain atlas.
- Raises:
- ValueError
If the input T1w file is not BIDS-compliant.
Notes
This workflow assumes the T1w image is organized in BIDS.
References
Examples
>>> from brainprep.config import Config >>> from brainprep.reporting import RSTReport >>> from brainprep.workflow import brainprep_sbm >>> >>> with Config(dryrun=True, verbose=False): ... report = RSTReport() ... outputs = brainprep_sbm( ... t1_file=( ... "/tmp/dataset/rawdata/sub-01/ses-01/anat/" ... "sub-01_ses-01_run-01_T1w.nii.gz" ... ), ... output_dir="/tmp/dataset/derivatives", ... ) >>> outputs Bunch( subject_dir: PosixPath('...') left_reg_file: PosixPath('...') right_reg_file: PosixPath('...') lh_thickness_file: PosixPath('...') rh_thickness_file: PosixPath('...') lh_curv_file: PosixPath('...') rh_curv_file: PosixPath('...') lh_area_file: PosixPath('...') rh_area_file: PosixPath('...') lh_pial_lgi_file: PosixPath('...') rh_pial_lgi_file: PosixPath('...') lh_sulc_file: PosixPath('...') rh_sulc_file: PosixPath('...') aparc_aseg_file: PosixPath('...') aparc_a2009s_aseg_file: PosixPath('...') aseg_file: PosixPath('...') wm_file: PosixPath('...') rawavg_file: PosixPath('...') ribbon_file: PosixPath('...') brain_file: PosixPath('...') brainparc_image_file: PosixPath('...') )