Elsevier

NeuroImage

Volume 86, 1 February 2014, Pages 446-460
NeuroImage

MNE software for processing MEG and EEG data

https://doi.org/10.1016/j.neuroimage.2013.10.027Get rights and content

Highlights

  • The MNE software provides a complete pipeline for MEG and EEG data analysis.

  • MNE covers preprocessing, forward modeling, inverse methods, and visualization.

  • MNE supports advanced analysis: time-frequency, statistics, and connectivity.

  • MNE-Python enables fast and memory-efficient processing of large data sets.

  • MNE-Python is an open-source software supporting a collaborative development effort.

Abstract

Magnetoencephalography and electroencephalography (M/EEG) measure the weak electromagnetic signals originating from neural currents in the brain. Using these signals to characterize and locate brain activity is a challenging task, as evidenced by several decades of methodological contributions. MNE, whose name stems from its capability to compute cortically-constrained minimum-norm current estimates from M/EEG data, is a software package that provides comprehensive analysis tools and workflows including preprocessing, source estimation, time–frequency analysis, statistical analysis, and several methods to estimate functional connectivity between distributed brain regions. The present paper gives detailed information about the MNE package and describes typical use cases while also warning about potential caveats in analysis. The MNE package is a collaborative effort of multiple institutes striving to implement and share best methods and to facilitate distribution of analysis pipelines to advance reproducibility of research. Full documentation is available at http://martinos.org/mne.

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)

  • A. Gramfort et al.

    Time–frequency mixed-norm estimates: sparse M/EEG imaging with non-stationary source activations

    NeuroImage

    (2013)
  • J. Gross et al.

    Good practice for conducting and reporting MEG research

    NeuroImage

    (2013)
  • R. Hari et al.

    Human cortical oscillations: a neuromagnetic view through the skull

    Trends Neurosci.

    (1997)
  • A. Hillebrand et al.

    The use of anatomical constraints with MEG beamformers

    NeuroImage

    (2003)
  • A. Hyvärinen et al.

    Independent component analysis: algorithms and applications

    Neural Netw.

    (2000)
  • E. Larson et al.

    The cortical dynamics underlying effective switching of auditory spatial attention

    NeuroImage

    (2013)
  • F.-H. Lin et al.

    Spectral spatiotemporal imaging of cortical oscillations and interactions in the human brain

    NeuroImage

    (2004)
  • F.H. Lin et al.

    Spectral spatiotemporal imaging of cortical oscillations and interactions in the human brain

    NeuroImage

    (2004)
  • F.H. Lin et al.

    Assessing and improving the spatial accuracy in MEG source localization by depth-weighted minimum-norm estimates

    NeuroImage

    (2006)
  • E. Maris et al.

    Nonparametric statistical testing of EEG- and MEG-data

    J. Neurosci. Methods

    (2007)
  • P.-G. Martinsson et al.

    A randomized algorithm for the decomposition of matrices

    Appl. Comput. Harmon. Anal.

    (2011)
  • G. Nolte et al.

    Identifying true brain interaction from EEG data using the imaginary part of coherency

    Clin. Neurophysiol.

    (2004)
  • W. Ou et al.

    A distributed spatio-temporal EEG/MEG inverse solver

    NeuroImage

    (2009)
  • D. Pantazis et al.

    A comparison of random field theory and permutation methods for the statistical analysis of MEG data

    NeuroImage

    (2005)
  • G.R. Ridgway et al.

    The problem of low variance voxels in statistical parametric mapping; a new hat avoids a “haircut”

    NeuroImage

    (2012)
  • M. Scherg et al.

    Two bilateral sources of the late AEP as identified by a spatio-temporal dipole model

    Electroencephalogr. Clin. Neurophysiol.

    (1985)
  • L. Stenbacka et al.

    Comparison of minimum current estimate and dipole modeling in the analysis of simulated activity in the human visual cortices

    NeuroImage

    (2002)
  • C. Tallon-Baudry et al.

    Oscillatory gamma activity in humans and its role in object representation

    Trends Cogn. Sci.

    (1999)
  • K. Uutela et al.

    Visualization of magnetoencephalographic data using minimum current estimates

    NeuroImage

    (1999)
  • K. Uutela et al.

    Detecting and correcting for head movements in neuromagnetic measurements

    NeuroImage

    (2001)
  • D. Van Essen et al.

    The Human Connectome Project: a data acquisition perspective

    NeuroImage

    (2012)
  • M. Vinck et al.

    The pairwise phase consistency: a bias-free measure of rhythmic neuronal synchronization

    NeuroImage

    (2010)
  • M. Vinck et al.

    An improved index of phase-synchronization for electrophysiological data in the presence of volume-conduction, noise and sample-size bias

    NeuroImage

    (2011)
  • C. Aine et al.

    MEG-SIM: a web portal for testing MEG analysis methods using realistic simulated and empirical data

    Neuroinformatics

    (2012)
  • D.A. Aruliah et al.

    Best practices for scientific computing

    Clin. Orthop. Relat. Res.

    (2012)
  • R.A. Becker et al.

    A Tour of Trellis Graphics

    (1996)
  • P. Besl et al.

    A method for registration of 3-d shapes

    IEEE Trans. Pattern Anal. Mach. Intell.

    (1992)
  • T. Bhat et al.

    Evaluating the efficacy of test-driven development: industrial case studies

  • M. Brookes et al.

    Investigating the electrophysiological basis of resting state networks using magnetoencephalography

    Proc. Natl. Acad. Sci. U. S. A.

    (2011)
  • G. Buzsaki

    Rhythms of the Brain

    (2006)
  • J.W. Cooley et al.

    An algorithm for the machine calculation of complex Fourier series

    Math. Comput.

    (1965)
  • S.S. Dalal et al.

    MEG/EEG source reconstruction, statistical evaluation, and visualization with nutmeg

    Comput. Intell. Neurosci.

    (2011)
  • A. Dale et al.

    Improved localization of cortical activity by combining EEG and MEG with MRI cortical surface reconstruction: a linear approach

    J. Cogn. Neurosci.

    (1993)
  • A. Delorme et al.

    EEGLAB, SIFT, NFT, BCILAB, and ERICA: new tools for advanced EEG processing

    Intell. Neurosci

    (2011)
  • P. Dubois

    Maintaining correctness in scientific programs

    Comput. Sci. Eng.

    (2005)
  • B. Fischl et al.

    Automatically parcellating the human cerebral cortex

    Cereb. Cortex

    (2004)
  • P. Fries

    Neuronal gamma-band synchronization as a fundamental process in cortical computation

    Ann. Rev. Neurosci.

    (2009)
  • K.J. Friston

    Functional and effective connectivity in neuroimaging: a synthesis

    Hum. Brain Mapp.

    (1994)
  • M. Fuchs et al.

    Linear and nonlinear current density reconstructions

    J. Clin. Neurophysiol.

    (1999)
  • K. Gorgolewski et al.

    Nipype: a flexible, lightweight and extensible neuroimaging data processing framework in python

    Front. Neuroinform.

    (2011)
  • Cited by (1229)

    • P3b correlates of inspection time

      2024, IBRO Neuroscience Reports
    View all citing articles on Scopus
    View full text