FwdEegSphereModelSet
Namespace: FWDLIB · Library: Forward Library
#include <fwd/fwd_eeg_sphere_model_set.h>
class FWDLIB::FwdEegSphereModelSet
Definitions for the EEG Sphere Model Set (replaces fwdEegSphereModelSet / fwdEegSphereModelSetRec from MNE-C fwd_types.h).
Name-indexed collection of FwdEegSphereModel objects parsed from an mne_setup_eeg_sphere_model parameter file so callers can resolve textual model names ("Default", "Stok", …) into ready-to-use analytic head models.
std::unique_ptr<FwdEegSphereModelSet> models(FwdEegSphereModelSet::fwd_add_default_eeg_sphere_model(nullptr));
std::unique_ptr<FwdEegSphereModel> sphere(models->fwd_select_eeg_sphere_model("Default")); // 4 layers: brain, CSF, skull, scalp
// Scalp radius 90 mm; 3 Berg-Scherg dipoles approximate the layered potentials
sphere->fwd_setup_eeg_sphere_model(0.09f, true, 3);
sphere->r0 = Vector3f(0.0f, 0.0f, 0.04f);
auto els = FwdCoilSet::create_eeg_els(eeg, eeg.size());
VectorXf V(els->ncoil());
FwdEegSphereModel::fwd_eeg_spherepot_coil(rd, Q, *els, V, sphere.get()); // V per A m
Public Methods
FwdEegSphereModelSet()
Constructs a Forward EEG Sphere Model Set object.
~FwdEegSphereModelSet()
Destroys the Forward EEG Sphere Model Set description.
FwdEegSphereModelSet()
operator=()
FwdEegSphereModelSet()
operator=()
fwd_select_eeg_sphere_model(p_sName)
Find a model with a given name and return a duplicate Refactored from: fwd_eeg_sphere_models.c.
Parameters:
- p_sName : const QString & Name of the model to find.
Returns:
- FwdEegSphereModel::UPtr — A duplicat of the found model.
fwd_list_eeg_sphere_models()
List the properties of available models via qInfo.
nmodel()
Number of models in this set.
Returns:
- int — Number of EEG sphere models stored in this set.
Static Methods
fwd_add_to_eeg_sphere_model_set(s, m)
Add a model to a set.
The model will be owned by the set.
Parameters:
-
s : UPtr The model set (created if nullptr).
-
m : FwdEegSphereModel::UPtr The model to add (ownership transferred).
Returns:
- UPtr — The model set.
fwd_add_default_eeg_sphere_model(s)
Choose and setup the default EEG sphere model Refactored from: fwd_eeg_sphere_models.c.
Parameters:
- s : UPtr The model set to which loaded models are added.
Returns:
- UPtr — The model set with the default model (s + default models).
fwd_load_eeg_sphere_models(p_sFileName, now)
Load all models available in the specified file Refactored from: fwd_eeg_sphere_models.c.
Parameters:
-
p_sFileName : const QString & file name to load models from.
-
now : UPtr The model set to which loaded models are added.
Returns:
- UPtr — The loaded model set (now + loaded models).
Example
- Full source:
src/examples/ex_fwd_api/main.cpp - Build target:
ex_fwd_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_fwd_api
Forward library: coil definitions, BEM and sphere models, field maps and forward solutions.
std::unique_ptr<FwdEegSphereModelSet> models(FwdEegSphereModelSet::fwd_add_default_eeg_sphere_model(nullptr));
std::unique_ptr<FwdEegSphereModel> sphere(models->fwd_select_eeg_sphere_model("Default")); // 4 layers: brain, CSF, skull, scalp
// Scalp radius 90 mm; 3 Berg-Scherg dipoles approximate the layered potentials
sphere->fwd_setup_eeg_sphere_model(0.09f, true, 3);
sphere->r0 = Vector3f(0.0f, 0.0f, 0.04f);
auto els = FwdCoilSet::create_eeg_els(eeg, eeg.size());
VectorXf V(els->ncoil());
FwdEegSphereModel::fwd_eeg_spherepot_coil(rd, Q, *els, V, sphere.get()); // V per A m
// mne.make_sphere_model(r0=(0, 0, 0.04), head_radius=0.09): layers at 81, 82.8, 87.3, 90 mm; |V| = 452.86725
ok &= expect(sphere->nlayer() == 4 && near(sphere->layers[2].rel_rad, 0.97, 1e-6) && near(sphere->layers[2].sigma, 0.004, 1e-6) && near(V.norm(), 452.86725, 1e-3) && near(V[0], 12.079552, 1e-2),
"FwdEegSphereModel/FwdEegSphereModelSet/FwdEegSphereLayer: 4-layer sphere potentials match mne");
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Juan GPC <jgarciaprieto@mgh.harvard.edu>
- Gabriel Motta <gabrielbenmotta@gmail.com>