Skip to main content

FwdCoilSet

Namespace: FWDLIB  ·  Library: Forward Library

#include <fwd/fwd_coil_set.h>

class FWDLIB::FwdCoilSet

Implements FwdCoilSet (replaces fwdCoilSet / fwdCoilSetRec from MNE-C fwd_types.h).

Container of FwdCoil instances acting both as the in-memory image of the coil_def.dat template database and as a per-channel sensor array in a chosen coordinate frame (device / head / MRI).

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​

FwdCoilSet()​

Constructs the Forward Coil Set description.


~FwdCoilSet()​

Destroys the Forward Coil Set description.


create_meg_coil(ch, acc, t)​

Create a MEG coil definition using a database of templates Change the coordinate frame if so desired.

Parameters:

  • ch : const FiffChInfo & Channel information to use.

  • acc : int Required accuracy.

  • t : const FiffCoordTrans & Transform the points using this.

Returns:

  • FwdCoil::UPtr — The created meg coil.

create_meg_coils(chs, nch, acc, t)​

Create a MEG coil set definition using a database of templates Change the coordinate frame if so desired.

Parameters:

  • chs : const QList< FiffChInfo > & Channel information to use.

  • nch : int Number of channels.

  • acc : int Required accuracy.

  • t : const FiffCoordTrans & Transform the points using this.

Returns:

  • FwdCoilSet::UPtr — The created meg coil set.

dup_coil_set(t)​

Make a coil set duplicate.

Parameters:

  • t : const FiffCoordTrans & Transformation which should be applied to the duplicate.

Returns:

  • FwdCoilSet::UPtr — The duplicated coil set.

is_planar_coil_type(type)​

Checks if a set of templates contains a planar coil of a specified type.

Parameters:

  • type : int This is the coil type we are interested in.

Returns:

  • bool — True if set contains a planar coil of specified type, false otherwise.

is_axial_coil_type(type)​

Checks if a set of templates contains an axial coil of a specified type.

Parameters:

  • type : int This is the coil type we are interested in.

Returns:

  • bool — True if set contains an axial coil of specified type, false otherwise.

is_magnetometer_coil_type(type)​

Checks if a set of templates contains a magnetometer of a specified type.

Parameters:

  • type : int This is the coil type we are interested in.

Returns:

  • bool — True if set contains a magnetometer of specified type, false otherwise.

is_eeg_electrode_type(type)​

Checks if a set of templates contains an EEG electrode of a specified type.

Parameters:

  • type : int This is the coil type we are interested in.

Returns:

  • bool — True if set contains an EEG electrode of specified type, false otherwise.

ncoil()​

Number of coils (convenience accessor).

Returns:

  • int — Number of coils or electrodes in this set.

Static Methods​

create_eeg_els(chs, nch, t)​

Create a EEG coil set definition using a channel information Change the coordinate frame if so desired.

Parameters:

  • chs : const QList< FiffChInfo > & Channel information to use.

  • nch : int Number of channels.

  • t : const FiffCoordTrans & Transform the points using this.

Returns:

  • FwdCoilSet::UPtr — The created meg coil set.

read_coil_defs(name)​

Read a coil definitions from file.

Parameters:

  • name : const QString & File name to read from.

Returns:

  • FwdCoilSet::UPtr — The read meg coil set.

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​