InvHpiDataUpdater
Namespace: INVLIB · Library: Inverse Library
#include <inv/inv_hpi_data_updater.h>
class INVLIB::InvHpiDataUpdater
This class brings all the data and objects used for HPI fitting into the right format.
Preprocesses raw HPI coil data (SSP projection, compensation, sinusoidal model fitting) before dipole localization
InvHpiDataUpdater updater(info); // good MEG channels, their sensors and the digitised coil positions
updater.prepareDataAndProjectors(segment, MatrixXd::Identity(info->nchan, info->nchan));
// The coil frequencies are known but not their order; the first fit with bOrderFrequencies finds it.
const InvHpiModelParameters model(QVector<int>({154, 158, 161, 166}), info->sfreq, info->linefreq, true);
InvHpiFit hpi(updater.getSensors());
HpiFitResult fit;
hpi.fit(updater.getProjectedData(), updater.getProjectors(), model, updater.getHpiDigitizer(), true, fit);
Public Methods
InvHpiDataUpdater(pFiffInfo)
Constructs a InvHpiDataUpdater object.
Parameters:
- pFiffInfo : const QSharedPointer<FiffInfo> Measurement info used to initialize channels, bads, HPI digitizer points and sensors.
checkForUpdate(pFiffInfo)
Check if information in FiffInfo changed and update if necessary.
Parameters:
- pFiffInfo : const QSharedPointer<FiffInfo> The FiffInfo to check for changes.
prepareDataAndProjectors(matData, matProjectors)
Reduce data to only use good channels.
Parameters:
-
matData : const Eigen::MatrixXd & Data matrix (channels x samples).
-
matProjectors : const Eigen::MatrixXd & The projector matrix.
getChannels()
inline get functions for private member variables.
Returns:
- const QList< FiffChInfo > & — Const reference to the channel list with bad channels excluded.
getProjectors()
getHpiDigitizer()
getData()
getProjectedData()
getSensors()
Example
- Full source:
src/examples/ex_inv_hpi/main.cpp - Build target:
ex_inv_hpi(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_inv_hpi
Inverse library: continuous head position (HPI) fitting.
InvHpiDataUpdater updater(info); // good MEG channels, their sensors and the digitised coil positions
updater.prepareDataAndProjectors(segment, MatrixXd::Identity(info->nchan, info->nchan));
// The coil frequencies are known but not their order; the first fit with bOrderFrequencies finds it.
const InvHpiModelParameters model(QVector<int>({154, 158, 161, 166}), info->sfreq, info->linefreq, true);
InvHpiFit hpi(updater.getSensors());
HpiFitResult fit;
hpi.fit(updater.getProjectedData(), updater.getProjectors(), model, updater.getHpiDigitizer(), true, fit);
// MaxFilter head position at t = 0: translation (-0.814, -11.046, 53.572) mm. One 200 ms window, so allow 1 mm
// (test_hpiFit_integration holds the mean over the whole recording to 0.3 mm).
MatrixXd maxfilter;
IOUtils::read_eigen_matrix(maxfilter, data + "/Result/ref_hpiFit_pos.txt");
const Vector3d translation = fit.devHeadTrans.trans.block<3, 1>(0, 3).cast<double>();
const Vector3d reference = maxfilter.block<1, 3>(0, 4).transpose();
ex_dsp_rt
DSP real-time workers: averaging, covariance, noise spectrum, connectivity, HPI fitting and inverse operators.
InvHpiDataUpdater updater(hpiInfo); // MEG picks, sensor geometry and digitised coil positions
updater.prepareDataAndProjectors(hpiData, projectors);
const InvHpiModelParameters model(QVector<int>({166, 154, 161, 158}), hpiInfo->sfreq, hpiInfo->linefreq, false);
ex_hpiFit
Example for cHPI fitting on raw data with SSP. The result is written to a .txt file for comparison with MaxFilter's .pos file.
InvHpiDataUpdater hpiDataUpdater = InvHpiDataUpdater(pFiffInfo);
InvHpiFit HPI = InvHpiFit(hpiDataUpdater.getSensors());
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>