Skip to main content

Inverse Methods

This section describes the mathematical details of all inverse source estimation methods available in MNE-CPP: minimum-norm estimates (MNE, dSPM, sLORETA, eLORETA), beamformers (LCMV, DICS), RAP MUSIC, and dipole fitting.

Minimum-Norm Estimates

In the Bayesian sense, the ensuing current distribution is the maximum a posteriori (MAP) estimate under the following assumptions:

  • The viable locations of the currents are constrained to the cortex. Optionally, the current orientations can be fixed to be normal to the cortical mantle.
  • The amplitudes of the currents have a Gaussian prior distribution with a known source covariance matrix.
  • The measured data contain additive noise with a Gaussian distribution with a known covariance matrix. The noise is not correlated over time.

The Linear Inverse Operator

The measured data in the source estimation procedure consists of MEG and EEG data, recorded on a total of NN channels. The task is to estimate a total of QQ strengths of sources located on the cortical mantle. If the number of source locations is PP, Q=PQ = P for fixed-orientation sources and Q=3PQ = 3P if the source orientations are unconstrained.

The regularized linear inverse operator following from regularized maximal likelihood of the above probabilistic model is given by the Q×NQ \times N matrix:

M=RG(GRG+C)1M = R' G^\top (G R' G^\top + C)^{-1}

where GG is the gain matrix relating the source strengths to the measured MEG/EEG data, CC is the data noise-covariance matrix and RR' is the source covariance matrix. The dimensions of these matrices are N×QN \times Q, N×NN \times N, and Q×QQ \times Q, respectively.

The expected value of the current amplitudes at time tt is then given by j^(t)=Mx(t)\hat{j}(t) = Mx(t), where x(t)x(t) is a vector containing the measured MEG and EEG data values at time tt.

Regularization

The a priori variance of the currents is, in practice, unknown. We can express this by writing R=R/λ2R' = R / \lambda^2, which yields the inverse operator:

M=RG(GRG+λ2C)1M = R G^\top (G R G^\top + \lambda^2 C)^{-1}

where the unknown current amplitude is now interpreted in terms of the regularization parameter λ2\lambda^2. Larger λ2\lambda^2 values correspond to spatially smoother and weaker current amplitudes, whereas smaller λ2\lambda^2 values lead to the opposite.

We can arrive at the regularized linear inverse operator also by minimizing a cost function SS with respect to the estimated current j^\hat{j} (given the measurement vector xx at any given time tt) as:

minj^{S}=minj^{e~e~+λ2j^R1j^}=minj^{(xGj^)C1(xGj^)+λ2j^R1j^}\min_{\hat{j}} \left\{ S \right\} = \min_{\hat{j}} \left\{ \tilde{e}^\top \tilde{e} + \lambda^2 \hat{j}^\top R^{-1} \hat{j} \right\} = \min_{\hat{j}} \left\{ (x - G\hat{j})^\top C^{-1} (x - G\hat{j}) + \lambda^2 \hat{j}^\top R^{-1} \hat{j} \right\}

where the first term consists of the difference between the whitened measured data and those predicted by the model, while the second term is a weighted-norm of the current estimate. With increasing λ2\lambda^2, the source term receives more weight and larger discrepancy between the measured and predicted data is tolerable.

Whitening and Scaling

The MNE software employs data whitening so that a "whitened" inverse operator assumes the form:

M~=MC1/2=RG~(G~RG~+λ2I)1\tilde{M} = M C^{1/2} = R \tilde{G}^\top (\tilde{G} R \tilde{G}^\top + \lambda^2 I)^{-1}

where

G~=C1/2G\tilde{G} = C^{-1/2} G

is the spatially whitened gain matrix.

The expected current values are:

j^(t)=Mx(t)=M~x~(t)\hat{j}(t) = Mx(t) = \tilde{M} \tilde{x}(t)

where x~(t)=C1/2x(t)\tilde{x}(t) = C^{-1/2} x(t) is the whitened measurement vector at time tt.

The spatial whitening operator C1/2C^{-1/2} is obtained with the help of the eigenvalue decomposition C=UCΛC2UCC = U_C \Lambda_C^2 U_C^\top as C1/2=ΛC1UCC^{-1/2} = \Lambda_C^{-1} U_C^\top.

In the MNE software the noise-covariance matrix is stored as the one applying to raw data. To reflect the decrease of noise due to averaging, this matrix, C0C_0, is scaled by the number of averages, LL, i.e., C=C0/LC = C_0 / L.

note

When EEG data are included, the gain matrix GG needs to be average referenced when computing the linear inverse operator MM. This is incorporated during creation of the spatial whitening operator C1/2C^{-1/2}, which includes any projectors on the data. EEG data average reference (using a projector) is mandatory for source modeling.

A convenient choice for the source-covariance matrix RR is such that trace(G~RG~)/trace(I)=1\text{trace}(\tilde{G} R \tilde{G}^\top) / \text{trace}(I) = 1. With this choice we can approximate λ21/SNR2\lambda^2 \sim 1/\text{SNR}^2, where SNR is the (amplitude) signal-to-noise ratio of the whitened data.

note

The definition of the signal-to-noise ratio / λ2\lambda^2 relationship given above works nicely for the whitened forward solution. In the un-whitened case scaling with the trace ratio trace(GRG)/trace(C)\text{trace}(GRG^\top) / \text{trace}(C) does not make sense, since the diagonal elements summed have, in general, different units of measure. For example, the MEG data are expressed in T or T/m whereas the unit of EEG is Volts.

Regularization of the Noise-Covariance Matrix

Since a finite amount of data is usually available to compute an estimate of the noise-covariance matrix CC, the smallest eigenvalues of its estimate are usually inaccurate and smaller than the true eigenvalues. Depending on the seriousness of this problem, the following quantities can be affected:

  • The model data predicted by the current estimate
  • Estimates of signal-to-noise ratios, which lead to estimates of the required regularization
  • The estimated current values
  • The noise-normalized estimates

Fortunately, the latter two are least likely to be affected due to regularization of the estimates. However, in some cases especially the EEG part of the noise-covariance matrix estimate can be deficient, i.e., it may possess very small eigenvalues and thus regularization of the noise-covariance matrix is advisable.

Historically, the MNE software accomplishes the regularization by replacing a noise-covariance matrix estimate CC with:

C=C+kεkσˉk2I(k)C' = C + \sum_k \varepsilon_k \bar{\sigma}_k^2 I^{(k)}

where the index kk goes across the different channel groups (MEG planar gradiometers, MEG axial gradiometers and magnetometers, and EEG), εk\varepsilon_k are the corresponding regularization factors, σˉk\bar{\sigma}_k are the average variances across the channel groups, and I(k)I^{(k)} are diagonal matrices containing ones at the positions corresponding to the channels contained in each channel group.

Computation of the Solution

The most straightforward approach to calculate the MNE is to employ the expression of the original or whitened inverse operator directly. However, for computational convenience we prefer to take another route, which employs the singular-value decomposition (SVD) of the matrix:

A=G~R1/2=UΛVA = \tilde{G} R^{1/2} = U \Lambda V^\top

where the superscript 1/2^{1/2} indicates a square root of RR.

Combining the SVD with the inverse equation, it is easy to show that:

M~=R1/2VΓU\tilde{M} = R^{1/2} V \Gamma U^\top

where the elements of the diagonal matrix Γ\Gamma are:

γk=λkλk2+λ2\gamma_k = \frac{\lambda_k}{\lambda_k^2 + \lambda^2}

If we define w(t)=Ux~(t)=UC1/2x(t)w(t) = U^\top \tilde{x}(t) = U^\top C^{-1/2} x(t), then the expected current is:

j^(t)=R1/2VΓw(t)=kvˉkγkwk(t)\hat{j}(t) = R^{1/2} V \Gamma w(t) = \sum_k \bar{v}_k \gamma_k w_k(t)

where vˉk=R1/2vk\bar{v}_k = R^{1/2} v_k, with vkv_k being the kk-th column of VV. The current estimate is thus a weighted sum of the "weighted" eigenleads vkv_k.

Noise Normalization

Noise normalization serves three purposes:

  1. It converts the expected current value into a dimensionless statistical test variable. Thus the resulting time and location dependent values are often referred to as dynamic statistical parameter maps (dSPM).

  2. It reduces the location bias of the estimates. In particular, the tendency of the MNE to prefer superficial currents is eliminated.

  3. The width of the point-spread function becomes less dependent on the source location on the cortical mantle.

In practice, noise normalization is implemented as a division by the square root of the estimated variance of each voxel. Using our "weighted eigenleads" definition in matrix form as Vˉ=R1/2V\bar{V} = R^{1/2} V:

dSPM

Noise-normalized linear estimates introduced by Dale et al. (1999) require division of the expected current amplitude by its variance. The variance computation uses:

MCM=M~M~=VˉΓ2VˉM C M^\top = \tilde{M} \tilde{M}^\top = \bar{V} \Gamma^2 \bar{V}^\top

The variances for each source are thus:

σk2=γk2\sigma_k^2 = \gamma_k^2

Under the standard conditions, the tt-statistic values associated with fixed-orientation sources are proportional to L\sqrt{L} while the FF-statistic employed with free-orientation sources is proportional to LL.

note

The MNE software usually computes the square roots of the F-statistic to be displayed on the inflated cortical surfaces. These are also proportional to L\sqrt{L}.

sLORETA

sLORETA (Pascual-Marqui, 2002) estimates the current variances as the diagonal entries of the resolution matrix, which is the product of the inverse and forward operators:

MG=VˉΓΛVˉR1MG = \bar{V} \Gamma \Lambda \bar{V}^\top R^{-1}

Because RR is diagonal and we only care about the diagonal entries, the variance estimates are:

σk2=γk2(1+λk2λ2)\sigma_k^2 = \gamma_k^2 \left(1 + \frac{\lambda_k^2}{\lambda^2}\right)

eLORETA

While dSPM and sLORETA solve for noise normalization weights σk2\sigma_k^2 that are applied to standard minimum-norm estimates j^(t)\hat{j}(t), eLORETA (Pascual-Marqui, 2011) instead solves for a source covariance matrix RR that achieves zero localization bias. For fixed-orientation solutions the resulting matrix RR will be a diagonal matrix, and for free-orientation solutions it will be a block-diagonal matrix with 3×33 \times 3 blocks.

The following system of equations is used to find the weights, i{1,,P}\forall i \in \{1, \ldots, P\}:

ri=[Gi(GRG+λ2C)1Gi]1/2r_i = \left[ G_i^\top \left( GRG^\top + \lambda^2 C \right)^{-1} G_i \right]^{-1/2}

An iterative algorithm finds the values for the weights rir_i that satisfy these equations:

  1. Initialize identity weights.
  2. Compute N=(GRG+λ2C)1N = \left( GRG^\top + \lambda^2 C \right)^{-1}.
  3. Holding NN fixed, compute new weights ri=[GiNGi]1/2r_i = \left[ G_i^\top N G_i \right]^{-1/2}.
  4. Using new weights, go to step (2) until convergence.

Using the whitened substitution G~=C1/2G\tilde{G} = C^{-1/2} G, the computations can be performed entirely in the whitened space, avoiding the need to compute NN directly:

ri=[G~iN~G~i]1/2r_i = \left[ \tilde{G}_i^\top \tilde{N} \tilde{G}_i \right]^{-1/2}

Predicted Data

Under noiseless conditions the SNR is infinite and thus leads to λ2=0\lambda^2 = 0 and the minimum-norm estimate explains the measured data perfectly. Under realistic conditions, however, λ2>0\lambda^2 > 0 and there is a misfit between measured data and those predicted by the MNE. Comparison of the predicted data x^(t)\hat{x}(t) and measured data can give valuable insight on the correctness of the regularization applied.

In the SVD approach:

x^(t)=Gj^(t)=C1/2UΠw(t)\hat{x}(t) = G\hat{j}(t) = C^{1/2} U \Pi w(t)

where the diagonal matrix Π\Pi has elements πk=λkγk\pi_k = \lambda_k \gamma_k. The predicted data is thus expressed as the weighted sum of the "recolored eigenfields" in C1/2UC^{1/2} U.

Cortical Patch Statistics

If source space distance information was used during source space creation, the source space file will contain Cortical Patch Statistics (CPS) for each vertex of the cortical surface. The CPS provide information about the source space point closest to each vertex as well as the distance from the vertex to this source space point.

Once these data are available, the following cortical patch statistics can be computed for each source location dd:

  • The average over the normals at the vertices in a patch, nˉd\bar{n}_d
  • The areas of the patches, AdA_d
  • The average deviation of the vertex normals in a patch from their average, σd\sigma_d, given in degrees

Orientation Constraints

The principal sources of MEG and EEG signals are generally believed to be postsynaptic currents in the cortical pyramidal neurons. Since the net primary current associated with these microscopic events is oriented normal to the cortical mantle, it is reasonable to use the cortical normal orientation as a constraint in source estimation.

In addition to allowing completely free source orientations, the MNE software implements three orientation constraints based on the surface normal data:

  • Fixed orientation: Source orientation is rigidly fixed to the surface normal direction. If cortical patch statistics are available, the average normal over each patch nˉd\bar{n}_d is used. Otherwise, the vertex normal at the source space location is employed.

  • Fixed Loose Orientation Constraint (fLOC): A source coordinate system based on the local surface orientation at the source location is employed. The first two source components lie in the plane normal to the surface normal, and the third component is aligned with it. The variance of the tangential components is reduced by a configurable factor.

  • Variable Loose Orientation Constraint (vLOC): Similar to fLOC except that the loose factor is multiplied by σd\sigma_d (the angular deviation of normals within the patch).

Depth Weighting

The minimum-norm estimates have a bias towards superficial currents. This tendency can be alleviated by adjusting the source covariance matrix RR to favor deeper source locations. In the depth weighting scheme, the elements of RR corresponding to the pp-th source location are scaled by a factor:

fp=(g1pg1p+g2pg2p+g3pg3p)γf_p = (g_{1p}^\top g_{1p} + g_{2p}^\top g_{2p} + g_{3p}^\top g_{3p})^{-\gamma}

where g1pg_{1p}, g2pg_{2p}, and g3pg_{3p} are the three columns of GG corresponding to source location pp and γ\gamma is the order of the depth weighting.

Effective Number of Averages

It is often the case that the epoch to be analyzed is a linear combination over conditions rather than one of the original averages computed. The noise-covariance matrix computed is originally one corresponding to raw data. Therefore, it has to be scaled correctly to correspond to the actual or effective number of epochs in the condition to be analyzed. In general:

C=C0/LeffC = C_0 / L_{\text{eff}}

where LeffL_{\text{eff}} is the effective number of averages. To calculate LeffL_{\text{eff}} for an arbitrary linear combination of conditions y(t)=i=1nwixi(t)y(t) = \sum_{i=1}^{n} w_i x_i(t):

1/Leff=i=1nwi2/Li1 / L_{\text{eff}} = \sum_{i=1}^{n} w_i^2 / L_i

For a weighted average, where wi=Li/i=1nLiw_i = L_i / \sum_{i=1}^n L_i:

Leff=i=1nLiL_{\text{eff}} = \sum_{i=1}^{n} L_i

For a difference of two categories (w1=1w_1 = 1, w2=1w_2 = -1):

Leff=L1L2L1+L2L_{\text{eff}} = \frac{L_1 L_2}{L_1 + L_2}

Generalizing, for any combination of sums and differences where wi=±1w_i = \pm 1:

1/Leff=i=1n1/Li1 / L_{\text{eff}} = \sum_{i=1}^{n} 1/L_i

Beamformer Methods

Beamformers are a family of adaptive spatial filters that estimate the source activity at a given brain location while suppressing contributions from other locations and noise. Unlike minimum-norm methods, beamformers do not require an explicit regularized inverse operator — instead, they construct a spatial filter from the data covariance and the forward model at each source point.

LCMV Beamformer

The Linearly Constrained Minimum Variance (LCMV) beamformer (Van Veen et al., 1997) operates in the time domain. It finds a spatial filter WW that passes the signal from a target source location with unit gain while minimizing the total output power (i.e., suppressing all other sources and noise).

Spatial Filter

The optimization problem is:

minW  tr(WCmW)subject toWG=I\min_{W} \; \operatorname{tr}(W C_m W^\top) \quad \text{subject to} \quad W G = I

where GG is the lead-field matrix (gain matrix) at the source location (N×norientN \times n_{\text{orient}}, with norient=1n_{\text{orient}} = 1 for fixed orientation or 33 for free orientation) and CmC_m is the N×NN \times N data covariance matrix.

The closed-form solution is the unit-gain filter:

Wug=(GCm1G)1GCm1W_{\text{ug}} = (G^\top C_m^{-1} G)^{-1} \, G^\top C_m^{-1}

Regularization

Since the data covariance matrix may be rank-deficient (e.g., after SSP or MaxFilter), Tikhonov regularization is applied (Gross & Ioannides, 1999):

Cm,reg=Cm+αtr(Cm)rank(Cm)IC_{m,\text{reg}} = C_m + \alpha \cdot \frac{\operatorname{tr}(C_m)}{\operatorname{rank}(C_m)} \cdot I

where α\alpha is the regularization parameter (typically 0.05). In practice this is implemented via eigendecomposition:

Cm1=Vdiag ⁣(1λi+αload)VC_m^{-1} = V \operatorname{diag}\!\left(\frac{1}{\lambda_i + \alpha_{\text{load}}}\right) V^\top

Weight Normalization

The raw unit-gain filter can produce estimates with non-uniform sensitivity across the source space. Several normalization schemes address this:

Unit-noise-gain (Sekihara & Nagarajan, 2008):

Wung=Wugdiag(WugWug)W_{\text{ung}} = \frac{W_{\text{ug}}}{\sqrt{\operatorname{diag}(W_{\text{ug}} W_{\text{ug}}^\top)}}

Unit-noise-gain-invariant (rotation-invariant form):

W=(AA)1/2A,A=GCm1W = (A A^\top)^{-1/2} A, \quad A = G^\top C_m^{-1}

Neural Activity Index (NAI):

WNAI=Wungσnoise2W_{\text{NAI}} = \frac{W_{\text{ung}}}{\sqrt{\sigma_{\text{noise}}^2}}

where σnoise2\sigma_{\text{noise}}^2 is the estimated noise level.

Optimal Orientation

When the source orientation is free, the orientation that maximizes the beamformer output power can be found by solving the generalized eigenvalue problem (Sekihara & Nagarajan, 2008, eq. 4.47):

e^=argmaxee(GCm1G)ee(GCm2G)e\hat{e} = \arg\max_{e} \frac{e^\top (G^\top C_m^{-1} G) \, e}{e^\top (G^\top C_m^{-2} G) \, e}

The eigenvector with the largest eigenvalue gives the optimal source orientation.

Source Estimates

The estimated source time course at location ii is:

si(t)=Wix~(t)s_i(t) = W_i \, \tilde{x}(t)

and the source power is:

Pi=tr(WiCmWi)P_i = \operatorname{tr}(W_i \, C_m \, W_i^\top)

where x~(t)=Cn1/2Px(t)\tilde{x}(t) = C_n^{-1/2} P_\perp \, x(t) is the whitened, projected data vector.

References

  • Van Veen, B.D. et al. (1997). Localization of brain electrical activity via linearly constrained minimum variance spatial filtering. IEEE Trans. Biomed. Eng., 44(9), 867–880.
  • Sekihara, K. & Nagarajan, S.S. (2008). Adaptive Spatial Filters for Electromagnetic Brain Imaging. Springer.
  • Gross, J. & Ioannides, A.A. (1999). Linear transformations of data space in MEG. Phys. Med. Biol., 44, 2081–2097.

DICS Beamformer

The Dynamic Imaging of Coherent Sources (DICS) beamformer (Gross et al., 2001) is the frequency-domain analogue of LCMV. It replaces the time-domain data covariance CmC_m with the cross-spectral density (CSD) matrix C(f)C(f) at a frequency of interest:

W(f)=(GC(f)1G)1GC(f)1W(f) = (G^\top C(f)^{-1} G)^{-1} \, G^\top C(f)^{-1}

The CSD matrix C(f)C(f) can be estimated using Fourier, multitaper, or Morlet wavelet methods.

Real Filter Option

The CSD matrix is generally complex-valued. When computing spatial filter weights for source power estimation, it is common to use only the real part (Hipp et al., 2011):

Creal(f)=[C(f)]C_{\text{real}}(f) = \Re[C(f)]

This ensures real-valued spatial filter weights and avoids phase-related artifacts in the power estimates.

Source Power

The source power at location ii and frequency ff is:

Pi(f)=tr(Wi(f)C(f)Wi(f)H)P_i(f) = \operatorname{tr}(W_i(f) \, C(f) \, W_i(f)^H)

All regularization and weight-normalization options from LCMV apply identically.

References

  • Gross, J. et al. (2001). Dynamic imaging of coherent sources: studying neural interactions in the human brain. PNAS, 98(2), 694–699.
  • van Vliet, M. et al. (2018). Analysis of functional connectivity and oscillatory power using DICS. J. Neurosci. Methods, 309, 199–212.

RAP MUSIC

Recursively Applied and Projected MUltiple SIgnal Classification (RAP-MUSIC; Mosher & Leahy, 1999) is a scanning method that localizes multiple correlated or uncorrelated dipolar sources by iteratively identifying them and projecting them out of the data.

Signal Subspace Estimation

Given the measured data matrix FF (NN channels × TT time samples), the signal subspace is estimated from the eigendecomposition of the data covariance:

FF=UΛUF F^\top = U \Lambda U^\top

The signal subspace Φs=[uNn+1,,uN]\Phi_s = [u_{N-n+1}, \ldots, u_N] is formed from the nn eigenvectors corresponding to the nn largest eigenvalues, where nn is the number of dipoles to search for.

Subspace Correlation Scan

For each candidate source location ii with lead-field GiG_i (N×norientN \times n_{\text{orient}}):

  1. Compute the SVD of the lead-field: Gi=UGΣGVGG_i = U_G \Sigma_G V_G^\top
  2. Compute the correlation matrix: C=UGΦs\mathcal{C} = U_G^\top \Phi_s
  3. Compute the SVD of the correlation: C=UCΣCVC\mathcal{C} = U_\mathcal{C} \Sigma_\mathcal{C} V_\mathcal{C}^\top
  4. The subcorrelation metric is the largest singular value: ρi=σC,1\rho_i = \sigma_{\mathcal{C},1}
  5. The optimal orientation is: e^i=VGdiag(1/σG)uC,1\hat{e}_i = V_G^\top \operatorname{diag}(1/\sigma_G) \, u_{\mathcal{C},1}

The source location with maximum ρi\rho_i is selected as the kk-th identified source.

Recursive Projection

After identifying source kk with lead-field column ak=Gie^ia_k = G_{i^*} \hat{e}_{i^*}, the source is projected out of both the lead-field and signal subspace. Let Ak=[a1,,ak]A_k = [a_1, \ldots, a_k] be the matrix of all identified source fields so far, and let UAU_A come from its SVD. The projector is:

Pk=IUAUAP_k = I - U_A U_A^\top

The projected quantities for the next iteration are:

G(k+1)=PkG,Φs(k+1)=PkΦsG^{(k+1)} = P_k G, \qquad \Phi_s^{(k+1)} = P_k \Phi_s

The algorithm terminates when the subcorrelation falls below a threshold (typically 0.5) or nn sources have been found.

TRAP-MUSIC Variant

In Truncated RAP-MUSIC (Mäkelä et al., 2018), the signal subspace is additionally truncated at each iteration, keeping only nkn - k columns after projection. This improves robustness when sources are highly correlated.

MNE-CPP Dipole-Pair Scanning

The MNE-CPP implementation extends the standard algorithm by scanning over pairs of grid points simultaneously, which improves localization of correlated source pairs:

  1. All (Ngrid+12)\binom{N_{\text{grid}}+1}{2} pairs of grid points are enumerated
  2. For each pair (i,j)(i,j), the combined lead-field GijG_{ij} (N×6N \times 6) is formed
  3. The subspace correlation is computed for the combined lead-field
  4. The pair with maximum correlation is selected
  5. The identified sources are projected out and the process repeats

The pair search is parallelized with OpenMP for performance.

References

  • Mosher, J.C. & Leahy, R.M. (1999). Source localization using recursively applied and projected (RAP) MUSIC. IEEE Trans. Signal Process., 47(2), 332–340.
  • Mäkelä, N. et al. (2018). Truncated RAP-MUSIC (TRAP-MUSIC) for MEG and EEG source localization. NeuroImage, 167, 73–83.

Dipole Fitting

Sequential equivalent current dipole (ECD) fitting localizes focal brain activity by fitting one or more current dipoles to the measured field pattern at each time point. Unlike distributed methods (MNE, beamformers) that estimate activity at many locations simultaneously, dipole fitting finds the single position, orientation, and amplitude that best explain the data.

Forward Model

For a current dipole at position rdr_d with moment Q=(Qx,Qy,Qz)Q = (Q_x, Q_y, Q_z)^\top, the predicted field at sensor kk is:

bk=j=13Gkj(rd)Qjb_k = \sum_{j=1}^{3} G_{kj}(r_d) \, Q_j

or in matrix form: b=G(rd)Qb = G(r_d) \, Q, where G(rd)G(r_d) is the N×3N \times 3 forward matrix computed at the candidate position using the BEM or sphere model.

Cost Function

The fitting proceeds in whitened data space. Let B~=Cn1/2PB\tilde{B} = C_n^{-1/2} P_\perp B be the whitened, projected measurement vector and let G~(rd)=Cn1/2PG(rd)\tilde{G}(r_d) = C_n^{-1/2} P_\perp G(r_d) be the corresponding whitened forward matrix. The SVD of the whitened forward at the candidate position is:

G~(rd)=UΣV\tilde{G}(r_d) = U \Sigma V^\top

The cost function to minimize over the dipole position rdr_d is:

f(rd)=B~2c=1ncomp(ucB~)2f(r_d) = \|\tilde{B}\|^2 - \sum_{c=1}^{n_{\text{comp}}} (u_c^\top \tilde{B})^2

where ncompn_{\text{comp}} is the effective number of components (typically 3 for a free dipole, reduced to 2 if the smallest singular value is less than 20% of the largest).

Goodness of Fit

The relative quality of a dipole fit is measured by the goodness-of-fit (GOF):

GOF=c=1ncomp(ucB~)2B~2×100%\text{GOF} = \frac{\sum_{c=1}^{n_{\text{comp}}} (u_c^\top \tilde{B})^2}{\|\tilde{B}\|^2} \times 100\%

A GOF of 100% means the dipole model explains the data perfectly; lower values indicate contributions from other sources, distributed activity, or noise.

Dipole Moment Estimation

Once the optimal position rdr_d^* is found, the dipole moment is computed from the SVD of the whitened forward:

Q=c=1ncompucB~σcscvcQ = \sum_{c=1}^{n_{\text{comp}}} \frac{u_c^\top \tilde{B}}{\sigma_c} \, s_c \, v_c

where scs_c are column normalization scale factors and σc\sigma_c are the singular values.

Optimization Algorithm

To avoid local minima, the optimization begins with a grid search over precomputed guess points — a set of candidate dipole positions distributed within the conductor model (typically on concentric spheres at 1–2 cm spacing inside the inner skull). The forward fields for all guess points are precomputed, and the best-fitting initial positions are identified by evaluating the projection of the data onto each guess point's forward field.

Non-Linear Optimization

Starting from the best guess point(s), the position is refined by non-linear optimization:

  • MNE-CPP uses a Nelder-Mead simplex algorithm (ported from MNE-C): the initial simplex is a regular tetrahedron of ~1 cm edge length centered on the guess point, with convergence tolerance of 0.2 mm.
  • MNE-Python uses COBYLA (Constrained Optimization BY Linear Approximation) with the constraint that the dipole must remain at least min_dist (default 5 mm) inside the inner skull surface.

Two-Pass Strategy (MNE-CPP)

The MNE-CPP implementation optionally uses a two-pass approach: the first pass uses a sphere model for speed, and the second pass refines the position using the full BEM model starting from the sphere-model result.

Confidence Regions

Confidence limits on the fitted dipole position can be estimated from the Hessian of the cost function at the solution. The Jacobian matrix JJ contains the partial derivatives of the predicted field with respect to all six dipole parameters (rx,ry,rz,Qx,Qy,Qzr_x, r_y, r_z, Q_x, Q_y, Q_z). The parameter covariance matrix is:

C=(JJ)1\mathcal{C} = (J^\top J)^{-1}

The 95% confidence volume is:

V95%=4π3c3λ1λ2λ3V_{95\%} = \frac{4\pi}{3} \sqrt{c^3 \, \lambda_1 \lambda_2 \lambda_3}

where λ1,λ2,λ3\lambda_1, \lambda_2, \lambda_3 are the eigenvalues of the 3×33 \times 3 position submatrix of C\mathcal{C} and c=7.81c = 7.81 is the critical value from the χ2\chi^2 distribution with 3 degrees of freedom at the 95% confidence level.

References

  • Sarvas, J. (1987). Basic mathematical and electromagnetic concepts of the biomagnetic inverse problem. Phys. Med. Biol., 32(1), 11–22.
  • Hämäläinen, M. et al. (1993). Magnetoencephalography — theory, instrumentation, and applications to noninvasive studies of the working human brain. Rev. Mod. Phys., 65(2), 413–497.

Summary of Inverse Methods

The following table summarizes all inverse methods available in MNE-CPP:

MethodTypeDomainSourcesKey Strength
MNEDistributedTimeAll corticalMathematically well-defined, full current distribution
dSPMDistributedTimeAll corticalNoise normalization removes depth bias
sLORETADistributedTimeAll corticalZero localization error for point sources
eLORETADistributedTimeAll corticalExact zero localization bias, iterative weights
LCMVBeamformerTimeScanningAdaptive filter, good for focal sources
DICSBeamformerFrequencyScanningFrequency-specific source localization
RAP MUSICSubspace scanningTimeMultiple focalLocalizes multiple correlated sources
Dipole FitParametricTime1 dipole/timepointPrecise localization for truly focal activity

All methods share common preprocessing: data whitening with the noise covariance matrix CnC_n, application of SSP projectors, and (for MEG) software gradient compensation. The choice of method depends on the expected source configuration and the scientific question.