Skip to main content

Inverse Library (INVLIB)

The Inverse library provides source localization algorithms for MEG/EEG data. All classes reside in the INVLIB namespace.

Algorithm Inventory

Minimum Norm Estimation

ClassDescriptionMNE-PythonMNE-C
InvMinimumNormMNE, dSPM, sLORETA, and eLORETA inverse methodsmne.minimum_norm.apply_inversemne_inverse_operator + mne_compute_mne

Supports all four noise-normalization strategies:

MethodDescription
MNEL2-regularized minimum-norm estimate
dSPMDynamic Statistical Parametric Mapping — noise-normalized MNE
sLORETAStandardized Low-Resolution Electromagnetic Tomography
eLORETAExact LORETA — iterative weight-normalized MNE for zero localization bias

Beamformers

ClassDescriptionMNE-PythonMNE-C
InvLCMVLinearly Constrained Minimum Variance beamformer (time domain)mne.beamformer.make_lcmv / apply_lcmv
InvDICSDynamic Imaging of Coherent Sources (frequency domain)mne.beamformer.make_dics / apply_dics
InvBeamformerComputed spatial filter container
InvBeamformerComputeShared computation routines (data covariance → spatial filter)

RAP MUSIC

ClassDescriptionMNE-PythonMNE-C
InvRapMusicRecursively Applied and Projected Multiple Signal Classificationmne.beamformer.rap_music
InvPwlRapMusicPowell-accelerated RAP MUSIC with gradient-free dipole optimization
InvDipoleSingle dipole result (position, orientation, correlation)

Contextual Minimum Norm Estimates (CMNE)

ClassDescriptionMNE-PythonMNE-C
InvCMNECMNE inverse: dSPM base estimate refined by LSTM network (ONNX Runtime)
InvCMNESettingsConfiguration for CMNE: ONNX model path, sequence length, LSTM parameters

Combines classical dSPM with a trained LSTM neural network to incorporate temporal context. At inference time, InvCMNE::compute() runs dSPM to obtain a base source estimate, then applies the ONNX-exported LSTM model sample-by-sample to produce a spatiotemporally refined CMNE result. Falls back to moving-average smoothing if no ONNX model is available.

Reference: Dinh et al. (2021). Contextual Minimum-Norm Estimates (CMNE): A Deep Learning Method for Source Estimation in Neuronal Networks. Frontiers in Neuroscience, 15, 552666. DOI: 10.3389/fnins.2021.552666

Sparse Methods

ClassDescriptionMNE-PythonMNE-C
InvMxneMixed-Norm Estimate (MxNE) — L21-norm sparse inverse via IRLSmne.inverse_sparse.mixed_norm
InvMxneResultResult container: sparse source estimate, active vertices, iteration count, residual
InvGammaMapGamma-MAP sparse Bayesian learning inverse via EMmne.inverse_sparse.gamma_map
InvGammaMapResultResult container: sparse source estimate, active vertices, gamma hyperparameters

MxNE minimizes a group-lasso (2,1\ell_{2,1}-norm) cost function using iteratively reweighted least squares with active-set pruning. Gamma-MAP uses an EM algorithm to estimate per-source variance hyperparameters, pruning sources below a configurable threshold.

Dipole Fitting

ClassDescriptionMNE-PythonMNE-C
InvDipoleFitHigh-level driver for sequential ECD fittingmne.fit_dipolemne_dipole_fit
InvDipoleFitDataWorkspace: sensor geometry, forward model, noise covariance, fit routineslibmne internals
InvDipoleFitSettingsCommand-line and programmatic settingsmne_dipole_fit options
InvDipoleForwardForward field matrices and SVD for magnetic dipole fittinglibfwd
InvGuessDataPrecomputed guess-point grid with forward fieldslibmne
InvEcdSingle equivalent current dipole (position, orientation, amplitude, GOF)mne.Dipole
InvEcdSetCollection of fitted dipolesmne.DipoleFixed

HPI Fitting

ClassDescriptionMNE-PythonMNE-C
InvHpiFitHPI coil dipole fitting for head position trackingmne.chpi.compute_head_pos
InvHpiDataUpdaterPreprocesses raw HPI data (SSP, compensation, model fitting)mne.chpi.compute_chpi_amplitudes
InvHpiModelParametersConfiguration for HPI signal model (line freq, coil freqs, sample rate)
InvSignalModelForward sinusoidal model matrix for HPI coil signals
InvSensorSetMEG sensor geometry container for HPI

Result Types

Class / EnumDescription
InvSourceEstimateSource estimate container (vertices × time, with time metadata)
InvSourceEstimateTokenTokenization / de-tokenization for foundation-model interfacing
InvFocalDipoleFocal dipole with free 3D position, moment, and fit-quality metrics
InvSourceCouplingCorrelated grid sources with orientations and correlation matrix
InvConnectivityPairwise source connectivity matrix
InvEstimateMethodEnum: MNE, dSPM, sLORETA, eLORETA, CMNE, LCMV, DICS, SAM, MxNE, GammaMAP, DipoleFit, RapMusic, PwlRapMusic

Doxygen Reference

For method signatures, inheritance diagrams, and source-level documentation see the auto-generated INVLIB namespace in the Doxygen API reference.

See Also