SurfaceLaplacianResult
Namespace: RTPROCESSINGLIB · Library: DSP Library
#include <dsp/surface_laplacian.h>
struct UTILSLIB::SurfaceLaplacianResult
Result of a surface Laplacian (CSD) computation.
src/examples/ex_dsp_preprocessing/main.cpp
MatrixX3d electrodes(8, 3); // head coordinates in metres, on a 9 cm sphere
electrodes << 0.0, 0.0, 0.09,
0.05785088487178853, 0.0, 0.06894399988070801,
0.0, 0.05785088487178853, 0.06894399988070801,
-0.05785088487178853, 0.0, 0.06894399988070801,
0.0, -0.05785088487178853, 0.06894399988070801,
0.0626727816288017, 0.0626727816288017, 0.015628335990023737,
-0.0626727816288017, 0.0626727816288017, 0.015628335990023737,
-0.06267278162880172, -0.0626727816288017, 0.015628335990023737;
MatrixXd eeg(8, 10);
for (int k = 0; k < 8; ++k) {
for (int t = 0; t < 10; ++t) {
eeg(k, t) = std::sin(t * (k + 1) * 0.3);
}
}
const SurfaceLaplacianResult csd = SurfaceLaplacian::compute(eeg, electrodes, 1e-5, 4, 50, 0.09);
Example
- Full source:
src/examples/ex_dsp_preprocessing/main.cpp - Build target:
ex_dsp_preprocessing(runs under CTest)
Used in examples
ex_dsp_preprocessing
Preprocessing tools of the dsp library on synthetic data with a known ground truth.
src/examples/ex_dsp_preprocessing/main.cpp, line 219
const SurfaceLaplacianResult csd = SurfaceLaplacian::compute(eeg, electrodes, 1e-5, 4, 50, 0.09);
// mne.preprocessing.compute_current_source_density(sphere=(0, 0, 0, 0.09), lambda2=1e-5, stiffness=4), sample 3
VectorXd mneCsd(8);
mneCsd << 984.4089021671608, 1280.7679646395302, 457.7070056428769, -775.4476983026417,
-977.028371298518, -378.06791643722704, -311.9232346310464, 211.576727857144;
const double csdErr = (csd.matData.col(3) - mneCsd).cwiseAbs().maxCoeff() / mneCsd.cwiseAbs().maxCoeff();
ok &= expect(csdErr < 1e-6, QString("surface Laplacian = mne compute_current_source_density (relative error %1)").arg(csdErr));
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>