FiffChInfo
Namespace: FIFFLIB · Library: FIFF Library
#include <fiff/fiff_ch_info.h>
class FIFFLIB::FiffChInfo
Per-channel FIFF descriptor: identifiers, kind, calibration, coil type, channel-frame coil position and SI unit.
Holds the exact field set of the on-disk fiffChInfoRec: scanno, logno, kind, range, cal, coil_type, the embedded FiffChPos coil location, unit and unit_mul. The ch_name string lives next to the record because the FIFF stream stores it as a separate FIFF_CH_NAME tag in modern files.
QFile rawFile(dir + "/sample_audvis_trunc_raw.fif");
FiffRawData raw(rawFile); // reads the measurement info, raw data is read on demand
const FiffInfo& info = raw.info; // channels, sampling rate, bads, projectors, digitizer, transforms
const FiffChInfo& first = info.chs[0];
const RowVectorXi megPicks = info.pick_types(true, false, false, QStringList(), info.bads); // good MEG channels
Public Methods
FiffChInfo()
Constructs the channel info descriptor.
FiffChInfo(p_FiffChInfo)
Copy constructor.
Parameters:
- p_FiffChInfo : const FiffChInfo & Channel Info descriptor 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:
- other : const FiffChInfo & Object to assign from.
Returns:
- FiffChInfo & — reference to this object.
~FiffChInfo()
Destroys the channel info descriptor.
isValidEeg()
Check whether this channel has a valid EEG electrode position.
A channel is a valid EEG channel if its kind is FIFFV_EEG_CH, its electrode position is not at the origin, and its coil type is not FIFFV_COIL_NONE.
Returns:
- bool — true if this is a valid EEG channel with proper electrode location.
Static Methods
storageSize()
Size of the old struct (fiffChInfoRec) 20int + 16 = 204 + 16 = 96.
Returns:
- qint32 — the size of the old struct fiffChInfoRec.
checkEegLocations(chs, nch)
Check that all EEG channels in the list have reasonable (non-origin) locations.
Formerly mne_check_chinfo (MNE C).
Parameters:
-
chs : const QList< FiffChInfo > & The list of channel info structures to check.
-
nch : int The number of channels to check.
Returns:
- bool — true if all EEG channels have valid locations, false otherwise.
Example
- Full source:
src/examples/ex_fiff_api/main.cpp - Build target:
ex_fiff_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_fwd_api
Forward library: coil definitions, BEM and sphere models, field maps and forward solutions.
QFile rawFile(data + "/MEG/sample/sample_audvis_trunc_raw.fif");
const FiffRawData raw(rawFile);
QList<FiffChInfo> meg;
QList<FiffChInfo> goodMeg;
QList<FiffChInfo> eeg;
for (const FiffChInfo& ch : raw.info.chs) {
if (ch.kind == FIFFV_MEG_CH) {
meg << ch;
if (!raw.info.bads.contains(ch.ch_name)) {
goodMeg << ch;
}
} else if (ch.kind == FIFFV_EEG_CH) {
eeg << ch;
}
ex_dsp_maxwell
DSP Maxwell filtering: SSS, bad-channel detection, movement compensation, fine calibration and cHPI removal.
const FiffChInfo& ch = info.chs[meg[k]];
const Vector3d r = ch.chpos.r0.cast<double>() - pos;
const double d = r.norm();
const Vector3d dipole = (3.0 * r * r.dot(moment) / (d * d) - moment) / (d * d * d);
b(k) = ch.chpos.ez.cast<double>().normalized().dot(dipole + uniform);
}
return b;
}
ex_fiff_api
FIFF library: measurement info, channels, digitizer, transforms, projectors, covariance, events,.
QFile rawFile(dir + "/sample_audvis_trunc_raw.fif");
FiffRawData raw(rawFile); // reads the measurement info, raw data is read on demand
const FiffInfo& info = raw.info; // channels, sampling rate, bads, projectors, digitizer, transforms
const FiffChInfo& first = info.chs[0];
const RowVectorXi megPicks = info.pick_types(true, false, false, QStringList(), info.bads); // good MEG channels
// mne.io.read_raw_fif: 376 channels at 300.307 Hz, bads MEG 2443 + EEG 053, 4 projectors
ok &= expect(info.nchan == 376 && near(info.sfreq, 300.3074951171875) && info.bads == QStringList({"MEG2443", "EEG053"}) && info.projs.size() == 4 && megPicks.size() == 305 && raw.first_samp == 12900 && raw.last_samp == 18906,
"FiffInfo: 376 channels at 300.307 Hz, 2 bads, 4 projectors, 305 good MEG channels");
// ch 0: MEG 0113, planar gradiometer 3012 at (-0.1066, 0.0464, -0.0604) m, cal 3.16e-9
ok &= expect(first.ch_name == "MEG0113" && first.kind == FIFFV_MEG_CH && first.chpos.coil_type == FIFFV_COIL_VV_PLANAR_T1 && (first.chpos.r0 - Vector3f(-0.1066f, 0.0464f, -0.0604f)).norm() < 1e-6f && near(first.cal, 3.1600000394149674e-09),
"FiffChInfo/FiffChPos: MEG0113 is a 3012 planar gradiometer at (-0.1066, 0.0464, -0.0604) m");
Also used in ex_interpolation, ex_inv_hpi, ex_dsp_artifacts, ex_dsp_rt.
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>
- Christof Pieloth <pieloth@labp.htwk-leipzig.de>
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Juan GPC <jgarciaprieto@mgh.harvard.edu>
- Gabriel Motta <gabrielbenmotta@gmail.com>