MNE-CPP  0.1.9
A Framework for Electrophysiology
Classes | Functions
filter.h File Reference

Filter declarations. More...

#include "rtprocessing_global.h"
#include "helpers/filterkernel.h"
#include <fiff/fiff_info.h>
#include <QSharedPointer>
#include <QtConcurrent/QtConcurrent>
#include <Eigen/Core>
#include <unsupported/Eigen/FFT>
Include dependency graph for 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
 
class  RTPROCESSINGLIB::FilterOverlapAdd
 Filtering with FFT convolution and the overlap add method for continous data streams. More...
 

Functions

RTPROCESINGSHARED_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=FilterKernel::m_designMethods.indexOf(FilterParameter("Cosine")), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true)
 
RTPROCESINGSHARED_EXPORT bool RTPROCESSINGLIB::filterFile (QIODevice &pIODevice, QSharedPointer< FIFFLIB::FiffRawData > pFiffRawData, const RTPROCESSINGLIB::FilterKernel &filterKernel, const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=false)
 
RTPROCESINGSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterData (const Eigen::MatrixXd &matData, int type, double dCenterfreq, double dBandwidth, double dTransition, double dSFreq, int iOrder=1024, int designMethod=FilterKernel::m_designMethods.indexOf(FilterParameter("Cosine")), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true, bool bKeepOverhead=false)
 
RTPROCESINGSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterData (const Eigen::MatrixXd &mataData, const RTPROCESSINGLIB::FilterKernel &filterKernel, const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true, bool bKeepOverhead=false)
 
RTPROCESINGSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterDataBlock (const Eigen::MatrixXd &mataData, const Eigen::RowVectorXi &vecPicks, const RTPROCESSINGLIB::FilterKernel &filterKernel, bool bUseThreads=true)
 
RTPROCESINGSHARED_EXPORT void RTPROCESSINGLIB::filterChannel (FilterObject &channelDataTime)
 

Detailed Description

Filter declarations.

Author
Ruben Doerfel Ruben.nosp@m..Doe.nosp@m.rfel@.nosp@m.tu-i.nosp@m.lmena.nosp@m.u.de; Lorenz Esch lesch.nosp@m.@mgh.nosp@m..harv.nosp@m.ard..nosp@m.edu
Since
0.1.3
Date
June, 2020

LICENSE

Copyright (C) 2020, Ruben Doerfel, Lorenz Esch. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file filter.h.

Function Documentation

◆ filterChannel()

void RTPROCESSINGLIB::filterChannel ( RTPROCESSINGLIB::FilterObject channelDataTime)

This function is used to filter row-wise in parallel threads

Parameters
[in]channelDataTimeThe channel data to perform the filtering on.

Definition at line 376 of file filter.cpp.

◆ filterData() [1/2]

RTPROCESINGSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterData ( const Eigen::MatrixXd &  mataData,
const RTPROCESSINGLIB::FilterKernel filterKernel,
const Eigen::RowVectorXi &  vecPicks = Eigen::RowVectorXi(),
bool  bUseThreads = true,
bool  bKeepOverhead = false 
)

Calculates the filtered version of the raw input data based on a given list filters The data needs to be present all at once. For continous filtering via overlap add use the FilterOverlapAdd class.

Parameters
[in]mataDataThe data which is to be filtered.
[in]filterKernelThe list of filter kernels to use.
[in]vecPicksChannel indexes to filter. Default is filter all channels.
[in]bUseThreadsWhether to use multiple threads. Default is set to true.
[in]bKeepOverheadWhether to keep the delayed part of the data after filtering. Default is set to false .
Returns
The filtered data in form of a matrix.

◆ filterData() [2/2]

RTPROCESINGSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterData ( const Eigen::MatrixXd &  matData,
int  type,
double  dCenterfreq,
double  dBandwidth,
double  dTransition,
double  dSFreq,
int  iOrder = 1024,
int  designMethod = FilterKernel::m_designMethods.indexOf(FilterParameter("Cosine")),
const Eigen::RowVectorXi &  vecPicks = Eigen::RowVectorXi(),
bool  bUseThreads = true,
bool  bKeepOverhead = false 
)

Creates a user designed filter kernel and filters the raw input data. The data needs to be present all at once. For continous filtering via overlap add use the FilterOverlapAdd class.

Parameters
[in]matDataThe data which is to be filtered.
[in]typeThe type of the filter: LPF, HPF, BPF, NOTCH (from enum FilterType).
[in]dCenterfreqThe center of the frequency.
[in]dBandwidthThe filter bandwidth. Ignored if FilterType is set to LPF,HPF. If NOTCH/BPF: bandwidth of stop-/passband.
[in]dTransitionThe transistion band determines the width of the filter slopes (steepness).
[in]dSFreqThe input data sampling frequency.
[in]iOrderRepresents the order of the filter, the higher the higher is the stopband attenuation. Default is 1024 taps.
[in]designMethodThe design method to use. Choose between Cosine and Tschebyscheff. Defaul is set to Cosine.
[in]vecPicksChannel indexes to filter. Default is filter all channels.
[in]bUseThreadsWhether to use multiple threads. Default is set to true.
[in]bKeepOverheadWhether to keep the delayed part of the data after filtering. Default is set to false .
Returns
The filtered data in form of a matrix.

◆ filterDataBlock()

RTPROCESINGSHARED_EXPORT Eigen::MatrixXd RTPROCESSINGLIB::filterDataBlock ( const Eigen::MatrixXd &  mataData,
const Eigen::RowVectorXi &  vecPicks,
const RTPROCESSINGLIB::FilterKernel filterKernel,
bool  bUseThreads = true 
)

Calculates the filtered version of the raw input data block. Always returns the data with half the filter length delay in the front and back.

Parameters
[in]mataDataThe data which is to be filtered.
[in]vecPicksThe used channel as index in RowVector.
[in]filterKernelThe FilterKernel to to filter the data with.
[in]bUseThreadsWhether to use multiple threads.
Returns
The filtered data in form of a matrix with half the filter length delay in the front and back.

◆ filterFile() [1/2]

RTPROCESINGSHARED_EXPORT bool RTPROCESSINGLIB::filterFile ( QIODevice &  pIODevice,
QSharedPointer< FIFFLIB::FiffRawData pFiffRawData,
const RTPROCESSINGLIB::FilterKernel filterKernel,
const Eigen::RowVectorXi &  vecPicks = Eigen::RowVectorXi(),
bool  bUseThreads = false 
)

Filters data from an input file based on an exisiting filter kernel and writes the filtered data to a pIODevice.

Parameters
[in]pIODeviceThe IO device to write to.
[in]pFiffRawDataThe fiff raw data object to read from.
[in]filterKernelThe list of filter kernels to use.
[in]vecPicksChannel indexes to filter. Default is filter all channels.
[in]bUseThreadshether to use multiple threads. Default is set to true.
Returns
Returns true if successfull, false otherwise.

◆ filterFile() [2/2]

RTPROCESINGSHARED_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 = FilterKernel::m_designMethods.indexOf(FilterParameter("Cosine")),
const Eigen::RowVectorXi &  vecPicks = Eigen::RowVectorXi(),
bool  bUseThreads = true 
)

Creates a user designed filter kernel, filters data from an input file and writes the filtered data to a pIODevice.

Parameters
[in]pIODeviceThe IO device to write to.
[in]pFiffRawDataThe fiff raw data object to read from.
[in]typeThe type of the filter: LPF, HPF, BPF, NOTCH (from enum FilterType).
[in]dCenterfreqThe center of the frequency.
[in]dBandwidthThe filter bandwidth. Ignored if FilterType is set to LPF,HPF. If NOTCH/BPF: bandwidth of stop-/passband.
[in]dTransitionThe transistion band determines the width of the filter slopes (steepness).
[in]dSFreqThe input data sampling frequency.
[in]iOrderRepresents the order of the filter, the higher the higher is the stopband attenuation. Default is 4096 taps.
[in]designMethodThe design method to use. Choose between Cosine and Tschebyscheff. Defaul is set to Cosine.
[in]vecPicksChannel indexes to filter. Default is filter all channels.
[in]bUseThreadshether to use multiple threads. Default is set to true.
Returns
Returns true if successfull, false otherwise.