Skip to main content

SSS

Namespace: RTPROCESSINGLIB  ·  Library: DSP Library

Python equivalent

mne.preprocessing.maxwell_filter in MNE-Python.

#include <dsp/sss.h>

class UTILSLIB::SSS

Implements Signal Space Separation (SSS) and temporal SSS (tSSS) for MEG data.

src/examples/ex_dsp_maxwell/main.cpp
SSS::Params params; // internal order 8, external order 3
params.origin = Vector3d(0.0, 0.0, 0.04);
const SSS::Basis basis = SSS::computeBasis(info, params); // geometry only, reusable for every buffer
src/examples/ex_dsp_maxwell/main.cpp
const MatrixXd cleaned = SSS::apply(data, basis); // MEG rows replaced by their internal-space reconstruction

SSS::applyTemporal additionally removes near-field artefacts (tSSS).


Static Methods​

computeBasis(fiffInfo, params)​

Build the SSS spherical-harmonic basis from MEG sensor geometry.

Only channels with kind == FIFFV_MEG_CH or FIFFV_REF_MEG_CH are used. Sensor positions and normals are taken from FiffChInfo::chpos (coil-centre single-point model).

Parameters:

  • fiffInfo : const FiffInfo & Measurement info containing channel positions.

  • params : const Params & SSS configuration (order, origin, regularisation).

Returns:

  • Basis — Basis struct containing all projectors needed for SSS and tSSS.

apply(matData, basis)​

Apply SSS to MEG data — suppress external (environmental) interference.

Parameters:

  • matData : const Eigen::MatrixXd & Full sensor data (n_channels × n_samples). Non-MEG channels are passed through unchanged.

  • basis : const Basis & Precomputed basis from computeBasis().

Returns:

  • Eigen::MatrixXd — SSS-cleaned data (n_channels × n_samples).

applyTemporal(matData, basis, iBufferLength, dCorrLimit)​

Apply temporal SSS (tSSS) — additionally suppress near-field artefacts.

tSSS processes the data in sliding windows and removes the temporal subspace of the external expansion that exceeds dCorrLimit (relative to the dominant singular value).

Parameters:

  • matData : const Eigen::MatrixXd & Full sensor data (n_channels × n_samples).

  • basis : const Basis & Precomputed basis from computeBasis().

  • iBufferLength : int Window length in samples (default 10000 ≈ 10 s at 1 kHz).

  • dCorrLimit : double Correlation threshold [0, 1]; singular vectors of the external subspace whose normalised value exceeds this are removed from the internal expansion (default 0.98).

Returns:

  • Eigen::MatrixXd — tSSS-cleaned data (n_channels × n_samples).

Example​

Used in examples​

ex_dsp_maxwell​

DSP Maxwell filtering: SSS, bad-channel detection, movement compensation, fine calibration and cHPI removal.

src/examples/ex_dsp_maxwell/main.cpp, line 112
SSS::Params params; // internal order 8, external order 3
params.origin = Vector3d(0.0, 0.0, 0.04);
const SSS::Basis basis = SSS::computeBasis(info, params); // geometry only, reusable for every buffer
const QVector<int>& meg = basis.megChannelIdx;

Authors of this file​