Skip to main content

FwdCoil

Namespace: FWDLIB  ·  Library: Forward Library

#include <fwd/fwd_coil.h>

class FWDLIB::FwdCoil

Implements FwdCoil (replaces fwdCoil / fwdCoilRec from MNE-C fwd_types.h).

Single MEG sensor coil or EEG electrode — stores the coil-local frame and the (r_mag, cos_mag, w) integration-point triples that approximate the Biot-Savart surface integral over the coil area.

src/examples/ex_fwd_api/main.cpp
auto templates = FwdCoilSet::read_coil_defs(coilDefs); // integration points per coil type
auto coils = templates->create_meg_coils(meg, meg.size(), FWD_COIL_ACCURACY_ACCURATE, raw.info.dev_head_t);
const FwdCoil& first = *coils->coils[0]; // MEG 0113 in head coordinates

Public Methods​

FwdCoil(p_np)​

Constructs the Forward Coil.

Parameters:

  • p_np : int Number of integration points; rmag, cosmag and w are zero-initialized to this size.

FwdCoil(p_FwdCoil)​

Copy constructor.

Parameters:

  • p_FwdCoil : const FwdCoil & FwdCoil which should be copied.

~FwdCoil()​

Destroys the Forward Coil description.


is_axial_coil()​

Checks if this is an axial coil.

Returns:

  • bool — True if axial coil, false otherwise.

is_magnetometer_coil()​

Checks if this is an magnetometer.

Returns:

  • bool — True if magnetometer, false otherwise.

is_planar_coil()​

Checks if this is an planar coil.

Returns:

  • bool — True if planar coil, false otherwise.

is_eeg_electrode()​

Checks if this is an EEG electrode.

Returns:

  • bool — True if EEG electrode, false otherwise.

pos(j)​

Return a read-only map to the j-th integration point position (3 contiguous floats).

Parameters:

  • j : int Integration point index (0 to np - 1).

Returns:

  • Eigen::Map< const Eigen::Vector3f > — Read-only view of row j of rmag, in m.

dir(j)​

Return a read-only map to the j-th integration point direction cosine.

Parameters:

  • j : int Integration point index (0 to np - 1).

Returns:

  • Eigen::Map< const Eigen::Vector3f > — Read-only view of row j of cosmag (unit direction vector).

Static Methods​

create_eeg_el(ch, t)​

Create an electrode definition.

Transform coordinate frame if so desired.

Parameters:

Returns:

  • FwdCoil::UPtr — The created coil.

Example​

Used in examples​

ex_fwd_api​

Forward library: coil definitions, BEM and sphere models, field maps and forward solutions.

src/examples/ex_fwd_api/main.cpp, line 121
auto templates = FwdCoilSet::read_coil_defs(coilDefs); // integration points per coil type
auto coils = templates->create_meg_coils(meg, meg.size(), FWD_COIL_ACCURACY_ACCURATE, raw.info.dev_head_t);
const FwdCoil& first = *coils->coils[0]; // MEG 0113 in head coordinates
// mne _create_meg_coils(accurate): 3012 planar gradiometer, 8 points, r0 (-106.15, 29.14, -14.73) mm
ok &= expect(coils->ncoil() == 306 && first.type == 3012 && first.np == 8 && coils->is_planar_coil_type(first.type) && (first.r0 - Vector3f(-0.10614990f, 0.02914091f, -0.01472596f)).norm() < 1e-6f,
"FwdCoilSet/FwdCoil: 306 accurate MEG coils, MEG0113 a planar gradiometer with 8 points");

Authors of this file​