Skip to main content

MNECTFCompData

Namespace: MNELIB  ·  Library: MNE Library

#include <mne/mne_ctf_comp_data.h>

class MNELIB::MNECTFCompData

Represents a single CTF compensation data element.

Holds the compensation matrix together with optional sparse pre-/post-selectors and intermediate computation buffers used by MNECTFCompDataSet::apply() and apply_transpose().

src/examples/ex_mne_api/main.cpp
// Open a third-order gradiometer recording and read it uncompensated (grade 0)
std::unique_ptr<MNERawData> ctfRaw(MNERawData::open_file_comp(ctfPath, false, false, MNEFilterDef(), 0));
const MNECTFCompDataSet& comp = *ctfRaw->comp; // grades 1, 2, 3 and two 4D kinds
const MNECTFCompData* third = nullptr;
for (const auto& c : comp.comps) {
if (c->kind == MNECTFCompDataSet::map_comp_kind(3)) {
third = c.get();
}
}
const int grade = MNECTFCompDataSet::get_comp(ctfRaw->info->chInfo, ctfRaw->info->nchan);
Matrix<float, Dynamic, Dynamic, RowMajor> ctf(ctfRaw->info->nchan, 21);
std::vector<float*> ctfRows(ctf.rows());
for (int c = 0; c < ctf.rows(); ++c) {
ctfRows[c] = ctf.row(c).data();
}
ctfRaw->pick_data(nullptr, ctfRaw->first_samp, 21, ctfRows.data());

Public Methods​

MNECTFCompData()​

Constructs an empty MNE CTF Compensation Data object.


MNECTFCompData(comp)​

Copy constructor.

Parameters:

  • comp : const MNECTFCompData & The compensation data to copy.

~MNECTFCompData()​

Destructor.


calibrate(chs, nch, do_it)​

Apply or remove channel calibration to/from the compensation matrix by scaling each element by (row_cal / col_cal) or its inverse.

Parameters:

  • chs : const QList< FiffChInfo > & Channel information used for calibration factors.

  • nch : int Number of channels.

  • do_it : bool If true, apply calibration; if false, remove it.

Returns:

  • int — OK on success, FAIL if a channel is not found.

Example​

Used in examples​

ex_mne_api​

MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.

src/examples/ex_mne_api/main.cpp, line 345
// Open a third-order gradiometer recording and read it uncompensated (grade 0)
std::unique_ptr<MNERawData> ctfRaw(MNERawData::open_file_comp(ctfPath, false, false, MNEFilterDef(), 0));
const MNECTFCompDataSet& comp = *ctfRaw->comp; // grades 1, 2, 3 and two 4D kinds
const MNECTFCompData* third = nullptr;
for (const auto& c : comp.comps) {
if (c->kind == MNECTFCompDataSet::map_comp_kind(3)) {
third = c.get();
}
}
const int grade = MNECTFCompDataSet::get_comp(ctfRaw->info->chInfo, ctfRaw->info->nchan);
Matrix<float, Dynamic, Dynamic, RowMajor> ctf(ctfRaw->info->nchan, 21);
std::vector<float*> ctfRows(ctf.rows());
for (int c = 0; c < ctf.rows(); ++c) {
ctfRows[c] = ctf.row(c).data();

Authors of this file​