MEGFlow Documentation

MEGFlow Documentation#

MEGFlow is a reproducible Nextflow pipeline for large-scale MEG preprocessing, built on MNE-Python and designed for containerized local, cluster, and corpus-scale workflows.

It provides configurable continuous preprocessing, automated artifact detection, ICA-based cleaning, task or resting-state epoching, MEG-MRI coregistration, source reconstruction, and static quality-control reports.

Core Capabilities#

Reproducible Execution

Docker and Apptainer/Singularity workflows keep runtime environments consistent across workstations, servers, and clusters.

Configurable Preprocessing

Filtering, notch filtering, resampling, Maxwell filtering, artifact detection, ICA, epoching, and source settings are configured in one file.

Automated QC

Bad channels, bad segments, ICA components, coregistration distances, epoch rejection, NormMEG-QC outputs, and workflow completeness are summarized for review.

Task and Resting Data

The continuous preprocessing core is task independent, while optional epoching supports fixed-length resting windows, trigger events, or BIDS event files.

Anatomy and Source Modeling

FreeSurfer or DeepPrep outputs can be reused or generated before BEM, coregistration, forward modeling, and source reconstruction.

Portable Reports

Static HTML reports bundle subject pages, figures, sidecars, CSV files, JSON summaries, workflow metadata, and a config snapshot when available.

Report Preview#

MEGFlow reports are designed to support dataset-level triage first, then subject-level review and interactive edits when needed. See Reports for the full static and interactive report tour.

Dataset dashboard
Dataset-level MEGFlow static report dashboard.

Aggregate NMDQ scores, bad-channel and bad-segment counts, coregistration metrics, epoch rejection, and alarm totals.

Reports
Workflow provenance
MEGFlow workflow diagram in the static report.

The selected steps mode is rendered as a stage diagram from the run manifest and effective configuration.

Reports

Where to Go Next#

Run Locally

Docker command structure, mounts, and common runtime options.

Local Docker Run
Run on a Cluster

SLURM and Singularity/Apptainer execution notes.

Cluster Execution
Full Workflow

Anatomy, epochs, covariance, coregistration, and source-level runs.

Full Workflow
Read QC Metrics

How report metrics are computed and how to interpret alarms.

Quality Control Metrics