MNECTFCompDataSet
Namespace: MNELIB · Library: MNE Library
#include <mne/mne_ctf_comp_data_set.h>
class MNELIB::MNECTFCompDataSet
Collection of CTF third-order gradient compensation operators.
Stores all available compensation data sets read from a FIFF file together with the compiled current/undo operator pair used to switch between compensation grades at runtime.
Public Methods
MNECTFCompDataSet()
Construct an empty compensation data set.
MNECTFCompDataSet(set)
Copy constructor.
Deep-copies all compensation data and the current operator.
Parameters:
- set : const MNECTFCompDataSet & The compensation data set to copy.
~MNECTFCompDataSet()
Destructor.
make_comp(chs, nch, compchs, ncomp)
Build the current compensation operator for the given channel set by locating the matching compensation matrix and constructing pre/post-selection sparse matrices.
Parameters:
-
chs : const QList< FiffChInfo > & Channels to compensate (may include non-MEG channels).
-
nch : int Number of channels.
-
compchs : QList< FiffChInfo > Compensation input channels (may include non-reference channels).
-
ncomp : int Number of compensation input channels.
Returns:
- int — OK on success, FAIL on error.
apply(do_it, data, compdata)
Apply or revert CTF compensation on a single-sample data vector using the current compensation operator.
Parameters:
-
do_it : bool If true, subtract compensated component; if false, add it back.
-
data : Eigen::Ref< Eigen::VectorXf > Data vector to process.
-
compdata : Eigen::Ref< const Eigen::VectorXf > Compensation channel data (may equal data when omitted).
Returns:
- int — OK on success, FAIL on error.
apply(do_it, data)
Overload: apply compensation using the data vector itself as compensation input.
Parameters:
-
do_it : bool If true, subtract compensated component; if false, add it back.
-
data : Eigen::Ref< Eigen::VectorXf > Data vector to process (also used as compensation input).
Returns:
- int — OK on success, FAIL on error.
apply_transpose(do_it, data)
Apply or revert CTF compensation across multiple time samples (channels x samples matrix), the transposed equivalent of apply().
Parameters:
-
do_it : bool If true, apply compensation; if false, revert.
-
data : Eigen::MatrixXf & Channel-by-sample data matrix (rows = channels, cols = samples).
Returns:
- int — OK on success, FAIL on error.
set_compensation(compensate_to, chs, nchan, comp_chs, ncomp_chan)
Configure the full compensation pipeline: determine current compensation, build undo and target operators, and update channel coil types accordingly.
Parameters:
-
compensate_to : int Desired compensation grade.
-
chs : QList< FiffChInfo > & Channels to compensate (coil_type is updated).
-
nchan : int Number of channels.
-
comp_chs : QList< FiffChInfo > Compensation input channels.
-
ncomp_chan : int Number of compensation input channels.
Returns:
- int — OK on success, FAIL on error.
Static Methods
read(name)
Read all CTF compensation data sets (matrices and channel info) from a FIFF file, calibrate them, and return a populated set.
Parameters:
- name : const QString & Path to the FIFF file.
Returns:
- std::unique_ptr< MNECTFCompDataSet > — A new compensation data set, or nullptr on failure.
set_comp(chs, nch, comp)
Write the compensation grade into the upper 16 bits of coil_type for all MEG channels in the list.
Parameters:
-
chs : QList< FiffChInfo > & Channel information list.
-
nch : int Number of channels.
-
comp : int Compensation grade to set.
Returns:
- int — Number of channels modified.
get_comp(chs, nch)
Extract the compensation grade from MEG channel coil types.
Parameters:
-
chs : const QList< FiffChInfo > & Channel information list.
-
nch : int Number of channels.
Returns:
- int — The uniform compensation grade, or FAIL if channels have inconsistent compensation.
map_comp_kind(grad)
Map a gradient compensation integer code to the corresponding CTF compensation constant.
Parameters:
- grad : int Simple integer order (0, 1, 2, 3, ...).
Returns:
- int — The mapped CTF compensation constant, or the input if no mapping exists.
explain_comp(kind)
Return a human-readable description string for a compensation kind constant.
Parameters:
- kind : int Compensation kind constant.
Returns:
- QString — A string describing the compensation (e.g. "third order gradiometer").
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>