MNECorticalMap
Namespace: MNELIB · Library: MNE Library
#include <mne/mne_cortical_map.h>
class MNELIB::MNECorticalMap
Builds the resolution matrix K G that maps source activity to its estimate.
Resolution matrix of an inverse operator
// The same resolution matrix from a prepared inverse; the forward is rotated to the inverse's surface basis
MNEInverseOperator prepared = inverse.prepare_inverse_operator(evoked.nave, lambda2, false, false);
MatrixXd surfaceKernel;
SparseMatrix<double> noNormals;
QList<VectorXi> kernelVertices;
prepared.assemble_kernel(FsLabel(), "MNE", false, surfaceKernel, noNormals, kernelVertices);
prepared.getKernel() = surfaceKernel;
const MatrixXd corticalMap = MNECorticalMap::makeCorticalMap(fwd, prepared, evoked.info);
Public Methods
MNECorticalMap()
Static Methods
makeCorticalMap(fwd, inv, info)
Create the resolution matrix M = K G that maps source activity to its estimate.
K is the inverse operator kernel; G holds the rows of the forward gain for the kernel's channels, matched by name (mne-python make_inverse_resolution_matrix).
Parameters:
-
fwd : const MNEForwardSolution & The forward solution containing the gain matrix.
-
inv : const MNEInverseOperator & The inverse operator (must have been prepared / have a kernel).
-
info : const FiffInfo & The measurement info for channel selection.
Returns:
- Eigen::MatrixXd — The cortical mapping matrix (nSources x nSources).
Example
- Full source:
src/examples/ex_inv_api/main.cpp - Build target:
ex_inv_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_inv_api
Inverse library: minimum-norm estimates, resolution matrices, label time courses, sparse solvers.
QList<VectorXi> kernelVertices;
prepared.assemble_kernel(FsLabel(), "MNE", false, surfaceKernel, noNormals, kernelVertices);
prepared.getKernel() = surfaceKernel;
const MatrixXd corticalMap = MNECorticalMap::makeCorticalMap(fwd, prepared, evoked.info);
// mne K (Cartesian) times the Cartesian gain, the same product in one basis: trace 26.1330, Frobenius norm 6.13353
ok &= expect(corticalMap.rows() == 210 && corticalMap.cols() == 210 && near(corticalMap.trace(), 26.133038866971994, 1e-4) && near(corticalMap.norm(), 6.13352636100184, 1e-4),
"MNECorticalMap: K G in the inverse's surface basis matches mne");
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>