MNE software for processing MEG and EEG data
Graphical abstract
Introduction
By non-invasively measuring electromagnetic signals ensuing from neurons, M/EEG are unique tools to investigate the dynamically changing patterns of brain activity. Functional magnetic resonance imaging (fMRI) provides a spatial resolution in the millimeter scale, but its temporal resolution is limited as it measures neuronal activity indirectly by imaging the slow hemodynamic response. On the other hand, EEG and MEG measure the electric and magnetic fields directly related to the underlying electrophysiological processes and can thus attain a high temporal resolution. This enables the investigation of neuronal activity over a wide range of frequencies. High-frequency oscillations, for example, are thought to play a central role in neuronal computation as well as to serve as the substrate of consciousness and awareness (Fries, 2009, Tallon-Baudry et al., 1997). Low-frequency modulations, some of them possibly associated with resting-state networks observed with fMRI, can also be successfully captured with MEG (Brookes et al., 2011, Hipp et al., 2012).
However, the processing of M/EEG data to obtain accurate localization of active neural sources is a complicated task: it involves segmenting various structures from anatomical MRIs, numerical solution of the electromagnetic forward problem, signal denoising, a solution to the ill-posed electromagnetic inverse problem, and appropriate control of multiple statistical comparisons spanning space, time and frequency across experimental conditions and groups of subjects. This complexity not only constitutes a challenge to MEG investigators but also offers a great deal of flexibility in data analysis. To successfully process M/EEG data, comprehensive and well-documented analysis software is therefore required.
MNE is an academic software package that aims to provide data analysis pipelines encompassing all phases of M/EEG data processing. Multiple academic software packages for M/EEG data processing exist, e.g., Brainstorm (Tadel et al., 2011), EEGLAB (Delorme and Makeig, 2004, Delorme et al., 2011), FieldTrip (Oostenveld et al., 2011), NutMeg (Dalal et al., 2011) and SPM (Litvak et al., 2011), all implemented in Matlab, with some dependencies on external packages such as OpenMEEG (Gramfort et al., 2010) for boundary element method (BEM) forward modeling and NeuroFEM for volume based finite element method (FEM) (Wolters et al., 2007) forward modeling. Many analysis methods are common to all these packages, yet MNE has some unique capabilities. Among these is a tight integration with the anatomical reconstruction provided by the FreeSurfer software, as well as a selection of inverse solvers for source imaging.
MNE software consists of three core subpackages which are fully integrated: the original MNE-C (distributed as compiled C code), MNE-Matlab, and MNE-Python. The subpackages employ the same Neuromag FIF file format and use consistent analysis steps with compatible intermediate files. Consequently, the packages can be combined for a particular task in a flexible manner. The FIF file format allows storage of any type of information in a single file using a hierarchy of elements known as tags. The original MNE-C, conceived and written at the Martinos Center at Massachusetts General Hospital, consists of command line programs that can be used in shell scripts for automated processing, and two graphical user interface (GUI) applications for raw data inspection, coordinate alignment, and inverse modeling, as illustrated in Fig. 1.
MNE-C is complemented by two more recent software packages, MNE-Matlab and MNE-Python. Both are open source and distributed under the simplified BSD license allowing their use in free as well as in commercial software.
The MNE-Matlab code provides basic routines for reading and writing FIF files. It is redistributed as a part of several Matlab-based M/EEG software packages (Brainstorm, FieldTrip, NutMeg, and SPM). The MNE-Python code is the most recent addition to the MNE software; it started as a reimplementation of the MNE-Matlab code, removing any dependencies on commercial software. After an intensive collaborative software development effort, MNE-Python now provides several additional features, such as time–frequency analysis, non-parametric statistics, and connectivity estimation. An overview of the analysis components supported by the various parts of MNE is shown in Table 1. The comprehensive set of features offered by the Python package is made possible by a group of dedicated contributors at multiple institutions in several countries who collaborate closely. This is facilitated by the use of a software development process that is entirely public and open for anyone to contribute.
From a user's perspective, moving between the components listed in Table 1 means moving between different scripts in a text editor. Using the enhanced interactive IPython shell (Pérez and Granger, 2007), a core ingredient of the standard scientific Python stack, all MNE components can be interactively accessed simultaneously from within one environment. For example, one may enter ‘!mne_analyze’ in the IPython shell to launch the MNE-C GUI to perform coordinate alignment. After closing the GUI, they could return back to the Python session to proceed with the FIF file generated during that step. An extensive set of example scripts exposing typical workflows or elements thereof while serving as copy and paste templates is available on the MNE website and is included in the MNE-Python code.
The MNE software also provides a sample dataset consisting of recordings from one subject with combined M/EEG conducted at the Martinos Center of Massachusetts General Hospital. These data were acquired with a Neuromag VectorView system (Elekta Oy, Helsinki, Finland) with 306 sensors arranged in 102 triplets, each comprising two orthogonal planar gradiometers and one magnetometer. EEG was recorded simultaneously using an MEG-compatible cap with 60 electrodes. In the experiment, auditory stimuli (delivered monaurally to the left or right ear) and visual stimuli (shown in the left or right visual hemifield) were presented in a random sequence with a stimulus-onset asynchrony (SOA) of 750 ms. To control for subject's attention, a smiley face was presented intermittently and the subject was asked to press a button upon its appearance. These data are provided with the MNE-Python package and they are used in this paper for illustration purposes. This dataset can also serve as a standard validation dataset for M/EEG methods, hence favoring reproducibility of results. However, induced responses, recovered by time–frequency analysis, are illustrated in the present paper using somatosensory responses to electric stimulation of the median nerve at wrist. These data (see (Sorrentino et al., 2009) for details) were recorded with a similar MEG system as the MNE sample data. In addition to the provided sample data, MNE-Python facilitates easy access to the MEGSIM datasets (Aine et al., 2012) that include both experimental and simulated MEG data. These data are continuous raw signals, single-trial or averaged evoked responses, either with auditory, visual, or with somatosensory stimuli presented to the subjects.
The goal of this contribution is to describe the MNE software in detail and to illustrate how to implement good analysis practices (Gross et al., 2013) as MNE pipelines. We also explicitly mention potential caveats in different stages of the analysis. With this work, we aim to help standardize M/EEG analysis pipelines, which will improve the reproducibility of research findings.
The structure of the paper follows the natural order of steps performed when analyzing M/EEG data, from preprocessing to statistical analysis of source estimates, including methods such as time–frequency analysis and functional connectivity estimation. We first present an overview of standard analysis methods before detailing the recommended MNE analysis strategy.
Section snippets
Data inspection and de-noising
As the first step of a general M/EEG analysis workflow, the raw data need to be inspected for interference and artifacts, which include detecting dysfunctional, noisy and “jumping” channels. While the software provided by M/EEG vendors is generally useful for reviewing the data, both MNE-C and MNE-Python offer raw data visualization tools that facilitate the identification of such bad channels. Besides inspecting the raw sensor time courses for artifacts, spatial patterns may add valuable
The MNE way: Using MNE software for analysis
In this section, we provide a detailed description of the M/EEG analysis steps supported by the MNE software. The description covers all components of MNE, i.e., MNE-C, MNE-Matlab, and MNE-Python. The outline of this section closely follows Table 1, which provides an overview. Specifically, we cover preprocessing, discuss forward and inverse modeling, describe the surface based registration process (also known as morphing) for group studies, explain the time–frequency transforms implemented,
Discussion
Data processing, such as M/EEG analysis, can be thought of as a chain or pipeline of operations, where each step has an impact on the results. In the preceding sections we have discussed particular choices made in the MNE software to proceed from preprocessing to advanced applications such as statistics in the source space, including surface based registration for group studies, or connectivity measures between brain regions of interest.
MNE provides a few modules with graphical user interfaces
Acknowledgments
This work was supported by the National Institute of Biomedical Imaging and Bioengineering grants 5R01EB009048 and P41RR014075, National Institute on Deafness and Other Communication Disorders fellowship F32DC012456, and NSF awards 0958669 and 1042134. The work of A.G. was partially supported by ERC-YStG-263584 and L.P. was supported by the “aivoAALTO” program. M.L. was partially supported by the Swiss National Science Foundation Early Postdoc. Mobility fellowship 148485.
References (104)
- et al.
Behaviour of granger causality under filtering: theoretical invariance and practical application
J. Neurosci. Methods
(2011) - et al.
Cortical surface-based analysis I: segmentation and surface reconstruction
NeuroImage
(1999) - et al.
Dynamic statistical parametric mapping: combining fMRI and MEG for high-resolution imaging of cortical activity
Neuron
(2000) - et al.
EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics including independent component analysis
J. Neurosci. Methods
(2004) - et al.
An automated labeling system for subdividing the human cerebral cortex on MRI scans into gyral based regions of interest
NeuroImage
(2006) - et al.
Automatic parcellation of human cortical gyri and sulci using standard anatomical nomenclature
NeuroImage
(2010) - et al.
Cortical surface-based analysis II: inflation, flattening, and a surface-based coordinate system
NeuroImage
(1999) - et al.
The effect of filtering on granger causality based multivariate causality measures
NeuroImage
(2010) - et al.
A structured experiment of test-driven development
Inf. Softw. Technol.
(2004) - et al.
A wavelet-based method for measuring the oscillatory dynamics of resting-state functional connectivity in MEG
NeuroImage
(2011)
Time–frequency mixed-norm estimates: sparse M/EEG imaging with non-stationary source activations
NeuroImage
Good practice for conducting and reporting MEG research
NeuroImage
Human cortical oscillations: a neuromagnetic view through the skull
Trends Neurosci.
The use of anatomical constraints with MEG beamformers
NeuroImage
Independent component analysis: algorithms and applications
Neural Netw.
The cortical dynamics underlying effective switching of auditory spatial attention
NeuroImage
Spectral spatiotemporal imaging of cortical oscillations and interactions in the human brain
NeuroImage
Spectral spatiotemporal imaging of cortical oscillations and interactions in the human brain
NeuroImage
Assessing and improving the spatial accuracy in MEG source localization by depth-weighted minimum-norm estimates
NeuroImage
Nonparametric statistical testing of EEG- and MEG-data
J. Neurosci. Methods
A randomized algorithm for the decomposition of matrices
Appl. Comput. Harmon. Anal.
Identifying true brain interaction from EEG data using the imaginary part of coherency
Clin. Neurophysiol.
A distributed spatio-temporal EEG/MEG inverse solver
NeuroImage
A comparison of random field theory and permutation methods for the statistical analysis of MEG data
NeuroImage
The problem of low variance voxels in statistical parametric mapping; a new hat avoids a “haircut”
NeuroImage
Two bilateral sources of the late AEP as identified by a spatio-temporal dipole model
Electroencephalogr. Clin. Neurophysiol.
Comparison of minimum current estimate and dipole modeling in the analysis of simulated activity in the human visual cortices
NeuroImage
Oscillatory gamma activity in humans and its role in object representation
Trends Cogn. Sci.
Visualization of magnetoencephalographic data using minimum current estimates
NeuroImage
Detecting and correcting for head movements in neuromagnetic measurements
NeuroImage
The Human Connectome Project: a data acquisition perspective
NeuroImage
The pairwise phase consistency: a bias-free measure of rhythmic neuronal synchronization
NeuroImage
An improved index of phase-synchronization for electrophysiological data in the presence of volume-conduction, noise and sample-size bias
NeuroImage
MEG-SIM: a web portal for testing MEG analysis methods using realistic simulated and empirical data
Neuroinformatics
Best practices for scientific computing
Clin. Orthop. Relat. Res.
A Tour of Trellis Graphics
A method for registration of 3-d shapes
IEEE Trans. Pattern Anal. Mach. Intell.
Evaluating the efficacy of test-driven development: industrial case studies
Investigating the electrophysiological basis of resting state networks using magnetoencephalography
Proc. Natl. Acad. Sci. U. S. A.
Rhythms of the Brain
An algorithm for the machine calculation of complex Fourier series
Math. Comput.
MEG/EEG source reconstruction, statistical evaluation, and visualization with nutmeg
Comput. Intell. Neurosci.
Improved localization of cortical activity by combining EEG and MEG with MRI cortical surface reconstruction: a linear approach
J. Cogn. Neurosci.
EEGLAB, SIFT, NFT, BCILAB, and ERICA: new tools for advanced EEG processing
Intell. Neurosci
Maintaining correctness in scientific programs
Comput. Sci. Eng.
Automatically parcellating the human cerebral cortex
Cereb. Cortex
Neuronal gamma-band synchronization as a fundamental process in cortical computation
Ann. Rev. Neurosci.
Functional and effective connectivity in neuroimaging: a synthesis
Hum. Brain Mapp.
Linear and nonlinear current density reconstructions
J. Clin. Neurophysiol.
Nipype: a flexible, lightweight and extensible neuroimaging data processing framework in python
Front. Neuroinform.
Cited by (1229)
P3b correlates of inspection time
2024, IBRO Neuroscience ReportsLGNet: Learning local–global EEG representations for cognitive workload classification in simulated flights
2024, Biomedical Signal Processing and ControlMGSN: Depression EEG lightweight detection based on multiscale DGCN and SNN for multichannel topology
2024, Biomedical Signal Processing and ControlAtypical paroxysmal slow cortical activity in healthy adults: Relationship to age and cognitive performance
2024, Neurobiology of Aging