Skip to main content

FiffCtfComp

Namespace: FIFFLIB  ·  Library: FIFF Library

#include <fiff/fiff_ctf_comp.h>

class FIFFLIB::FiffCtfComp

One CTF software-gradient compensation matrix: grade kind, calibration flag and the gradiometer × reference named matrix.

A list of FiffCtfComp lives inside FiffInfo and lets raw / evoked data be moved between compensation grades by chaining the appropriate matrices. The save_calibrated flag controls whether the matrix was stored already-calibrated (and therefore must not be re-multiplied by the channel cals on apply).

src/examples/ex_fiff_structure/main.cpp
// CTF third-order gradient compensation: info.comps holds one FiffCtfComp per grade.
QFile ctfFile(parser.value(ctfOption));
const FiffRawData ctf(ctfFile);
FiffCtfComp toGrade1;
ok &= ctf.info.make_compensator(0, 1, toGrade1); // uncompensated -> grade 1

Public Methods​

FiffCtfComp()​

Constructs the CTF software compensation data.


FiffCtfComp(p_FiffCtfComp)​

Copy constructor.

Parameters:

  • p_FiffCtfComp : const FiffCtfComp & CTF software compensation data which should be copied.

operator=(other)​

Copy assignment.

Every member has value semantics, so the compiler-generated member-wise assignment is correct. It is declared explicitly because declaring a copy constructor and/or a destructor deprecates the implicitly generated one.

Parameters:

Returns:


~FiffCtfComp()​

Destroys the CTF software compensation data.


clear()​

Initializes the CTF software compensation data.


calibrate(chs)​

Brings a compensator stored uncalibrated into calibrated units, as mne _read_ctf_comp does: each matrix element is scaled by its row channel's range * cal and divided by its column channel's.

The factors are kept in rowcals and colcals so that write_ctf_comp can undo them. A compensator saved calibrated is left as it is.

Parameters:

  • chs : const QList< FiffChInfo > & The channels the compensator refers to by name.

Returns:

  • bool — false if a row or column channel is missing from, or ambiguous in, chs.

Example​

Used in examples​

ex_fiff_structure​

FIFF library: fixed-length epochs, CTF compensation, the file directory and raw buffers, and handing.

src/examples/ex_fiff_structure/main.cpp, line 140
// CTF third-order gradient compensation: info.comps holds one FiffCtfComp per grade.
QFile ctfFile(parser.value(ctfOption));
const FiffRawData ctf(ctfFile);
FiffCtfComp toGrade1;
ok &= ctf.info.make_compensator(0, 1, toGrade1); // uncompensated -> grade 1
// mne._fiff.compensator.make_compensator(info, 0, 1) on ctf_grade0_raw.fif: 36 x 36, ||C - I||_F = 0.1947596520139745
const MatrixXd& compensator = toGrade1.data->data;
ok &= expect(ctf.info.comps.size() == 5 && compensator.rows() == 36 && std::abs((compensator - MatrixXd::Identity(36, 36)).norm() - 0.1947596520139745) < 1e-6,
"FiffCtfComp: 5 compensation grades; the grade-1 compensator matches mne make_compensator");

ex_cancel_noise​

Example of noise cancellation procedures.

src/examples/ex_cancel_noise/main.cpp, line 86
//example for compensator generation
FiffCtfComp comp;
if (dest_comp > 0) {
qDebug() << "This part needs to be debugged";
p_FiffEvokedSet.info.make_compensator(comp_now, dest_comp, comp); //ToDo: make_compensator needs to be debugged
printf("Appropriate forward operator compensator created.\n");
} else
printf("No forward operator compensator needed.\n");

Authors of this file​