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_group_sbm

brainprep.workflow.brainprep_group_sbm(output_dir, euler_threshold=-217, longitudinal=False, keep_intermediate=False)[source]

Group level SBM pre-processing.

Summarizes the generated FreeSurfer features and applies the quality control described in [1]. This includes:

  1. Generate text/ascii tables of FreeSurfer parcellation stats data ‘?h.aparc.stats’ for both templates (Desikan & Destrieux) and volumetric data for subcortical brain structures ‘aseg.stats’.

  2. Generate a TSV file containing the FreeSurfer’s Euler number, which summarizes the topological complexity of the reconstructed cortical surfaces.

  3. Apply threshold-based quality checks on the selected quality metrics.

  4. Generate a histogram showing the distribution of these quality metrics.

Parameters:
output_dirDirectory

FreeSurfer working directory containing all the subjects.

euler_thresholdint

Quality control threshold on the Euler number. Default -217.

longitudinalbool

If True, consider the longitudinal data as inputs. Default False.

keep_intermediatebool

If True, retains intermediate results (i.e., the workspace); useful for debugging. Default False.

Returns:
Bunch

A dictionary-like object containing:

  • summary_files : tuple[File] - a tuple containing FreeSurfer summary stats - each file is a CSV file with the prefix ‘aparc_*_stats’ for Desikan cortical feautes, ‘aparc2009s_*_stats’ for Destrieux cortical features, and ‘aseg_*_stats’ for volumetric subcortical brain structure features.

  • euler_numbers_file : File - a TSV file containing Euler number of each input image quality check (QC) data.

  • euler_numbers_histogram_file : File - PNG file containing the histogram of the Euler numbers.

Notes

This workflow assumes the subject-level or longitudinal analyses have already been performed.

A qc column is added to the TSV QC output table. It contains a binary flag indicating whether the produced results should be kept: qc = 1 if the result passes the thresholds, otherwise qc = 0.

The associated PNG histograms help verify that the chosen thresholds are neither too restrictive nor too permissive.

References

Examples

>>> from brainprep.config import Config
>>> from brainprep.reporting import RSTReport
>>> from brainprep.workflow import brainprep_group_sbm
>>>
>>> with Config(dryrun=True, verbose=False):
...     report = RSTReport()
...     outputs = brainprep_group_sbm(
...         output_dir="/tmp/dataset/derivatives",
...     ) 
>>> outputs 
Bunch(
    summary_files=[PosixPath('...'),...,PosixPath('...')]
    euler_numbers_file=PosixPath('...')
    euler_numbers_histogram_file=PosixPath('...')
)

Examples using brainprep.workflow.brainprep_group_sbm

SBM

SBM