MaxwellMovementComp
Namespace: RTPROCESSINGLIB · Library: DSP Library
mne.preprocessing.maxwell_filter (head_pos) in MNE-Python.
#include <dsp/maxwell_movement_comp.h>
class UTILSLIB::MaxwellMovementComp
Maxwell movement compensation using SSS.
QList<HeadPosEntry> headPos(1); // one position from t = 0: identity rotation, no translation
MaxwellMoveCompParams moveParams;
moveParams.origin = params.origin;
const MatrixXd compensated = MaxwellMovementComp::apply(data, info, headPos, 1.0, moveParams);
QTemporaryDir dir;
const QString posPath = dir.filePath("head.pos"); // same columns as mne.chpi.write_head_pos
const bool posWritten = MaxwellMovementComp::writeHeadPos(posPath, headPos);
const QList<HeadPosEntry> posBack = MaxwellMovementComp::readHeadPos(posPath);
Static Methods
apply(matData, fiffInfo, headPos, dSFreq, params)
Apply movement compensation via SSS.
For each time segment (defined by headPos entries), the data is:
Projected into SSS multipole space using the actual head position.
Reconstructed at the reference head position.
Parameters:
-
matData : const Eigen::MatrixXd & Full sensor data (n_channels × n_samples).
-
fiffInfo : const FiffInfo & Measurement info (channel positions, etc.).
-
headPos : const QList< HeadPosEntry > & Head positions over time (from cHPI).
-
dSFreq : double Sampling frequency (Hz).
-
params : const MaxwellMoveCompParams & Compensation parameters.
Returns:
- Eigen::MatrixXd — Movement-compensated data (n_channels × n_samples).
readHeadPos(sPath)
Read head positions from a file.
File format: whitespace-separated columns per line: time q1 q2 q3 tx ty tz gof
Parameters:
- sPath : const QString & Path to head position file.
Returns:
- QList< HeadPosEntry > — List of head position entries.
writeHeadPos(sPath, headPos)
Write head positions to a file.
Parameters:
-
sPath : const QString & Output file path.
-
headPos : const QList< HeadPosEntry > & Head positions to write.
Returns:
- bool — true if successful.
Example
- Full source:
src/examples/ex_dsp_maxwell/main.cpp - Build target:
ex_dsp_maxwell(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_dsp_maxwell
DSP Maxwell filtering: SSS, bad-channel detection, movement compensation, fine calibration and cHPI removal.
QList<HeadPosEntry> headPos(1); // one position from t = 0: identity rotation, no translation
MaxwellMoveCompParams moveParams;
moveParams.origin = params.origin;
const MatrixXd compensated = MaxwellMovementComp::apply(data, info, headPos, 1.0, moveParams);
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>