v2.0.0
Loading...
Searching...
No Matches
MNELIB::MNECTFCompDataSet Class Reference

Collection of CTF third-order gradient compensation operators. More...

#include <mne_ctf_comp_data_set.h>

Public Types

typedef QSharedPointer< MNECTFCompDataSetSPtr
typedef QSharedPointer< const MNECTFCompDataSetConstSPtr

Public Member Functions

 MNECTFCompDataSet ()
 MNECTFCompDataSet (const MNECTFCompDataSet &set)
 ~MNECTFCompDataSet ()
int make_comp (const QList< FIFFLIB::FiffChInfo > &chs, int nch, QList< FIFFLIB::FiffChInfo > compchs, int ncomp)
int apply (int do_it, Eigen::VectorXf &data, const Eigen::VectorXf &compdata)
int apply (int do_it, Eigen::VectorXf &data)
int apply_transpose (int do_it, Eigen::MatrixXf &data)
int set_compensation (int compensate_to, QList< FIFFLIB::FiffChInfo > &chs, int nchan, QList< FIFFLIB::FiffChInfo > comp_chs, int ncomp_chan)

Static Public Member Functions

static std::unique_ptr< MNECTFCompDataSetread (const QString &name)
static int set_comp (QList< FIFFLIB::FiffChInfo > &chs, int nch, int comp)
static int get_comp (const QList< FIFFLIB::FiffChInfo > &chs, int nch)
static int map_comp_kind (int grad)
static QString explain_comp (int kind)

Public Attributes

QList< MNECTFCompData * > comps
int ncomp
QList< FIFFLIB::FiffChInfochs
int nch
std::unique_ptr< MNECTFCompDataundo
std::unique_ptr< MNECTFCompDatacurrent

Detailed Description

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.

Definition at line 89 of file mne_ctf_comp_data_set.h.

Member Typedef Documentation

◆ ConstSPtr

Const shared pointer type for MNECTFCompDataSet.

Definition at line 93 of file mne_ctf_comp_data_set.h.

◆ SPtr

Shared pointer type for MNECTFCompDataSet.

Definition at line 92 of file mne_ctf_comp_data_set.h.

Constructor & Destructor Documentation

◆ MNECTFCompDataSet() [1/2]

MNECTFCompDataSet::MNECTFCompDataSet ( )

Construct an empty compensation data set.

Definition at line 426 of file mne_ctf_comp_data_set.cpp.

◆ MNECTFCompDataSet() [2/2]

MNECTFCompDataSet::MNECTFCompDataSet ( const MNECTFCompDataSet & set)

Copy constructor. Deep-copies all compensation data and the current operator.

Parameters
[in]setThe compensation data set to copy.

Definition at line 436 of file mne_ctf_comp_data_set.cpp.

◆ ~MNECTFCompDataSet()

MNECTFCompDataSet::~MNECTFCompDataSet ( )

Destructor.

Definition at line 451 of file mne_ctf_comp_data_set.cpp.

Member Function Documentation

◆ apply() [1/2]

int MNECTFCompDataSet::apply ( int do_it,
Eigen::VectorXf & data )

Overload: apply compensation using the data vector itself as compensation input.

Parameters
[in]do_itIf TRUE, subtract compensated component; if FALSE, add it back.
[in,out]dataData vector to process (also used as compensation input).
Returns
OK on success, FAIL on error.

Definition at line 745 of file mne_ctf_comp_data_set.cpp.

◆ apply() [2/2]

int MNECTFCompDataSet::apply ( int do_it,
Eigen::VectorXf & data,
const Eigen::VectorXf & compdata )

Apply or revert CTF compensation on a single-sample data vector using the current compensation operator.

Parameters
[in]do_itIf TRUE, subtract compensated component; if FALSE, add it back.
[in,out]dataData vector to process.
[in]compdataCompensation channel data (may equal data when omitted).
Returns
OK on success, FAIL on error.

Definition at line 752 of file mne_ctf_comp_data_set.cpp.

◆ apply_transpose()

int MNECTFCompDataSet::apply_transpose ( int do_it,
Eigen::MatrixXf & data )

Apply or revert CTF compensation across multiple time samples (channels x samples matrix), the transposed equivalent of apply().

Parameters
[in]do_itIf TRUE, apply compensation; if FALSE, revert.
[in,out]dataChannel-by-sample data matrix (rows = channels, cols = samples).
Returns
OK on success, FAIL on error.

Definition at line 840 of file mne_ctf_comp_data_set.cpp.

◆ explain_comp()

QString MNECTFCompDataSet::explain_comp ( int kind)
static

Return a human-readable description string for a compensation kind constant.

Parameters
[in]kindCompensation kind constant.
Returns
A string describing the compensation (e.g. "third order gradiometer").

Definition at line 993 of file mne_ctf_comp_data_set.cpp.

◆ get_comp()

int MNECTFCompDataSet::get_comp ( const QList< FIFFLIB::FiffChInfo > & chs,
int nch )
static

Extract the compensation grade from MEG channel coil types.

Parameters
[in]chsChannel information list.
[in]nchNumber of channels.
Returns
The uniform compensation grade, or FAIL if channels have inconsistent compensation.

Definition at line 954 of file mne_ctf_comp_data_set.cpp.

◆ make_comp()

int MNECTFCompDataSet::make_comp ( const QList< FIFFLIB::FiffChInfo > & chs,
int nch,
QList< FIFFLIB::FiffChInfo > compchs,
int 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
[in]chsChannels to compensate (may include non-MEG channels).
[in]nchNumber of channels.
[in]compchsCompensation input channels (may include non-reference channels).
[in]ncompNumber of compensation input channels.
Returns
OK on success, FAIL on error.

Definition at line 579 of file mne_ctf_comp_data_set.cpp.

◆ map_comp_kind()

int MNECTFCompDataSet::map_comp_kind ( int grad)
static

Map a gradient compensation integer code to the corresponding CTF compensation constant.

Parameters
[in]gradSimple integer order (0, 1, 2, 3, ...).
Returns
The mapped CTF compensation constant, or the input if no mapping exists.

Definition at line 978 of file mne_ctf_comp_data_set.cpp.

◆ read()

std::unique_ptr< MNECTFCompDataSet > MNECTFCompDataSet::read ( const QString & name)
static

Read all CTF compensation data sets (matrices and channel info) from a FIFF file, calibrate them, and return a populated set.

Parameters
[in]namePath to the FIFF file.
Returns
A new compensation data set, or nullptr on failure.

Definition at line 461 of file mne_ctf_comp_data_set.cpp.

◆ set_comp()

int MNECTFCompDataSet::set_comp ( QList< FIFFLIB::FiffChInfo > & chs,
int nch,
int comp )
static

Write the compensation grade into the upper 16 bits of coil_type for all MEG channels in the list.

Parameters
[in,out]chsChannel information list.
[in]nchNumber of channels.
[in]compCompensation grade to set.
Returns
Number of channels modified.

Definition at line 723 of file mne_ctf_comp_data_set.cpp.

◆ set_compensation()

int MNECTFCompDataSet::set_compensation ( int compensate_to,
QList< FIFFLIB::FiffChInfo > & chs,
int nchan,
QList< FIFFLIB::FiffChInfo > comp_chs,
int ncomp_chan )

Configure the full compensation pipeline: determine current compensation, build undo and target operators, and update channel coil types accordingly.

Parameters
[in]compensate_toDesired compensation grade.
[in,out]chsChannels to compensate (coil_type is updated).
[in]nchanNumber of channels.
[in]comp_chsCompensation input channels.
[in]ncomp_chanNumber of compensation input channels.
Returns
OK on success, FAIL on error.

Definition at line 1014 of file mne_ctf_comp_data_set.cpp.

Member Data Documentation

◆ chs

QList<FIFFLIB::FiffChInfo> MNELIB::MNECTFCompDataSet::chs

Channel information associated with compensation.

Definition at line 254 of file mne_ctf_comp_data_set.h.

◆ comps

QList<MNECTFCompData*> MNELIB::MNECTFCompDataSet::comps

All available compensation data sets.

Definition at line 252 of file mne_ctf_comp_data_set.h.

◆ current

std::unique_ptr<MNECTFCompData> MNELIB::MNECTFCompDataSet::current

Compiled compensation operator for the current target grade.

Definition at line 257 of file mne_ctf_comp_data_set.h.

◆ nch

int MNELIB::MNECTFCompDataSet::nch

Number of channels.

Definition at line 255 of file mne_ctf_comp_data_set.h.

◆ ncomp

int MNELIB::MNECTFCompDataSet::ncomp

Number of compensation data sets.

Definition at line 253 of file mne_ctf_comp_data_set.h.

◆ undo

std::unique_ptr<MNECTFCompData> MNELIB::MNECTFCompDataSet::undo

Compensation data to undo the current state.

Definition at line 256 of file mne_ctf_comp_data_set.h.


The documentation for this class was generated from the following files: