Brainstorm is a collaborative open-source application dedicated to magnetoencephalography (MEG) and electroencephalography (EEG) data visualization and processing, with an emphasis on cortical source estimation techniques and their integration with anatomical magnetic resonance imaging (MRI) data. The primary objective of the software is to connect MEG/EEG neuroscience investigators with both the best-established and cutting-edge methods through a simple and intuitive graphical user interface (GUI).
Although MEG and EEG instrumentation is becoming more common in neuroscience research centers and hospitals, research software availability and standardization remain limited compared to the other functional brain imaging modalities. MEG/EEG source imaging poses a series of specific technical challenges that have, until recently, impeded academic software developments and their acceptance by users (e.g., the multidimensional nature of the data, the multitude of approaches to modeling head tissues and geometry, and the ambiguity of source modeling). Ideally, MEG/EEG imaging is multimodal: MEG and EEG recordings need to be registered to a source space that may be obtained from structural MRI data, which adds to the complexity of the analysis. Further, there is no widely accepted standard MEG/EEG data format, which has limited the distribution and sharing of data and created a major technical hurdle to academic software developers.
MEG/EEG data analysis and source imaging feature a multitude of possible approaches, which draw on a wide range of signal processing techniques. Forward head modeling for example, which maps elemental neuronal current sources to scalp potentials and external magnetic fields, is dependent on the shape and conductivity of head tissues and can be performed using a number of methods, ranging from simple spherical head models [
The user’s needs for analysis and visualization of MEG and EEG data vary greatly depending on their application. In a clinical environment, raw recordings are often used to identify and characterize abnormal brain activity, such as seizure events in epileptic patients [
Despite such daunting diversity and complexity in user needs and methodological approaches, an integrated software solution would be beneficial to the imaging community and provide progressive automation, standardization and reproducibility of some of the most common analysis pathways. The Brainstorm project was initiated more than 10 years ago in collaboration between the University of Southern California in Los Angeles, the Salpêtrière Hospital in Paris, and the Los Alamos National Laboratory in New Mexico. The project has been supported by the National Institutes of Health (NIH) in the USA and the Centre National de la Recherche Scientifique (CNRS) in France. Its objective is to make a broad range of electromagnetic source imaging and visualization techniques accessible to nontechnical users, with an emphasis on the interaction of users with their data at multiple stages of the analysis. The first version of the software was released in 2000, [
Brainstorm is free and open source. Some recent publications using Brainstorm as a main analysis software tool are listed in [
Brainstorm is open-source software written almost entirely in Matlab scripts and distributed under the terms of the General Public License (GPL). Its interface is written in Java/Swing embedded in Matlab scripts, using Matlab’s ability to work as a Java console. The use of Matlab and Java make Brainstorm a fully portable, cross-platform application.
The advantage of scripting languages in a research environment is the simplicity to maintain, modify, exchange, and reuse functions and libraries. Although Python might be a better choice for a new project because of its noncommercial open source license, Brainstorm was built from a vast amount of pre-existing lines of Matlab code as its methodological foundations for data analysis. The Matlab development environment is also a high-performance prototyping tool. One important feature for users who do not own a Matlab license is that a stand-alone version of Brainstorm, generated with the Matlab Compiler, is also available for download for the Windows and Linux operating systems.
All software functions are accessible through the GUI, without any direct interaction with the Matlab environment; hence, Brainstorm can be used without Matlab or programming experience. For more advanced users, it is also possible to run all processes and displays from Matlab scripts, and all data structures manipulated by Brainstorm can be easily accessed from the Matlab command window.
The source code is accessible for developers on an SVN server, and all related Brainstorm files are compressed daily into a zip file that is publicly available from the website, to facilitate download and updates for the end user. Brainstorm also features an automatic update system that checks at each startup if the software should be updated and whether downloading a new version is necessary.
User documentation is mainly organized in detailed online tutorials illustrated with numerous screen captures that guide the user step by step through all software features. The entire website is based on a MoinMoin wiki system [
Brainstorm is driven by its interface: it is not a library of functions on top of which a GUI has been added to simplify access but rather a generic environment structured around one unique interface in which specific functions were implemented (Figure
General overview of the Brainstorm interface. Considerable effort was made to make the design intuitive and easy to use. The interface includes: (a) a file database that provides direct access to all data (recordings, surfaces, etc.), (b) contextual menus that are available throughout the interface with a right-button click, (c) a batch tool that launches processes (filtering, averaging, statistical tests, etc.) for all files that were drag-and-dropped from the database; (right) multiple displays of information from the database, organized as individual figures and automatically positioned on the screen, and (d) properties of the currently active display.
Data files are saved in the Matlab.mat format and are organized in a structured database with three levels of classification: protocols, subjects, and experimental conditions. User data is always directly accessible from the database explorer, regardless of the actual file organization on the hard drive. This ensures immediate access to all protocol information and allows simultaneous display and comparison of recordings or sources from multiple runs, conditions, or subjects.
Brainstorm requires three categories of inputs to proceed to MEG/EEG source analysis: the anatomy of the subject, the MEG/EEG recordings, and the 3D locations of the sensors. The anatomy input is usually a T1-weighted MRI of the full head, plus at least two tessellated surfaces representing the cerebral cortex and scalp. Supported MRI formats include Analyze, NIfTI, CTF, Neuromag, BrainVISA, and MGH. Brainstorm does not extract cortical and head surfaces from the MRI, but imports surfaces from external programs. Three popular and freely available surface formats are supported: BrainSuite [
The native file formats from three main MEG manufacturers are supported: Elekta-Neuromag, CTF, and BTi/4D-Neuroimaging. The generic file format developed at La Salpêtrière Hospital in Paris (LENA) is also supported. Supported EEG formats include: Neuroscan (cnt, eeg, avg), EGI (raw), BrainVision BrainAmp, EEGLab, and Cartool. Users can also import their data using generic ASCII text files.
Sensor locations are always included in MEG files; however, this is not the case for the majority of EEG file formats. Electrode locations need to be imported separately. Supported electrode definition files include: BESA, Polhemus Isotrak, Curry, EETrak, EGI, EMSE, Neuroscan, EEGLab, Cartool, and generic ASCII text files.
Other formats not yet supported by Brainstorm will be available shortly. Our strategy will merge Brainstorm’s functions for the input and output from and to external file formats with the
Brainstorm features an extensive preprocessing pipeline for MEG/EEG data: visual or automatic detection of bad trials and bad channels, event marking and definition, baseline correction, frequency filtering, data resampling, averaging, and the estimation of noise statistics. Other preprocessing operations can be performed easily with other programs (EEGLab [
Expanding preprocessing operations with the most popular techniques for noise reduction and automatic artifact detection is one of our priorities for the next few years of development.
Brainstorm provides a rich interface for displaying and interacting with MEG/EEG recordings (Figure
Brainstorm features multiple solutions for the visualization of MEG/EEG recordings.
These visualization tools can be used either on segments of recordings that are fully copied into the Brainstorm database and saved in the Matlab.mat file format, or on typically larger, ongoing recordings, directly read from the original files and which remain stored in native file formats. The interface for reviewing raw recordings (Figure
Interface for reviewing raw recordings and marking events.
Analysis can be performed on the individual subject anatomy (this requires the importation of the MRI and surfaces as described above) or using the Brainstorm’s default anatomy (included in Brainstorm’s distribution), which is derived from the MNI/Colin27 brain [
MRI and surface visualization.
Analysis in Brainstorm involves integration of data from multiple sources: MEG and/or EEG recordings, structural MRI scans, and cortical and scalp surface tessellations. Their geometrical registration in the same coordinate system is essential to the accuracy of source imaging. Brainstorm aligns all data in a subject coordinate system (SCS), whose definition is based on 3 fiducial markers: the nasion, left preauricular, and right preauricular points: more details regarding the definition of the SCS are available at Brainstorm’s website.
Aligning the MRI data volume with the surface tessellations of the head tissues is straightforward and automatic as both usually originate from the same volume of data. Nevertheless, Brainstorm features several options to manually align the surface tessellations with the MRI and to perform quality control of this critical step including definition of the reference points on the scalp surface (Figure
Registration of MRI data volumes with corresponding surface meshes.
The fiducial reference points need to be first defined in the MRI volume (see above and Figure
It is common in EEG to run a study without collecting individual anatomical data (MRI volume data or individual electrode positions). Brainstorm has a tool that lets users define and edit the locations of the EEG electrodes at the surface of the individual or generic head (Figure
Brainstorm tool for editing of EEG electrode montages.
When the individual MRI data is not available for a subject, the MNI/Colin27 template can be warped to fit a set of head points digitized from the individual anatomy of the subject. This creates an approximation of the individual anatomy based on scalp morphology, as illustrated in Figure
Warping of the MRI volume and corresponding tissue surface envelopes of the Colin27 template brain to fit a set a digitized head points (white dots in upper right corner): initial Colin27 anatomy (left) and warped to the scalp control points of another subject (right). Note how surfaces and MRI volumes are adjusted to the individual data.
Forward modeling refers to the correspondence between neural currents and MEG/EEG sensor measurements. This step depends on the shape and conductivity of the head and can be computed using a number of methods, ranging from simple spherical head models [
Over the past ten years, multiple approaches to forward modeling have been prototyped, implemented, and tested in Brainstorm. The ones featured in the software today offer the best compromise between robustness (adaptability to any specific case) and accuracy (precision of the results). Other techniques will be added in the future. Current models include the single sphere and overlapping spheres methods for MEG [
Interactive selection of the best-fitting sphere model parameter for MEG and EEG forward modeling.
EEG is more sensitive to approximations in the geometry of the head as a volume conductor so that boundary element methods (BEMs) may improve model accuracy. A BEM approach for both MEG and EEG will soon be added to Brainstorm through a contribution from the OpenMEEG project [
Inverse modeling resolves the cortical sources that gave rise to a specific set of MEG or EEG recordings. In Brainstorm, the main method to estimate source activities is adapted from the depth-weighted minimum L2 norm estimator of cortical current density [
The region of support for these inverse methods can be either the entire head volume or restricted to the cortical surface, with or without constraints on source orientations. In the latter case, elementary dipole sources are distributed over the nodes of the surface mesh of the cortical surface. The orientation of the elementary dipoles can be left either unconstrained or constrained normally to the cortical surface. In all cases, the recommended number of dipoles to use for source estimation is about 15,000 (decimation of the original surface meshes can be performed within Brainstorm).
Brainstorm can manage the various types of sensors (EEG, MEG gradiometers, and MEG magnetometers) that may be available within a given dataset. When multiple sensor types are processed together in a joint source model, the empirical noise covariance matrix is used to estimate the weight of each individual sensor in the global reconstruction. The noise covariance statistics are typically obtained from an empty-room recording, which captures the typical instrumental and environmental fluctuations.
Brainstorm provides a large set of tools to display, visualize, and explore the spatio-temporal features of the estimated source maps (Figure
A variety of options for the visualization of estimated sources. (a) 3D rendering of the cortical surface, with control of surface smoothing; (c) 3D orthogonal planes of the MRI volumes; (b) conventional orthogonal views of the MRI volume with overlay of the MEG/EEG source density.
A dedicated interface lets the user define and analyze the time courses of specific regions of interest, named
Selection of cortical regions of interest in Brainstorm and extraction of a representative time course of the elementary sources within.
The rich contextual popup menus available in all visualization windows suggest predefined selections of views for creating a large variety of plots. The resulting views can be saved as images, movies, or contact sheets (Figure
Temporal evolution of elementary dipole sources estimated with the external Xfit software. Data from a right-temporal epileptic spike. This component was implemented in collaboration with Elizabeth Bock, MEG Program, Medical College of Wisconsin.
Brainstorm features a dedicated user interface for performing the time-frequency decomposition of MEG/EEG sensor and source time series using Morlet wavelets [
Time-frequency decompositions tend to increase the volume of data dramatically, as it is decomposed in the space, time, and frequency dimensions. Brainstorm has been efficiently designed to either store the transformed data or compute it on the fly.
Data can be analyzed as instantaneous measurements, or grouped into temporal and spectral bands of interest such as alpha (8–12 Hz) [
Figure
A variety of display options to visualize time-frequency decompositions using Brainstorm (see text for details).
The main window includes a graphical batching interface (Figure
Graphical interface of the batching tool. (a) selection of the input files by drag-and-drop. (b) creation of an analysis pipeline. (c) example of Matlab script generated automatically.
The available processes are organized in a plug-in structure. Any Matlab script that is added to the plug-in folder and has the right format will be automatically detected and made available in the GUI. This mechanism makes the contribution from other developers to Brainstorm very easy.
For advanced users and visualization purposes, Brainstorm can be used as a high-level scripting environment. All Brainstorm operations have been designed to interact with the graphical interface and the database; therefore, they have very simple inputs: mouse clicks and keyboard presses. As a result, the interface can be manipulated through Matlab scripts, and each mouse click can be translated into a line of script. Similar to working through the graphical interface, all contextual information is gathered from the interface and the database, so that most of the functions may be called with a limited number of parameters, and, for example, there is no need to keep track of file names. As a result, scripting with Brainstorm is intuitive and easy to use. Figure
Example of Brainstorm script.
Brainstorm’s “
Student
We specifically address here how to perform multisubject data analysis using Brainstorm. In multisubject studies, measurement variance has two sources: the within-subject variance and the between-subject variance. Using collectively all trials from every subject simultaneously for comparisons is fixed-effects analysis [
Consider the example of investigating experimental effects, where prestimulus data are compared against post-stimulus data. The first level analysis averages all trials from each subject to yield prestimulus and post-stimulus responses. The second-level analysis can be a paired
Brainstorm also supports statistical thresholding of the resulting activation maps, which takes into account the multiple hypotheses testing problem. The available methods include Bonferroni, false discovery rate [
In order to compare multiple subjects at the source level, an intermediate step is required if the sources were originally mapped on the individual subject anatomies. The sources estimated on individual brains are first projected on the cortical surface of the MNI-Colin27 brain. In the current implementation, the surface-to-surface registration is performed hemisphere by hemisphere using the following procedure: (1) alignment along the anterior commissure/posterior commissure axis, (2) spatial smoothing to preserve only the main features of the surfaces onto which the registration will be performed, (3) deformation of the individual surface to match the MNI surface with an iterative closest point algorithm (ICP) [
Cortical activations 46 ms after the electric stimulation of the left median nerve on the subject’s brain (a) and their projection in the MNI brain (b).
Brainstorm is a project under constant development, and the current version provides an environment where new features are readily implemented and adapted to the interface. There are several recurrent requests from users for new features, as well as plans for future developments. Examples of forthcoming developments in the next two years include:
– expanding the preprocessing operations with the most popular techniques for noise reduction and automatic artifact detection,
– integration of methods for functional connectivity analysis and multivariate statistical analysis [
– expanding forward and inverse calculations to include BEM and multiple dipole fitting methods,
– interface for simulating MEG/EEG recordings using simulated sources and realistic anatomy,
– segmentation of MEG/EEG recordings in functional micro-states, using optical flow models [
Several commercial solutions to visualize and process MEG/EEG data are available. Most are developed for specific acquisition systems and are often designed by the manufacturers of these systems. They are typically unsuitable for research for several reasons: they are mainly driven by the requirements of clinical environment and FDA and CE certifications; their all-graphical interface seldom provides information about the underlying data analysis, file formats, are sometimes proprietary and undocumented; source code and description of the algorithms are not accessible to the user, and they are expensive. The research community needs solutions that are completely open, with the possibility of directly manipulating the code, data, and parameters.
As a result, many laboratories have developed their own tools for MEG and EEG data analysis. However, these tools are often not shared either because of the lack of interest or because of the required effort to support the software, develop documentation, and create and maintain a distribution website. However, the approach of developing individual tools is very limiting because of the limited availability of human resources assigned to software development in most research groups and the breadth of expertise that is required (electrophysiology, electromagnetic modeling, signal processing, statistics, classification, software optimization, real-time processing, human-machine interfaces ergonomics, etc.).
In the past two decades, many projects have been developed to offer open and free alternatives to the wide range of commercial solutions. Common among these projects is the support by a large community of developers around the world, who produce free and reusable source code. For this purpose, the free software community equipped itself with tools to facilitate collaborative work, such as version managers, forums, wikis, and discussion lists. This approach to collaborative software development has not only reached a high level of maturity, but also proved its efficiency. The best example is probably the Linux operating system, whose stability matches or exceeds that of commercially produced operating systems.
In the realm of functional brain mapping, open-source tools such as SPM [
Free software packages with similar features to Brainstorm (general purpose software for MEG/EEG) are EEGLab, FieldTrip, and MNE. The first two are written under the Matlab environment, with noncompiled scripts, and are supported by large communities of users connected with active forums and diffusion lists. EEGLab offers a simple but functional interface, and its target application is oriented towards the preprocessing of recordings and ICA analysis. FieldTrip is a rich and powerful toolbox that offers the widest range of functionalities, but without a graphic interface; its usage requires good skills in Matlab programming. MNE is also organized as a set of independent functions, easily scriptable and mostly oriented towards the preprocessing of the recordings and the source estimation using minimum norm technique, but written in C++ and compiled for Linux and MacOSX platforms.
Brainstorm, in contrast, is an integrated application rather than a toolbox. At the present time, it offers fewer features than FieldTrip; but on the other hand, its intuitive interface, its powerful visualization tools, and the structure of its database allow the user to work at a higher level. It is possible to complete in a few minutes, and within a few mouse clicks, what would take hours otherwise: there is no need to write any scripts, and no need to think about where data files are stored on hard drives; the data is directly accessible, and a simple mouse click is sufficient to open a wide variety of display windows. It enables the researcher to concentrate on exploring his or her data. When visual exploration is complete and group analysis needs to be performed, Brainstorm offers a very high level scripting system, based on the interface and the database. The resulting code is easy to understand, and with few arguments: all the contextual information is gathered automatically from the database when needed, in contrast to FieldTrip, for example, where this information has to be specifically passed in arguments to each function.
To conclude, Brainstorm now represents a potentially highly-productive option for researchers using MEG or EEG; however, it is a work in progress and some key features are still missing. In the spirit of other open source developments, to the extent possible, we will reuse functions developed by other groups, which will then jointly maintain. Similarly, other developers are welcome to use code from Brainstorm in their software.
This software was generated primarily with support from the National Institutes of Health under Grants nos. R01-EB002010, R01-EB009048, and R01-EB000473. Primary support also includes permanent site support from the Centre National de la Recherche Scientifique (CNRS, France) for the Cognitive Neuroscience and Brain Imaging Laboratory (La Salpêtrière Hospital and Pierre and Marie Curie University, Paris, France). Additional support was provided by two grants from the French National Research Agency (ANR) to the Cognitive Neuroscience Unit (Inserm/CEA, Neurospin, France) and to the ViMAGINE project (ANR-08-BLAN-0250), and by the Epilepsy Center in the Cleveland Clinic Neurological Institute. The authors are grateful to all the people who contributed to the conception, the development, or the validation of specific Brainstorm functionalities. In alphabetical order: Charles Aissani, Syed Ashrafulla, Elizabeth Bock, Lucie Charles, Felix Darvas, Ghislaine Dehaene-Lambertz, Claude Delpuech, Belma Dogdas, Antoine Ducorps, Guillaume Dumas, John Ermer, Line Garnero, Alexandre Gramfort, Matti Hämäläinen, Louis Hovasse, Esen Kucukaltun-Yildirim, Etienne Labyt, Karim N'Diaye, Alexei Ossadtchi, Rey Ramirez, Denis Schwartz, Darren Weber, and Lydia Yahia-Cherif. The software, extensive documentation, tutorial data, user forum, and reference publications are available at