Skip to main content

InvMinimumNorm

Namespace: INVLIB  ·  Library: Inverse Library

Python equivalent

mne.minimum_norm.apply_inverse in MNE-Python.

#include <inv/inv_minimum_norm.h>

class INVLIB::InvMinimumNorm

Minimum norm estimation algorithm.

Computes L2 minimum-norm, dSPM, or sLORETA source estimates from MEG/EEG data using a pre-computed inverse operator.

References:

  • Hamalainen & Ilmoniemi, Med. & Biol. Eng. & Comput. 32, 35-42, 1994.
  • Dale et al., Neuron 26, 55-67, 2000 (dSPM).
  • Pascual-Marqui, Methods Find. Exp. Clin. Pharmacol. 24D, 5-12, 2002 (sLORETA).

Minimum norm estimation

src/examples/ex_inv_api/main.cpp
FsLabel v1;
FsLabel::read(data + "/subjects/sample/label/lh.V1.label", v1);
QFile fwdFile(data + "/Result/ref-sample_audvis-meg-eeg-oct-6-fwd.fif");
const MNEForwardSolution fwd = MNEForwardSolution(fwdFile).pick_regions({v1}); // 70 sources x 3 orientations
QFile covFile(data + "/MEG/sample/sample_audvis-cov.fif");
const FiffCov noiseCov(covFile);
QFile aveFile(data + "/MEG/sample/sample_audvis-ave.fif");
const FiffEvoked evoked(aveFile, 0); // "Left Auditory"

const MNEInverseOperator inverse = MNEInverseOperator::make_inverse_operator(evoked.info, fwd, noiseCov, 0.2f, 0.8f);
const float lambda2 = 1.0f / 9.0f; // SNR 3
InvMinimumNorm dspm(inverse, lambda2, "dSPM");
const InvSourceEstimate stc = dspm.calculateInverse(evoked); // one row per source, combined over orientations

Public Methods​

InvMinimumNorm(p_inverseOperator, lambda, method)​

Constructs minimum norm inverse algorithm.

Parameters:

  • p_inverseOperator : const MNEInverseOperator & The inverse operator.

  • lambda : float The regularization factor.

  • method : const QString Use mininum norm, dSPM or sLORETA. ("MNE" | "dSPM" | "sLORETA").


InvMinimumNorm(p_inverseOperator, lambda, dSPM, sLORETA)​

Constructs minimum norm inverse algorithm.

Parameters:

  • p_inverseOperator : const MNEInverseOperator & The inverse operator.

  • lambda : float The regularization factor.

  • dSPM : bool Compute the noise-normalization factors for dSPM?.

  • sLORETA : bool Compute the noise-normalization factors for sLORETA?.


~InvMinimumNorm()​


calculateInverse(p_fiffEvoked, pick_normal)​

Computes a L2-norm inverse solution Actual code using these principles might be different because the inverse operator is often reused across data sets.

Parameters:

  • p_fiffEvoked : const FiffEvoked & Evoked data.

  • pick_normal : bool If True, rather than pooling the orientations by taking the norm, only the. radial component is kept. This is only applied when working with loose orientations.

Returns:


calculateInverse(data, tmin, tstep, pick_normal)​


mneData(p_fiffEvoked, snr)​

Sets the inverse up for the evoked data and computes their MNE data: eigenfield projections, SNR and lambda2 per time point and the predicted data (MNE-C mne_analyze; see MNELIB::MNEMneData::compute).

Parameters:

  • p_fiffEvoked : const FiffEvoked & Evoked data.

  • snr : double Power SNR for a fixed lambda2, <= 0 to use the estimated lambda2 per time point.

Returns:

  • MNEMneData — The MNE data; empty if the channels do not match the inverse operator.

doInverseSetup(nave, pick_normal)​

Perform the inverse setup: Prepares this inverse operator and assembles the kernel.

Parameters:

  • nave : qint32 Number of averages to use.

  • pick_normal : bool If True, rather than pooling the orientations by taking the norm, only the. radial component is kept. This is only applied when working with loose orientations.


getName()​

Get the name of the inverse operator.

Returns:

  • *const char ** — the name of the inverse operator.

getSourceSpace()​

Get the source space corresponding to this inverse operator.

Returns:

  • const MNESourceSpaces & — the source space corresponding to this inverse operator.

getPreparedInverseOperator()​

Get the prepared inverse operator.

Returns:


setMethod(method)​

Set minimum norm algorithm method ("MNE" | "dSPM" | "sLORETA" | "eLORETA").

Parameters:

  • method : QString Use minimum norm, dSPM, sLORETA, or eLORETA.

setMethod(dSPM, sLORETA, eLoreta)​

Set minimum norm algorithm method ("MNE" | "dSPM" | "sLORETA" | "eLORETA").

Parameters:

  • dSPM : bool Compute the noise-normalization factors for dSPM?.

  • sLORETA : bool Compute the noise-normalization factors for sLORETA?.

  • eLoreta : bool Compute the eLORETA source weights?.


setRegularization(lambda)​

Set regularization factor.

Parameters:

  • lambda : float The regularization factor.

setELoretaOptions(maxIter, eps, forceEqual)​

Set eLORETA options.

Parameters:

  • maxIter : int Maximum number of eLORETA weight iterations (default: 20).

  • eps : double Convergence threshold for weight fitting (default: 1e-6).

  • forceEqual : bool If true, use uniform orientation weights (default: false).


getKernel()​

Get the assembled kernel.

Returns:

  • Eigen::MatrixXd & — the assembled kernel.

Example​

Used in examples​

ex_inv_api​

Inverse library: minimum-norm estimates, resolution matrices, label time courses, sparse solvers.

src/examples/ex_inv_api/main.cpp, line 121
const MNEInverseOperator inverse = MNEInverseOperator::make_inverse_operator(evoked.info, fwd, noiseCov, 0.2f, 0.8f);
const float lambda2 = 1.0f / 9.0f; // SNR 3
InvMinimumNorm dspm(inverse, lambda2, "dSPM");
const InvSourceEstimate stc = dspm.calculateInverse(evoked); // one row per source, combined over orientations
// mne.minimum_norm.apply_inverse(evoked, inv, 1/9, "dSPM"): 70 x 421, sum |stc| = 372483.6, stc[0, 0] = 5.00927
ok &= expect(stc.data.rows() == 70 && stc.data.cols() == 421 && near(stc.data.cwiseAbs().sum(), 372483.6177246599, 1e-4) && near(stc.data(0, 0), 5.0092691144321755, 1e-4) && near(stc.tmin, -0.19979521, 1e-6),
"InvMinimumNorm/InvSourceEstimate: dSPM on 70 V1 sources matches mne.minimum_norm.apply_inverse");

ex_make_inverse_operator​

Example of making an inverse operator.

src/examples/ex_make_inverse_operator/main.cpp, line 117
// Compute inverse solution
InvMinimumNorm minimumNorm_meeg(inverse_operator_meeg, lambda2, method);
InvSourceEstimate sourceEstimate_meeg = minimumNorm_meeg.calculateInverse(evoked);

ex_connectivity​

Example of using the MNE-CPP Connectivity library.

src/examples/ex_connectivity/main.cpp, line 316
// Compute inverse solution
InvMinimumNorm minimumNorm(inverse_operator, lambda2, method);
minimumNorm.doInverseSetup(1, true);

Also used in ex_connectivity_comparison, ex_clustered_inverse_mne, ex_clustered_inverse_mne_raw, ex_disp_3D, ex_histogram, ex_inverse_mne, ex_inverse_mne_raw.

Authors of this file​