Skip to main content

IeegSurfaceMap

Namespace: IEEGLIB  ·  Library: iEEG Library

Python equivalent

mne.stc_near_sensors in MNE-Python.

#include <ieeg/ieeg_surface_map.h>

class IEEGLIB::IeegSurfaceMap

Weights that paint contact values onto a surface.

src/examples/ex_ieeg/main.cpp
// Vertices of a surface in the same frame; each takes the values of contacts within 1 cm.
// Depth contacts lie inside the brain, so they are not projected onto the surface first.
Eigen::MatrixX3f vertices(2, 3);
vertices << -0.03f, 0.0f, 0.0f, -0.03f, 0.0f, 0.02f;
const Eigen::SparseMatrix<double> weights = IeegSurfaceMap::weights(implantation.positions(), vertices, 0.01,
IeegSurfaceMapMode::Sum, false);
const Eigen::MatrixXd vertexData = weights * data; // vertices x samples

Static Methods​

weights(contacts, vertices, distance, mode, project)​

Compute the vertices x contacts weight matrix.

Equivalent to MNE-Python's stc_near_sensors for a surface. Contacts with a non-finite position get an empty column.

Parameters:

  • contacts : const Eigen::MatrixX3f & Contact positions, one row per contact, in metres.

  • vertices : const Eigen::MatrixX3f & Surface vertex positions in the same frame, one row per vertex.

  • distance : double Reach of each contact in metres.

  • mode : IeegSurfaceMapMode How weights near one vertex combine.

  • project : bool Move each contact to its nearest vertex first, as ECoG contacts lie on, not in, the cortex.

Returns:

  • Eigen::SparseMatrix< double > — Sparse vertices x contacts weights.

Example​

Used in examples​

ex_ieeg​

IEEG library: group sEEG contacts into a lead, derive a bipolar montage and paint contact values onto a surface.

src/examples/ex_ieeg/main.cpp, line 90
// Depth contacts lie inside the brain, so they are not projected onto the surface first.
Eigen::MatrixX3f vertices(2, 3);
vertices << -0.03f, 0.0f, 0.0f, -0.03f, 0.0f, 0.02f;
const Eigen::SparseMatrix<double> weights = IeegSurfaceMap::weights(implantation.positions(), vertices, 0.01,
IeegSurfaceMapMode::Sum, false);
const Eigen::MatrixXd vertexData = weights * data; // vertices x samples
// Vertex 0 is at LA1 (weight 1), LA2 3.5 mm (0.65) and LA3 7 mm (0.3) away; vertex 1 is beyond reach
ok &= expect(std::fabs(vertexData(0, 0) - (10.0 + 0.65 * 15.0 + 0.3 * 30.0)) < 1e-4 && vertexData(1, 0) == 0.0,
QString("IeegSurfaceMap: vertex 0 = %1, vertex 1 = %2").arg(vertexData(0, 0)).arg(vertexData(1, 0)));

Authors of this file​