MNEMeasData
Namespace: MNELIB · Library: MNE Library
#include <mne/mne_meas_data.h>
class MNELIB::MNEMeasData
Measurement data container for MNE inverse and dipole-fit computations.
Replaces *mneMeasData / mneMeasDataRec from MNE-C mne_types.h. Holds channel information, coordinate transforms, projection operators, and one or more MNEMeasDataSet epochs loaded from a FIFF evoked-response file.
// MNE-C measurement container: data set 1 of the evoked file, MEG and EEG channels, time-major
std::unique_ptr<MNEMeasData> meas(MNEMeasData::mne_read_meas_data(aveFile.fileName(), 1, nullptr, nullptr, {}, 0));
const MNEMeasDataSet& left = *meas->current;
const float meg0113 = left.data(180, 0); // t = 99.9 ms
meas->adjust_baselines(-0.2f, 0.0f);
VectorXf at100ms(meas->nchan);
left.getValuesAtTime(0.1f, 0.0f, meas->nchan, false, at100ms.data()); // linear interpolation between samples
Public Methods
MNEMeasData()
Constructs an empty measurement data container.
Refactored from mne_new_meas_data (mne_read_data.c).
~MNEMeasData()
Destroys the measurement data and all owned data sets.
Refactored from mne_free_meas_data (mne_read_data.c).
adjust_baselines(bmin, bmax)
Adjust baseline offset of the current data set.
Subtracts the mean over [bmin, bmax] from every channel and accumulates the offset in MNEMeasDataSet::baselines.
Refactored from mne_adjust_baselines (mne_apply_baselines.c).
Parameters:
-
bmin : float Baseline window start (seconds).
-
bmax : float Baseline window end (seconds).
Static Methods
mne_read_meas_data_add(name, set, op, fwd, namesp, nnamesp, add_to)
Read an evoked-response data set and append it to an existing container.
The loaded epoch is appended to add_to's set list; its channel list selects the channels read from the file.
Refactored from mne_read_meas_data_add (mne_read_data.c).
Parameters:
-
name : const QString & Path to the FIFF measurement file.
-
set : int 1-based data-set index to load.
-
op : *MNEInverseOperator ** Inverse operator for consistency checks (may be
nullptr). -
fwd : *MNENamedMatrix ** Forward operator for consistency checks (may be
nullptr). -
namesp : const QStringList & Explicit channel name list (fallback if
opandfwdarenullptr). -
nnamesp : int Number of entries in
namesp. -
add_to : MNEMeasData & Existing container to append to.
Returns:
- bool — True if the data set was read and appended.
mne_read_meas_data(name, set, op, fwd, namesp, nnamesp)
Read an evoked-response data set into a new container.
Parameters:
-
name : const QString & Path to the FIFF measurement file.
-
set : int 1-based data-set index to load.
-
op : *MNEInverseOperator ** Inverse operator for consistency checks (may be
nullptr). -
fwd : *MNENamedMatrix ** Forward operator for consistency checks (may be
nullptr). -
namesp : const QStringList & Explicit channel name list.
-
nnamesp : int Number of entries in
namesp.
Returns:
- std::unique_ptr< MNEMeasData > — The new container, or
nullptron failure.
Example
- Full source:
src/examples/ex_mne_api/main.cpp - Build target:
ex_mne_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_mne_api
MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.
// MNE-C measurement container: data set 1 of the evoked file, MEG and EEG channels, time-major
std::unique_ptr<MNEMeasData> meas(MNEMeasData::mne_read_meas_data(aveFile.fileName(), 1, nullptr, nullptr, {}, 0));
const MNEMeasDataSet& left = *meas->current;
const float meg0113 = left.data(180, 0); // t = 99.9 ms
meas->adjust_baselines(-0.2f, 0.0f);
VectorXf at100ms(meas->nchan);
left.getValuesAtTime(0.1f, 0.0f, meas->nchan, false, at100ms.data()); // linear interpolation between samples
// mne.read_evokeds(condition=0, baseline=None, proj=False): 366 MEG/EEG channels, 421 samples from -199.8 ms, nave 55;
// MEG 0113 at sample 180 -4.74022e-12. MNE-C's baseline window stops before the sample at 0 s (120 samples, not mne's 121):
// EEG 001 baseline -9.38499e-06, at 100 ms (interpolated) -1.45063e-06
ok &= expect(meas->nchan == 366 && meas->nbad == 2 && left.np == 421 && left.nave == 55 && left.comment == "Left Auditory" && near(left.tmin, -0.19979521315838786, 1e-6) && near(meg0113, -4.740224134628893e-12, 1e-5) && near(at100ms(306), -1.4506279631761285e-06, 1e-4) && near(left.baselines(306), -9.384992481327106e-06, 1e-5),
"MNEMeasData/MNEMeasDataSet: evoked set, baseline and interpolated values match mne");
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>