MNE-CPP Library API
MNE-CPP provides a modular set of cross-platform C++ libraries built on Qt and Eigen. All MNE-CPP applications — MNE Scan, MNE Analyze, MNE Anonymize, and the command-line tools — are built solely on these libraries, so any functionality available in an application can also be used programmatically.
The libraries are organized in layers: low-level I/O and math utilities at the bottom, domain-specific processing in the middle, and visualization at the top.
Library Overview
Core Libraries
| Library | Namespace | Purpose |
|---|---|---|
| Utils | UTILSLIB | Shared utilities: I/O helpers, spectral analysis, layout management, and warp algorithms |
| Math | MATHLIB | Mathematical algorithms and geometry: linear algebra, optimization, spectral estimation, K-Means, sphere fitting |
| Fs | FSLIB | FreeSurfer surface and annotation I/O |
| Fiff | FIFFLIB | FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward) |
| Mne | MNELIB | Core MNE data structures: source spaces, source estimates, hemispheres |
| Mri | MRILIB | MRI volume and coordinate-system I/O (volumes, voxel geometry, transforms) |
| Bids | BIDSLIB | BIDS dataset reading, writing, path construction, and sidecar metadata handling for iEEG/EEG/MEG |
Processing Libraries
| Library | Namespace | Purpose |
|---|---|---|
| Fwd | FWDLIB | Forward modelling: BEM and MEG/EEG lead field computation |
| Inv | INVLIB | Inverse source estimation: MNE, dSPM, sLORETA, beamforming, dipole fitting, HPI fitting, RAP-MUSIC |
| Dsp | DSPLIB | Digital signal processing: filtering, spectrograms, real-time averaging, trigger detection, SPHARA, HPI, noise reduction |
| Conn | CONNLIB | Functional connectivity metrics: Coherence, Cross-Correlation, PLV, PLI, WPLI, and variants |
| Lsl | LSLLIB | Lab Streaming Layer (LSL) integration for real-time data exchange |
| Com | COMLIB | Real-time client/server communication (commands, raw data streaming) with mne_rt_server |
Visualization Libraries
| Library | Namespace | Purpose |
|---|---|---|
| Disp | DISPLIB | 2D display widgets and visualization helpers: charts, topography, colour maps, QWidget-based viewers |
| Disp3D | DISP3DLIB | 3D brain visualization using the Qt RHI rendering backend: cortical surfaces, connectivity networks, BEM models, source estimates, digitizers — supports Metal, Vulkan, D3D, and OpenGL backends |
For in-depth guides on specific libraries, see the Conn and Disp3D pages.
API Reference (Doxygen)
The full auto-generated API documentation is available at the API Reference. Use these entry points to navigate:
| Section | Description |
|---|---|
| Namespace List | All namespaces with brief descriptions — one per library |
| Class List | Alphabetical list of all classes, structs, and unions |
| Class Index | Compact alphabetical class index for quick lookup |
| Class Hierarchy | Inheritance tree showing parent-child relationships |
| Class Members | Index of all documented class members |
| Namespace Members | All symbols declared at namespace scope |
| File List | Source and header files with directory structure |