v2.0.0
Loading...
Searching...
No Matches
rt_filter.h File Reference

Real-time FIR / IIR filtering of streaming MEG / EEG data blocks. More...

#include "../dsp_global.h"
#include "../filterkernel.h"
#include <fiff/fiff_info.h>
#include <fiff/fiff_evoked.h>
#include <QSharedPointer>
#include <QtConcurrent/QtConcurrent>
#include <Eigen/Core>
#include <unsupported/Eigen/FFT>
Include dependency graph for rt_filter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  RTPROCESSINGLIB::FilterObject
 Lightweight filter configuration holding kernel coefficients and overlap-add state for one channel. More...
class  RTPROCESSINGLIB::FilterOverlapAdd
 Applies FIR filtering via FFT-based overlap-add convolution for continuous data streams. More...

Namespaces

namespace  FIFFLIB
 FIFF file I/O, in-memory data structures and high-level readers/writers.
namespace  RTPROCESSINGLIB

Functions

DSPSHARED_EXPORT bool RTPROCESSINGLIB::filterFile (QIODevice &pIODevice, QSharedPointer< FIFFLIB::FiffRawData > pFiffRawData, int type, double dCenterfreq, double dBandwidth, double dTransition, double dSFreq, int iOrder=4096, int designMethod=UTILSLIB::FilterKernel::m_designMethods.indexOf(UTILSLIB::FilterParameter("Cosine")), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true)
DSPSHARED_EXPORT bool RTPROCESSINGLIB::filterFile (QIODevice &pIODevice, QSharedPointer< FIFFLIB::FiffRawData > pFiffRawData, const UTILSLIB::FilterKernel &filterKernel, const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=false)
DSPSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterData (const Eigen::MatrixXd &matData, int type, double dCenterfreq, double dBandwidth, double dTransition, double dSFreq, int iOrder=1024, int designMethod=UTILSLIB::FilterKernel::m_designMethods.indexOf(UTILSLIB::FilterParameter("Cosine")), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true, bool bKeepOverhead=false)
DSPSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterData (const Eigen::MatrixXd &matData, const UTILSLIB::FilterKernel &filterKernel, const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true, bool bKeepOverhead=false)
DSPSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterDataBlock (const Eigen::MatrixXd &matData, const Eigen::RowVectorXi &vecPicks, const UTILSLIB::FilterKernel &filterKernel, bool bUseThreads=true)
DSPSHARED_EXPORT void RTPROCESSINGLIB::filterChannel (FilterObject &channelDataTime)
DSPSHARED_EXPORT FIFFLIB::FiffEvoked RTPROCESSINGLIB::computeFilteredAverage (const FIFFLIB::FiffRawData &raw, const Eigen::MatrixXi &matEvents, float fTMinS, float fTMaxS, qint32 eventType, bool bApplyBaseline, float fTBaselineFromS, float fTBaselineToS, const QMap< QString, double > &mapReject, const UTILSLIB::FilterKernel &filterKernel, const QStringList &lExcludeChs=QStringList(), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi())

Detailed Description

Real-time FIR / IIR filtering of streaming MEG / EEG data blocks.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.1.0
Date
March 2026

The functions in this header wrap UTILSLIB::FilterKernel and the design back-ends so an incoming raw data file or live data block can be low-pass, high-pass, band-pass or notch-filtered in place with a single call. filterFile streams a FIFFLIB::FiffRawData source through a user-designed kernel and writes the filtered output to an arbitrary QIODevice, optionally parallelising the per-channel overlap-add work with Qt Concurrent.

The companion FilterObject struct bundles the FIR coefficients with the per-channel iRow and a contiguous vecData buffer so independent channels can be filtered in parallel without sharing mutable state. All cutoff and transition values are specified in Hz — normalisation against the sampling rate happens inside the design call.

Definition in file rt_filter.h.