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.quasiraw.brainprep_group_quasiraw

brainprep.workflow.quasiraw.brainprep_group_quasiraw(output_dir, correlation_threshold=0.5, keep_intermediate=False)[source]

Group level Quasi-RAW pre-processing.

Applies the quality control described in [1]. This includes:

  1. Generate a TSV file containing the mean correlation of each image to the template.

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

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

  4. Computing a PCA embedding of the images.

  5. Generating a scatter plot of the first two PCA components with BIDS annotations for visual inspection.

Parameters:
output_dirDirectory

Working directory containing all the subjects.

correlation_thresholdfloat

Quality control threshold on the correlation score. Default 0.5.

keep_intermediatebool

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

Returns:
Bunch

A dictionary-like object containing:

  • correlations_file : File - a TSV file containing mean correlation of each input image to the atlas image quality check (QC) data.

  • correlation_histogram_file : File - PNG file containing the histogram of the computed mean correlations.

  • pca_file : File - a TSV file containing PCA two first components as two columns named pc1 and pc2, as well as BIDS participant_id, session, and run.

  • pca_image_file : File - PNG file containing the two first PCA components with participant_id, session, and run annotations.

Notes

This workflow assumes the subject-level 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.

Examples

>>> from brainprep.config import Config
>>> from brainprep.reporting import RSTReport
>>> from brainprep.workflow import brainprep_group_quasiraw
>>>
>>> with Config(dryrun=True, verbose=False):
...     report = RSTReport()
...     outputs = brainprep_group_quasiraw(
...         output_dir="/tmp/dataset/derivatives",
...     )
>>> outputs
Bunch(
    correlations_file: PosixPath('...')
    correlation_histogram_file: PosixPath('...')
    pca_file: PosixPath('...')
    pca_image_file: PosixPath('...')
)