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 | Math routines (MNEMath), spectral analysis (FFT, CSD, PSD), spectrogram, TPS surface warping, sphere fitting, simplex solver, K-Means clustering, I/O helpers, CircularBuffer, application logger |
| Fs | FSLIB | Load and save FreeSurfer surfaces and annotations |
| Fiff | FIFFLIB | Read and write FIFF (Functional Imaging File Format) files |
| Mne | MNELIB | Core data structures matching MNE-C: ForwardSolution, InverseOperator, SourceEstimate, SourceSpace, BemSurface, EpochData, and more |
Processing Libraries
| Library | Namespace | Purpose |
|---|---|---|
| Fwd | FWDLIB | Forward solution computation from FreeSurfer reconstructions for MEG/EEG source localization |
| Inverse | INVERSELIB | Source localization: MNE estimation, single dipole fitting, HPI coil fitting, RAP-MUSIC (with optional GPU/CUDA) |
| RtProcessing | RTPROCESSINGLIB | Real-time processing: averaging, filtering, ICP, trigger detection, SPHARA; asynchronous workers for connectivity, HPI fitting, inverse computation, and noise estimation |
| Connectivity | CONNECTIVITYLIB | Functional connectivity metrics (Correlation, Cross-Correlation, Coherence, Imaginary Coherence, PLV, PLI, WPLI, and variants) with network storage, graph measures, and thresholding |
| Communication | COMMUNICATIONLIB | Client/command interface for communicating with mne_rt_server |
Visualization Libraries
| Library | Namespace | Purpose |
|---|---|---|
| Disp | DISPLIB | 2D plot types (bar, graph, imagesc, lineplot, spline, tfplot) and ready-to-use QWidget-based viewers with GUI controls |
| Disp3D (RHI) | DISP3DRHILIB | RHI-based 3D visualization: cortical surfaces, connectivity networks, digitizers, BEM models, source estimates, dipoles — supports Metal, Vulkan, D3D, and OpenGL backends |
For in-depth guides on specific libraries, see the Connectivity and Disp3D (RHI) 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 |