InvVectorSourceEstimate
Namespace: INVLIB · Library: Inverse Library
mne.VectorSourceEstimate in MNE-Python.
#include <inv/inv_vector_source_estimate.h>
class INVLIB::InvVectorSourceEstimate
Vector source estimate: each vertex carries a 3D orientation vector across time.
data has shape (n_vertices*3 x n_times). Rows are interleaved: [x0,y0,z0, x1,y1,z1, ...]. Use magnitude() to collapse to scalar (n_vertices x n_times) for visualisation.
// The MNE kernel keeps x, y and z per source: an apply_inverse(..., pick_ori="vector") estimate.
const MatrixXd goodData = evoked.pick_channels(inverse.noise_cov->names).data;
const InvVectorSourceEstimate vectorStc(kernel * goodData, stc.vertices, stc.tmin, stc.tstep);
const InvSourceEstimate magnitude = vectorStc.magnitude(); // 70 x 421 vector lengths
Inheritance
Public Methods
InvVectorSourceEstimate()
InvVectorSourceEstimate(p_sol, p_vertices, p_tmin, p_tstep)
Construct from data and vertices.
Parameters:
-
p_sol : const Eigen::MatrixXd & Data (n_vertices*3 x n_times).
-
p_vertices : const Eigen::VectorXi & Vertex indices (n_vertices).
-
p_tmin : float Start time.
-
p_tstep : float Time step.
nVertices()
Number of source vertices (data.rows() / 3).
Returns:
- int — Number of vertices, each carrying an x/y/z component row.
magnitude()
Compute the magnitude (L2 norm) at each vertex across time.
Returns:
- InvSourceEstimate — Scalar source estimate (n_vertices x n_times).
vertexData(vertexIdx)
Extract the (x, y, z) data for a specific vertex.
Parameters:
- vertexIdx : int Local index into vertices array.
Returns:
- Eigen::MatrixXd — Matrix (3 x n_times) for the requested vertex.
projectToNormals(normals)
Project the 3D vectors onto surface normals to produce a signed scalar estimate.
Parameters:
- normals : const Eigen::MatrixX3f & Surface normals (n_vertices x 3).
Returns:
- InvSourceEstimate — Scalar source estimate (n_vertices x n_times).
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.
// The MNE kernel keeps x, y and z per source: an apply_inverse(..., pick_ori="vector") estimate.
const MatrixXd goodData = evoked.pick_channels(inverse.noise_cov->names).data;
const InvVectorSourceEstimate vectorStc(kernel * goodData, stc.vertices, stc.tmin, stc.tstep);
const InvSourceEstimate magnitude = vectorStc.magnitude(); // 70 x 421 vector lengths
// mne.minimum_norm.apply_inverse(evoked, inv, 1/9, "MNE", pick_ori="vector"): sum of lengths 4.31370e-4
ok &= expect(vectorStc.nVertices() == 70 && near(magnitude.data.sum(), 0.0004313698431300483, 1e-4) && near(magnitude.data(0, 200), 3.865084798591962e-09, 1e-4),
"InvVectorSourceEstimate: vector MNE lengths match apply_inverse(pick_ori=\"vector\")");
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>