Skip to main content

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

LibraryNamespacePurpose
UtilsUTILSLIBShared utilities: I/O helpers, spectral analysis, layout management, and warp algorithms
MathMATHLIBMathematical algorithms and geometry: linear algebra, optimization, spectral estimation, K-Means, sphere fitting
FsFSLIBFreeSurfer surface and annotation I/O
FiffFIFFLIBFIFF file I/O and data structures (raw, epochs, evoked, covariance, forward)
MneMNELIBCore MNE data structures: source spaces, source estimates, hemispheres
MriMRILIBMRI volume and coordinate-system I/O (volumes, voxel geometry, transforms)
BidsBIDSLIBBIDS dataset reading, writing, path construction, and sidecar metadata handling for iEEG/EEG/MEG

Processing Libraries

LibraryNamespacePurpose
FwdFWDLIBForward modelling: BEM and MEG/EEG lead field computation
InvINVLIBInverse source estimation: MNE, dSPM, sLORETA, beamforming, dipole fitting, HPI fitting, RAP-MUSIC
DspDSPLIBDigital signal processing: filtering, spectrograms, real-time averaging, trigger detection, SPHARA, HPI, noise reduction
ConnCONNLIBFunctional connectivity metrics: Coherence, Cross-Correlation, PLV, PLI, WPLI, and variants
LslLSLLIBLab Streaming Layer (LSL) integration for real-time data exchange
ComCOMLIBReal-time client/server communication (commands, raw data streaming) with mne_rt_server

Visualization Libraries

LibraryNamespacePurpose
DispDISPLIB2D display widgets and visualization helpers: charts, topography, colour maps, QWidget-based viewers
Disp3DDISP3DLIB3D 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:

SectionDescription
Namespace ListAll namespaces with brief descriptions — one per library
Class ListAlphabetical list of all classes, structs, and unions
Class IndexCompact alphabetical class index for quick lookup
Class HierarchyInheritance tree showing parent-child relationships
Class MembersIndex of all documented class members
Namespace MembersAll symbols declared at namespace scope
File ListSource and header files with directory structure