MEG Pipeline Reference

The analysis of MEG data in the Human Connectome Project is performed using FieldTrip, a MATLAB toolbox for MEG and EEG analysis, in combination with additional analysis scripts and functions that have specifically been written for the HCP. The FieldTrip toolbox is described in detail in a reference paper and documentation is provided on its website. The additional analysis scripts and functions for the HCP are referred to as “megconnectome.” Both FieldTrip and megconnectome are released under the General Public License.

Download the megconnectome pipeline

Each of the compiled megconnectome packages used a specific fieldtrip version, as specified in the table below.

Pipeline Files FieldTrip Resources
v3.0: megconnectome pipeline v3.0 (354 MB)
v2.2: megconnectome pipeline v2.2 (354 MB)
v2.1: megconnectome pipeline v2.1 (354 MB)
v2.0: megconnectome pipeline v2.0 (354 MB)
v1.0: megconnectome pipeline v1.0 (346 MB)


Using the software.

We are releasing all software for several reasons. First, it gives you the opportunity to understand in detail how the analyses were performed to reproduce the results that are shared in ConnectomeDB. Second, it allows you to reanalyze the data using different settings of the analysis.  Finally, you will be able to employ the same analysis techniques on data that is recorded outside the HCP, i.e. on your own data. We do not guarantee that the implemented analysis techniques will work out of the box on your data, but the use of the general purpose FieldTrip toolbox (which supports many MEG and EEG data formats) will make it easier for you to use the HCP analyses with your own data.

The megconnectome software consists of analysis scripts, analysis functions and template data, e.g. the channel layout and a canonical MRI. Each analysis script represents one of the steps of the analysis pipeline as outlined in the HCP MEG reference paper and further described in the HCP MEG Initial Release Reference Manual. At the start of each script certain parameters are defined, such as the input file names and the parameter settings for the computations. The analysis script is executed in MATLAB and will call the megconnectome analysis functions, FieldTrip functions and standard MATLAB functions, passing the required arguments to the functions where needed.

The use of the megconnectome software assumes you to have a thorough understanding of MEG data analysis, and a reasonable understanding of MATLAB. For an introduction to MATLAB you can have a look at the excellent tutorial and exercises in MATLAB for Psychologists. A comprehensive introduction in the neuropysiology and biophysics of EEG, which is also relevant for MEG, is given in Electric Fields of the Brain: The Neurophysics of EEG, 2nd Edition by Nunez and Srinivasan. The book An Introduction to the Event-Related Potential Technique by Luck and the book Spectral Analysis for Physical Applications: Multitaper and Conventional Univariate Techniques by Percival and Walden explain the time- and frequency-domain data analysis methods that are employed on the data at the channel level. The book MEG: An Introduction to Methods by Hansen, Kringelbach and Salmelin provides a more elaborate description of MEG-specific analysis methods, including source reconstruction techniques.

Installing the software.

After downloading the zip files for the megconnectome and FieldTrip software release, you can extract them them to your hard drive. You start MATLAB, change the working directroy to the place where you extracted FieldTrip and type “ft_defaults”. This starts a helper script that will set up the path and set some global default settings. Subsequently you change the present working directory to the place where you extracted megconnectome and type “addpath(genpath(pwd))”. This will add the present working directory (i.e. megconnectome) and all subdirectories to your path.

Compiled execution on a Linux cluster.

The analysis of the MEG data is performed on the Linux cluster of the Center for High Performance Computing (CHPC), where MATLAB licenses are limited. For this reason we use a compiled version that is made using the MATLAB compiler toolbox. The compiled application includes the core MATLAB functions, the FieldTrip toolbox functions and the megconnectome functions.

The executable performs the analysis by reading the respective MATLAB scripts and using the “eval” command to execute them. This allows flexibility in the use of the analysis pipeline scripts, such as modifications of parameters and input/output files, without the requirement to recompile the executable. In short: the structure of the pipeline is defined in MATLAB scripts external to the executable, the corresponding functions that are called in the pipeline are compiled into the executable.

A consequence of the compiled execution on the Linux cluster is that almost all analysis scripts have to run in a non-interactive mode, i.e. without user intervention during the processing. The scripts start by reading data from disk, at the end write the results back to disk, and any textual output or figures that are created in between have to be stored on disk for post-hoc evaluation.

Future releases of the megconnectome software will include more details on the compiled executable.