MNE-CPP  beta 1.0
averaging.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef AVERAGING_H
37 #define AVERAGING_H
38 
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // INCLUDES
43 //=============================================================================================================
44 
45 #include "averaging_global.h"
46 
50 #include <xMeas/realtimeevoked.h>
51 #include <rtInv/rtave.h>
52 
53 
54 //*************************************************************************************************************
55 //=============================================================================================================
56 // FIFF INCLUDES
57 //=============================================================================================================
58 
59 #include <fiff/fiff_info.h>
60 #include <fiff/fiff_evoked.h>
61 
62 
63 //*************************************************************************************************************
64 //=============================================================================================================
65 // QT INCLUDES
66 //=============================================================================================================
67 
68 #include <QtWidgets>
69 #include <QSpinBox>
70 
71 //#define DEBUG_AVERAGING
72 
73 
74 //*************************************************************************************************************
75 //=============================================================================================================
76 // DEFINE NAMESPACE AveragingPlugin
77 //=============================================================================================================
78 
79 namespace AveragingPlugin
80 {
81 
82 
83 //*************************************************************************************************************
84 //=============================================================================================================
85 // USED NAMESPACES
86 //=============================================================================================================
87 
88 using namespace MNEX;
89 using namespace XMEASLIB;
90 using namespace IOBuffer;
91 using namespace FIFFLIB;
92 using namespace RTINVLIB;
93 
94 
95 //*************************************************************************************************************
96 //=============================================================================================================
97 // FORWARD DECLARATIONS
98 //=============================================================================================================
99 
100 class AveragingSettingsWidget;
101 
102 
103 //=============================================================================================================
110 {
111  Q_OBJECT
112  Q_PLUGIN_METADATA(IID "mne_x/1.0" FILE "averaging.json") //NEw Qt5 Plugin system replaces Q_EXPORT_PLUGIN2 macro
113  // Use the Q_INTERFACES() macro to tell Qt's meta-object system about the interfaces
114  Q_INTERFACES(MNEX::IAlgorithm)
115 
116  friend class AveragingSettingsWidget;
117 
118 public:
119  //=========================================================================================================
123  Averaging();
124 
125  //=========================================================================================================
129  ~Averaging();
130 
131  //=========================================================================================================
135  virtual void init();
136 
137  //=========================================================================================================
141  virtual void unload();
142 
143  //=========================================================================================================
149  void changeNumAverages(qint32 numAve);
150 
151  //=========================================================================================================
155  virtual QSharedPointer<IPlugin> clone() const;
156 
157  virtual bool start();
158  virtual bool stop();
159 
160  virtual IPlugin::PluginType getType() const;
161  virtual QString getName() const;
162 
163 
164  void changeStimChannel(qint32 index);
165 
166  void changePreStim(qint32 samples);
167 
168  void changePostStim(qint32 samples);
169 
170  void appendEvoked(FiffEvoked::SPtr p_pEvoked);
171 
172  virtual QWidget* setupWidget();
173 
174  void update(XMEASLIB::NewMeasurement::SPtr pMeasurement);
175 
176  void showAveragingWidget();
177 
178 signals:
179  //=========================================================================================================
183  void fiffInfoAvailable();
184 
185 protected:
186  virtual void run();
187 
188 private:
189  //=========================================================================================================
193  void initConnector();
194 
195  QMutex m_qMutex;
198  PluginOutputData<RealTimeEvoked>::SPtr m_pAveragingOutput;
200  FiffInfo::SPtr m_pFiffInfo;
201  QList<qint32> m_qListStimChs;
203  CircularMatrixBuffer<double>::SPtr m_pAveragingBuffer;
205  bool m_bIsRunning;
206  bool m_bProcessData;
208  RtAve::SPtr m_pRtAve;
210  qint32 m_iPreStimSamples;
211  qint32 m_iPostStimSamples;
212 
213  qint32 m_iNumAverages;
214 
215  qint32 m_iStimChan;
216 
217  QVector<FiffEvoked::SPtr> m_qVecEvokedData;
219  QSharedPointer<AveragingSettingsWidget> m_pAveragingWidget;
220 
221  QAction* m_pActionShowAdjustment;
222 
223 
224 #ifdef DEBUG_AVERAGING
225  //
226  // TEST
227  //
228  qint32 m_iTestStimCh;
229  qint32 m_iTestCount;
230  qint32 m_iTestCount2;
231 #endif
232 };
233 
234 } // NAMESPACE
235 
236 #endif // AVERAGING_H
Contains the Averaging library export/import macros.
Contains declaration of IAlgorithm interface class.
CircularMatrixBuffer class declaration.
The Averaging class provides a Averaging algorithm structure.
Definition: averaging.h:109
QSharedPointer< PluginOutputData< T > > SPtr
The circular matrix buffer.
QSharedPointer< FiffInfo > SPtr
Definition: fiff_info.h:99
FiffInfo class declaration.
Contains the declaration of the RealTimeEvoked class.
The IAlgorithm class provides an interface for a real-time algorithm plugin.
Definition: IAlgorithm.h:70
QSharedPointer< PluginInputData > SPtr
RtAve class declaration.
QSharedPointer< FiffEvoked > SPtr
Definition: fiff_evoked.h:94
Definition: arrow.h:75
#define AVERAGINGSHARED_EXPORT
Definition: fiff.h:98
QSharedPointer< NewMeasurement > SPtr
Contains the declaration of the NewRealTimeMultiSampleArray class.
Definition: rtave.h:89
QSharedPointer< RtAve > SPtr
Definition: rtave.h:113