MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
rtnoise.h
Go to the documentation of this file.
1//=============================================================================================================
36#ifndef RTNOISE_RTPROCESSING_H
37#define RTNOISE_RTPROCESSING_H
38
39//=============================================================================================================
40// INCLUDES
41//=============================================================================================================
42
43#include "rtprocessing_global.h"
44
45#include <fiff/fiff_cov.h>
46#include <fiff/fiff_info.h>
48
49//=============================================================================================================
50// QT INCLUDES
51//=============================================================================================================
52
53#include <QThread>
54#include <QMutex>
55#include <QSharedPointer>
56#include <QVector>
57
58//=============================================================================================================
59// EIGEN INCLUDES
60//=============================================================================================================
61
62#include <Eigen/Core>
63#include <unsupported/Eigen/FFT>
64
65//=============================================================================================================
66// DEFINE NAMESPACE RTPROCESSINGLIB
67//=============================================================================================================
68
69namespace RTPROCESSINGLIB
70{
71
72//=============================================================================================================
78class RTPROCESINGSHARED_EXPORT RtNoise : public QThread
79{
80 Q_OBJECT
81
82public:
83 typedef QSharedPointer<RtNoise> SPtr;
84 typedef QSharedPointer<const RtNoise> ConstSPtr;
86 //=========================================================================================================
94 explicit RtNoise(qint32 p_iMaxSamples,
95 FIFFLIB::FiffInfo::SPtr p_pFiffInfo,
96 qint32 p_dataLen,
97 QObject *parent = 0);
98
99 //=========================================================================================================
103 ~RtNoise();
104
105 //=========================================================================================================
111 void append(const Eigen::MatrixXd &p_DataSegment);
112
113 //=========================================================================================================
119 inline bool isRunning();
120
121 //=========================================================================================================
127 virtual bool start();
128
129 //=========================================================================================================
135 virtual bool stop();
136
137 QMutex ReadMutex;
138
139 Eigen::MatrixXd m_matSpecData;
140 bool m_bSendDataToBuffer;
141
142protected:
143 //=========================================================================================================
149 virtual void run();
150
151 QVector <float> hanning(int N, short itype);
152
153 int m_iNumOfBlocks;
154 int m_iBlockSize;
155 int m_iSensors;
156 int m_iBlockIndex;
157
158 Eigen::MatrixXd m_matCircBuf;
159
160private:
161 QMutex mutex;
163 FIFFLIB::FiffInfo::SPtr m_pFiffInfo;
165 bool m_bIsRunning;
167 QSharedPointer<UTILSLIB::CircularBuffer_Matrix_double> m_pCircularBuffer;
169 QVector <float> m_fWin;
170
171 double m_Fs;
172
173 qint32 m_iFftLength;
174 qint32 m_dataLength;
175
176signals:
177 //=========================================================================================================
183 void SpecCalculated(Eigen::MatrixXd);
184};
185
186//=============================================================================================================
187// INLINE DEFINITIONS
188//=============================================================================================================
189
191{
192 return m_bIsRunning;
193}
194} // NAMESPACE
195
196#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
197#ifndef metatype_matrix
198#define metatype_matrix
199Q_DECLARE_METATYPE(Eigen::MatrixXd);
200#endif
201#endif
202
203#endif // RTNOISE_RTPROCESSING_H
realtime library export/import macros.
#define RTPROCESINGSHARED_EXPORT
FiffInfo class declaration.
FiffCov class declaration.
CircularBuffer class declaration.
Q_DECLARE_METATYPE(Eigen::MatrixXf)
QSharedPointer< FiffInfo > SPtr
Definition fiff_info.h:87
Real-time Noise estimation.
Definition rtnoise.h:79
QSharedPointer< const RtNoise > ConstSPtr
Definition rtnoise.h:84
void SpecCalculated(Eigen::MatrixXd)
QSharedPointer< RtNoise > SPtr
Definition rtnoise.h:83