MNE-CPP  beta 1.0
rthpi.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef RTHPI_H
37 #define RTHPI_H
38 
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // INCLUDES
43 //=============================================================================================================
44 
45 #include "rthpi_global.h"
46 
50 
51 
52 //*************************************************************************************************************
53 //=============================================================================================================
54 // FIFF INCLUDES
55 //=============================================================================================================
56 
57 #include <fiff/fiff_info.h>
58 
59 
60 //*************************************************************************************************************
61 //=============================================================================================================
62 // QT INCLUDES
63 //=============================================================================================================
64 
65 #include <QtWidgets>
66 
67 
68 //*************************************************************************************************************
69 //=============================================================================================================
70 // DEFINE NAMESPACE RtHpiPlugin
71 //=============================================================================================================
72 
73 namespace RtHpiPlugin
74 {
75 
76 
77 //*************************************************************************************************************
78 //=============================================================================================================
79 // USED NAMESPACES
80 //=============================================================================================================
81 
82 using namespace MNEX;
83 using namespace XMEASLIB;
84 using namespace IOBuffer;
85 
86 
87 //*************************************************************************************************************
88 //=============================================================================================================
89 // Declare all structures to be used
90 //=============================================================================================================
91 
92 struct coilParam {
93  Eigen::MatrixXd pos;
94  Eigen::MatrixXd mom;
95 };
96 
97 struct dipError {
98  double error;
99  Eigen::MatrixXd moment;
100 };
101 
102 struct sens {
103  Eigen::MatrixXd coilpos;
104  Eigen::MatrixXd coilori;
105  Eigen::MatrixXd tra;
106 };
107 
108 
109 
110 //=============================================================================================================
116 //class DUMMYTOOLBOXSHARED_EXPORT DummyToolbox : public IAlgorithm
118 {
119  Q_OBJECT
120  Q_PLUGIN_METADATA(IID "mne_x/1.0" FILE "rthpi.json") //NEW Qt5 Plugin system replaces Q_EXPORT_PLUGIN2 macro
121  // Use the Q_INTERFACES() macro to tell Qt's meta-object system about the interfaces
122  Q_INTERFACES(MNEX::IAlgorithm)
123 
124 public:
125  //=========================================================================================================
129  RtHpi();
130 
131  //=========================================================================================================
135  ~RtHpi();
136 
137  //=========================================================================================================
141  virtual void init();
142 
143  //=========================================================================================================
147  virtual void unload();
148 
149  //=========================================================================================================
153  virtual QSharedPointer<IPlugin> clone() const;
154 
155  virtual bool start();
156  virtual bool stop();
157 
158  virtual IPlugin::PluginType getType() const;
159  virtual QString getName() const;
160 
161  virtual QWidget* setupWidget();
162 
163  void update(XMEASLIB::NewMeasurement::SPtr pMeasurement);
164 
165  dipError dipfitError (Eigen::MatrixXd, Eigen::MatrixXd, struct sens);
166  Eigen::MatrixXd ft_compute_leadfield(Eigen::MatrixXd, struct sens);
167  Eigen::MatrixXd magnetic_dipole(Eigen::MatrixXd, Eigen::MatrixXd, Eigen::MatrixXd);
168  coilParam dipfit(struct coilParam, struct sens, Eigen::MatrixXd);
169  coilParam fminsearch(Eigen::MatrixXd,int, int, int, Eigen::MatrixXd, struct sens);
170  static bool compar (int, int);
171  Eigen::MatrixXd pinv(Eigen::MatrixXd);
172 
173 signals:
174  //=========================================================================================================
178  void fiffInfoAvailable();
179 
180 protected:
181  virtual void run();
182 
183 private:
184  //=========================================================================================================
188  void initConnector();
189 
194  FiffInfo::SPtr m_pFiffInfo;
196  CircularMatrixBuffer<double>::SPtr m_pRtHpiBuffer;
198  bool m_bIsRunning;
199  bool m_bProcessData;
201  static std::vector <double>base_arr;
202 
203 };
204 
205 } // NAMESPACE
206 
207 #endif // RTHPI_H
Contains declaration of IAlgorithm interface class.
#define RTHPISHARED_EXPORT
Definition: rthpi_global.h:56
CircularMatrixBuffer class declaration.
QSharedPointer< PluginOutputData< T > > SPtr
The circular matrix buffer.
QSharedPointer< FiffInfo > SPtr
Definition: fiff_info.h:99
The RtHpi class provides a RtHpi algorithm structure.
Definition: rthpi.h:117
FiffInfo class declaration.
Contains the RTHPI library export/import macros.
The IAlgorithm class provides an interface for a real-time algorithm plugin.
Definition: IAlgorithm.h:70
QSharedPointer< PluginInputData > SPtr
Definition: arrow.h:75
QSharedPointer< NewMeasurement > SPtr
Contains the declaration of the NewRealTimeMultiSampleArray class.