MNE-CPP  beta 1.0
tmsi.h
Go to the documentation of this file.
1 //=============================================================================================================
37 #ifndef TMSI_H
38 #define TMSI_H
39 
40 
41 //*************************************************************************************************************
42 //=============================================================================================================
43 // INCLUDES
44 //=============================================================================================================
45 #include <iostream>
46 #include <fstream>
47 #include <direct.h>
48 
49 #include "tmsi_global.h"
50 
54 
55 #include <utils/layoutloader.h>
56 
57 #include <unsupported/Eigen/FFT>
58 #include <Eigen/Geometry>
59 
60 
61 //*************************************************************************************************************
62 //=============================================================================================================
63 // QT STL INCLUDES
64 //=============================================================================================================
65 
66 #include <QtWidgets>
67 #include <QVector>
68 #include <QTime>
69 #include <QtConcurrent/QtConcurrent>
70 
75 
76 
77 //*************************************************************************************************************
78 //=============================================================================================================
79 // FIFF INCLUDES
80 //=============================================================================================================
81 
82 #include <fiff/fiff.h>
83 
84 
85 //*************************************************************************************************************
86 //=============================================================================================================
87 // DEFINE NAMESPACE TMSIPlugin
88 //=============================================================================================================
89 
90 namespace TMSIPlugin
91 {
92 
93 
94 //*************************************************************************************************************
95 //=============================================================================================================
96 // USED NAMESPACES
97 //=============================================================================================================
98 
99 using namespace MNEX;
100 using namespace XMEASLIB;
101 using namespace IOBuffer;
102 using namespace FIFFLIB;
103 using namespace std;
104 using namespace UTILSLIB;
105 using namespace Eigen;
106 
107 
108 //*************************************************************************************************************
109 //=============================================================================================================
110 // FORWARD DECLARATIONS
111 //=============================================================================================================
112 
113 class TMSIProducer;
114 
115 
116 //=============================================================================================================
123 {
124  Q_OBJECT
125  Q_PLUGIN_METADATA(IID "mne_x/1.0" FILE "tmsi.json") //NEw Qt5 Plugin system replaces Q_EXPORT_PLUGIN2 macro
126  // Use the Q_INTERFACES() macro to tell Qt's meta-object system about the interfaces
127  Q_INTERFACES(MNEX::ISensor)
128 
129  friend class TMSIProducer;
130  friend class TMSISetupWidget;
131  friend class TMSIImpedanceWidget;
132  friend class TMSISetupProjectWidget;
133 
134 public:
135  //=========================================================================================================
139  TMSI();
140 
141  //=========================================================================================================
145  virtual ~TMSI();
146 
147  //=========================================================================================================
151  virtual QSharedPointer<IPlugin> clone() const;
152 
153  //=========================================================================================================
157  virtual void init();
158 
159  //=========================================================================================================
163  virtual void unload();
164 
165  //=========================================================================================================
169  void setUpFiffInfo();
170 
171  //=========================================================================================================
175  virtual bool start();
176 
177  //=========================================================================================================
181  virtual bool stop();
182 
183  virtual IPlugin::PluginType getType() const;
184  virtual QString getName() const;
185 
186  virtual QWidget* setupWidget();
187 
188  void setKeyboardTriggerType(int type);
189 
190 protected:
191  //=========================================================================================================
197  virtual void run();
198 
199  //=========================================================================================================
203  void showImpedanceDialog();
204 
205  //=========================================================================================================
209  void showSetupProjectDialog();
210 
211  //=========================================================================================================
215  void showStartRecording();
216 
217  //=========================================================================================================
221  void changeRecordingButton();
222 
223  //=========================================================================================================
227  bool dirExists(const std::string& dirName_in);
228 
229 private:
231  QSharedPointer<TMSIManualAnnotationWidget> m_tmsiManualAnnotationWidget;
232  QSharedPointer<TMSIImpedanceWidget> m_pTmsiImpedanceWidget;
233  QSharedPointer<TMSISetupProjectWidget> m_pTmsiSetupProjectWidget;
235  QString m_qStringResourcePath;
237  int m_iSamplingFreq;
238  int m_iNumberOfChannels;
239  int m_iSamplesPerBlock;
241  int m_iTriggerInterval;
242  QTime m_qTimerTrigger;
244  bool m_bUseChExponent;
245  bool m_bUseUnitGain;
246  bool m_bUseUnitOffset;
247  bool m_bWriteToFile;
248  bool m_bWriteDriverDebugToFile;
249  bool m_bUseFiltering;
250  bool m_bIsRunning;
251  bool m_bUseFFT;
252  bool m_bBeepTrigger;
253  bool m_bUseCommonAverage;
254  bool m_bUseKeyboardTrigger;
255  bool m_bCheckImpedances;
257  int m_iTriggerType;
259  ofstream m_outputFileStream;
260  QString m_sOutputFilePath;
261  QString m_sElcFilePath;
262  QFile m_fileOut;
263  FiffStream::SPtr m_pOutfid;
264  QSharedPointer<FiffInfo> m_pFiffInfo;
265  RowVectorXd m_cals;
266 
267  QSharedPointer<RawMatrixBuffer> m_pRawMatrixBuffer_In;
269  QSharedPointer<TMSIProducer> m_pTMSIProducer;
271  MatrixXf m_matOldMatrix;
273  QMutex m_qMutex;
275  QAction* m_pActionImpedance;
276  QAction* m_pActionSetupProject;
277  QAction* m_pActionStartRecording;
279  QSharedPointer<QTimer> m_pTimerRecordingChange;
280  qint16 m_iBlinkStatus;
282 };
283 
284 } // NAMESPACE
285 
286 #endif // TMSI_H
The EEGProducer class provides a EEG data producer for a given sampling rate.
Definition: tmsiproducer.h:89
CircularMatrixBuffer class declaration.
The TMSISetupWidget class provides the TMSI configuration window.
QSharedPointer< PluginOutputData< T > > SPtr
The ISensor class provides an interface for a sensor plugin.
Definition: ISensor.h:63
QSharedPointer< FiffStream > SPtr
Definition: fiff_stream.h:132
Contains the declaration of the TMSIManualAnnotation class.
Contains the declaration of the TmsiImpedanceWidget class.
Definition: arrow.h:75
Definition: fiff.h:98
The TMSI class provides a EEG connector. In order for this plugin to work properly the driver dll "RT...
Definition: tmsi.h:122
Contains the declaration of the NewRealTimeMultiSampleArray class.
#define TMSISHARED_EXPORT
Definition: tmsi_global.h:57
LayoutLoader class declaration.
The TMSIImpedanceWidget class provides the TMSIImpedanceWidget configuration window.
FIFF class declaration, which provides static wrapper functions to stay consistent with mne matlab to...
Contains the declaration of the TMSISetupWidget class.
Contains the TMSI library export/import macros.
The TMSISetupProjectWidget class provides the TMSISetupProjectWidget configuration window...
Contains declaration of IIinverseAlgorithm interface class.
Contains the declaration of the TMSISetupProjectWidget class.