---
title: Library API
sidebar_label: Library API
---

# MNE-CPP Library API

MNE-CPP provides a modular set of cross-platform C++ libraries built on [Qt](https://www.qt.io/) and [Eigen](http://eigen.tuxfamily.org/). 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](api-connectivity.mdx) and [Disp3D (RHI)](api-disp3d.mdx) pages.

## API Reference (Doxygen)

The full auto-generated API documentation is available at the [API Reference](https://mne-cpp.github.io/doxygen-api/). Use these entry points to navigate:

| Section | Description |
|---|---|
| [Namespace List](https://mne-cpp.github.io/doxygen-api/namespaces.html) | All namespaces with brief descriptions — one per library |
| [Class List](https://mne-cpp.github.io/doxygen-api/annotated.html) | Alphabetical list of all classes, structs, and unions |
| [Class Index](https://mne-cpp.github.io/doxygen-api/classes.html) | Compact alphabetical class index for quick lookup |
| [Class Hierarchy](https://mne-cpp.github.io/doxygen-api/hierarchy.html) | Inheritance tree showing parent-child relationships |
| [Class Members](https://mne-cpp.github.io/doxygen-api/functions.html) | Index of all documented class members |
| [Namespace Members](https://mne-cpp.github.io/doxygen-api/namespacemembers.html) | All symbols declared at namespace scope |
| [File List](https://mne-cpp.github.io/doxygen-api/files.html) | Source and header files with directory structure |
