FwdCompData
Namespace: FWDLIB · Library: Forward Library
#include <fwd/fwd_comp_data.h>
class FWDLIB::FwdCompData
Implements the Forward Compensation Data description (replaces fwdCompData / fwdCompDataRec from MNE-C fwd_comp_data.h).
CTF / 4D software-gradiometer wrapper that re-evaluates the primary field callback on a separate reference-coil set and subtracts the linear combination k·B_ref from the primary field to mirror the compensation already applied to the recorded data.
Public Methods
FwdCompData()
Constructs the Forward Compensation Data.
~FwdCompData()
Destroys the Forward Compensation Data.
Static Methods
fwd_comp_field(rd, Q, coils, res, client)
Calculate the compensated field for one dipole component.
Parameters:
-
rd : const Eigen::Vector3f & Dipole position.
-
Q : const Eigen::Vector3f & Dipole moment direction.
-
coils : FwdCoilSet & Coil definitions.
-
res : Eigen::Ref< Eigen::VectorXf > Result vector.
-
client : *void ** Pointer to
FwdCompData.
Returns:
- int — OK on success, FAIL on error.
fwd_make_ctf_comp_coils(set, coils, comp_coils)
Set up CTF compensation coils for field computations.
Parameters:
-
set : *MNECTFCompDataSet ** Available compensation data.
-
coils : *FwdCoilSet ** Main coil set.
-
comp_coils : *FwdCoilSet ** Compensation coils.
Returns:
- int — OK on success, FAIL on error.
fwd_make_comp_data(set, coils, comp_coils, field, vec_field, field_grad, client)
Compose a compensation data set.
Parameters:
-
set : *MNECTFCompDataSet ** CTF compensation data read from file.
-
coils : *FwdCoilSet ** Principal coil set.
-
comp_coils : *FwdCoilSet ** Compensation coils.
-
field : fwdFieldFunc Field computation function (single dipole component).
-
vec_field : fwdVecFieldFunc Vector field computation function (all components).
-
field_grad : fwdFieldGradFunc Field and gradient computation function.
-
client : *void ** Client data passed to the computation functions.
Returns:
- std::unique_ptr< FwdCompData > — The created
FwdCompData, or nullptr on error.
fwd_comp_field_vec(rd, coils, res, client)
Calculate the compensated field for all three dipole components.
Parameters:
-
rd : const Eigen::Vector3f & Dipole position.
-
coils : FwdCoilSet & Coil definitions.
-
res : Eigen::Ref< Eigen::MatrixXf > Result matrix (3 x ncoil).
-
client : *void ** Pointer to
FwdCompData.
Returns:
- int — OK on success, FAIL on error.
fwd_comp_field_grad(rd, Q, coils, res, xgrad, ygrad, zgrad, client)
Calculate the compensated field and gradient for one dipole component.
Parameters:
-
rd : const Eigen::Vector3f & Dipole position.
-
Q : const Eigen::Vector3f & Dipole moment direction.
-
coils : FwdCoilSet & Coil definitions.
-
res : Eigen::Ref< Eigen::VectorXf > Result vector.
-
xgrad : Eigen::Ref< Eigen::VectorXf > X-gradient result.
-
ygrad : Eigen::Ref< Eigen::VectorXf > Y-gradient result.
-
zgrad : Eigen::Ref< Eigen::VectorXf > Z-gradient result.
-
client : *void ** Pointer to
FwdCompData.
Returns:
- int — OK on success, FAIL on error.
Example
No example of its own: CTF compensation wrapper that FwdBemModel builds for compensated coil sets during ComputeFwd; callers reach it through ComputeFwd.
It is exercised by:
// mne_forward_solution --meg --eeg --accurate --label V1-lh.label with sphere models instead of a BEM
const QString label = tmp.filePath("V1-lh.label"); // the hemisphere is taken from the "-lh.label" suffix
QFile::copy(data + "/subjects/sample/label/lh.V1.label", label);
auto settings = std::make_shared<ComputeFwdSettings>();
settings->include_meg = true;
settings->include_eeg = true;
settings->accurate = true;
settings->srcname = data + "/subjects/sample/bem/sample-oct-6-src.fif";
settings->measname = rawFile.fileName();
settings->mriname = data + "/MEG/sample/all-trans.fif";
settings->r0 = origin;
settings->eeg_sphere_rad = 0.09f;
settings->mindist = 0.0f;
settings->filter_spaces = false;
settings->labels = {label};
settings->nlabel = 1;
settings->solname = tmp.filePath("V1-fwd.fif");
settings->pFiffInfo = QSharedPointer<FiffInfo>::create(raw.info);
settings->checkIntegrity();
auto fwd = std::make_shared<ComputeFwd>(settings)->calculateFwd();
QFile solFile(settings->solname);
fwd->write(solFile);
From ex_fwd_api.
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Gabriel Motta <gabrielbenmotta@gmail.com>