Work/Open-source software

MNE-CPP

An open-source C++ framework for real-time and offline processing of magnetoencephalography, electroencephalography and related electrophysiological data. I started the project during my doctorate and co-lead its development. It is collaborative research software, written by more than forty contributors.

My role
Initiator and co-lead. Original architecture and real-time source estimation, 2010 to 2017; the version 2 releases, 2026.
Period
Since 2010; public repository since August 2012
Technology
C++17, Qt 6, Eigen; Windows, macOS, Linux and WebAssembly
Licence
BSD 3-Clause
Cite as
doi:10.5281/zenodo.593102 (opens in a new tab)
Examine
Screenshot of MNE Inspect with three 3D views of a head and brain: two with a source estimate drawn on the cortex inside a transparent head, one with the cortex coloured by atlas region.
Fig. 1MNE Inspect showing a source estimate of the MNE sample dataset on the pial surface, with head and skull surfaces, and a cortical parcellation (lower left). Screenshot from the MNE-CPP documentation.

Problem

Analysis packages for MEG and EEG are mostly written in Python or MATLAB and built for work after the recording. Acquisition software comes from the device manufacturers and is closed. Real-time applications such as neurofeedback, brain–computer interfaces and the monitoring of a clinical measurement need both in one place: access to the device, low and predictable latency, and the complete chain from raw signal to source estimate.

MNE-CPP provides the methods of the MNE software family as C++ libraries with few dependencies, so that they can be embedded close to the instrument, and builds applications for acquisition, analysis and visualisation on top of them.

Components

The libraries cover file input and output in the FIFF format, forward modelling with boundary-element models, inverse estimation (minimum-norm estimates, dSPM, sLORETA, beamformers, RAP-MUSIC, dipole fitting), signal processing, connectivity and 3D display. Four applications are built on them:

MNE Scan
Acquisition and real-time processing. Plug-ins connect to MEG and EEG devices and data streams, among them MEGIN and BabyMEG systems, BrainAmp, eego, g.USBamp, TMSi and Natus amplifiers, Lab Streaming Layer and the FieldTrip buffer, and form a processing pipeline that runs on the incoming data.
MNE Analyze
Sensor- and source-level analysis: browsing, filtering, averaging, co-registration, dipole fitting and source localisation.
MNE Browse
Browsing of raw recordings with filtering, event detection, averaging, independent component analysis and covariance estimation.
MNE Inspect
3D visualisation of cortical surfaces, source estimates and forward models; since version 2.3 also depth and surface electrodes and MRI slices in the same scene.

In the browser

Two of the applications are also compiled to WebAssembly and run without installation. Files opened in them are processed locally and are not uploaded.

Use

MNE Scan was developed alongside the BabyMEG, a 375-channel whole-head MEG system for infants and young children at Boston Children’s Hospital, and served there as acquisition and real-time analysis software. The paper describing it reports three use cases: a clinical epilepsy study, real-time source estimation and a brain–computer interface.

Development was supported by the US National Institutes of Health (R01 EB009048; U01 EB023820, “Device-independent acquisition and real time spatiotemporal analysis of clinical electrophysiology data”, 2017 to 2022) and the German Research Foundation (Ba 4858/1-1). The U01 project was based on MNE-CPP, and I supported its application; the principal investigators were Matti Hämäläinen, Yoshio Okada and John Mosher.

Version 2

Between March and June 2026 the project published four releases that modernise the code base and extend it beyond MEG and EEG to intracranial recordings.

  • 2.0
    March 2026

    Move to Qt 6. The 3D rendering was rewritten on Qt’s rendering hardware interface, which targets Metal, Vulkan, Direct3D and OpenGL. The command-line tools of the original MNE-C package were ported to C++. MNE Scan and MNE Analyze were released as stand-alone applications in version 1.0.

  • 2.1
    April 2026

    A reworked MNE Browse, a library for reading and writing datasets in the BIDS layout, and beamformers in the inverse library.

  • 2.2
    April 2026

    Processing pipelines stored as analysis graphs in an open file format; contextual minimum-norm estimates in the inverse library; further connectivity measures and cluster-based permutation statistics.

  • 2.3
    June 2026

    MNE Inspect shows stereo-EEG depth electrodes, ECoG grids, MRI slices and cortical surfaces with source estimates in one scene. MNE Scan can apply contextual estimates in real time from ONNX model files. A guided application for co-registering head, sensors and MRI.

Summarised from the project’s changelog (opens in a new tab), which lists every change.

Attribution

My own contributions fall into two periods. From 2010 to 2017 I designed the original architecture, wrote much of the library and acquisition code, and developed the real-time source estimation methods. In 2026 I returned to active development and wrote a large part of the version 2 releases.

In the years between, the project was led and developed by Lorenz Esch, Gabriel Motta, Juan García-Prieto, Ruben Dörfel and others; much of what MNE Scan and MNE Analyze are today is their work. The scientific direction has been shaped throughout by Matti Hämäläinen, Jens Haueisen, Daniel Baumgarten, Yoshio Okada and John Mosher. The full list of authors is part of the citation file (opens in a new tab) in the repository.

Screenshot of MNE Analyze: a settings panel on the left and a signal viewer with about twenty MEG channel traces on the right.
Fig. 2MNE Analyze displaying raw MEG channels of the MNE sample dataset. Screenshot from the MNE-CPP documentation.

Publications

2016

Okada Y, Hämäläinen M, Pratt K, Mascarenas A, Miller P, Han M, Robles J, Cavallini A, Power B, Sieng K, Sun L, Lew S, Doshi C, Ahtam B, Dinh C, Esch L, Grant E, Nummenmaa A, Paulson D. BabyMEG: A whole-head pediatric magnetoencephalography system for human brain development research. Review of Scientific Instruments 2016;87(9):094301.