MNE-CPP  beta 1.0
realtimeevokedmodel.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef REALTIMEEVOKEDMODEL_H
37 #define REALTIMEEVOKEDMODEL_H
38 
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // INCLUDES
43 //=============================================================================================================
44 
46 #include <xMeas/realtimeevoked.h>
47 #include <fiff/fiff_types.h>
48 
49 
50 //*************************************************************************************************************
51 //=============================================================================================================
52 // Qt INCLUDES
53 //=============================================================================================================
54 
55 #include <QAbstractTableModel>
56 
57 
58 //*************************************************************************************************************
59 //=============================================================================================================
60 // Eigen INCLUDES
61 //=============================================================================================================
62 
63 #include <Eigen/Core>
64 
65 
66 //*************************************************************************************************************
67 //=============================================================================================================
68 // DEFINE NAMESPACE XDISPLIB
69 //=============================================================================================================
70 
71 namespace XDISPLIB
72 {
73 
74 
75 //*************************************************************************************************************
76 //=============================================================================================================
77 // USED NAMESPACES
78 //=============================================================================================================
79 
80 using namespace XMEASLIB;
81 using namespace FIFFLIB;
82 using namespace Eigen;
83 
84 
85 //=============================================================================================================
91 class RealTimeEvokedModel : public QAbstractTableModel
92 {
93  Q_OBJECT
94 public:
95 
96  //=========================================================================================================
102  RealTimeEvokedModel(QObject *parent = 0);
103 
104  inline bool isInit() const;
105 
106  inline qint32 getNumSamples() const;
107 
108  //=========================================================================================================
116  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const ;
117 
118  //=========================================================================================================
126  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
127 
128  //=========================================================================================================
138  inline QVariant data(int row, int column, int role = Qt::DisplayRole) const;
139 
140  //=========================================================================================================
149  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
150 
151  //=========================================================================================================
161  virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
162 
163  //=========================================================================================================
169  void setRTE(QSharedPointer<RealTimeEvoked> &pRTE);
170 
171  //=========================================================================================================
175  void updateData();
176 
177  //=========================================================================================================
185  QColor getColor(qint32 row) const;
186 
187  //=========================================================================================================
195  fiff_int_t getKind(qint32 row) const;
196 
197  //=========================================================================================================
205  fiff_int_t getUnit(qint32 row) const;
206 
207  //=========================================================================================================
215  fiff_int_t getCoil(qint32 row) const;
216 
217  //=========================================================================================================
223  inline const QMap<qint32,qint32>& getIdxSelMap() const;
224 
225  //=========================================================================================================
231  inline qint32 getNumPreStimSamples() const;
232 
233  //=========================================================================================================
239  void selectRows(const QList<qint32> &selection);
240 
241  //=========================================================================================================
245  void resetSelection();
246 
247  //=========================================================================================================
253  inline qint32 numVLines() const;
254 
255  //=========================================================================================================
261  void toggleFreeze(const QModelIndex &index);
262 
263  //=========================================================================================================
269  inline bool isFreezed() const;
270 
271 signals:
272  //=========================================================================================================
278  void newSelection(QList<qint32> selection);
279 
280 private:
281  QSharedPointer<RealTimeEvoked> m_pRTE;
283  QMap<qint32,qint32> m_qMapIdxRowSelection;
285  //Fiff data structure
286  MatrixXd m_matData;
287  MatrixXd m_matDataFreeze;
289  bool m_bIsInit;
290 
291  float m_fSps;
293  bool m_bIsFreezed;
294 };
295 
296 
297 //*************************************************************************************************************
298 //=============================================================================================================
299 // INLINE DEFINITIONS
300 //=============================================================================================================
301 
302 
303 inline bool RealTimeEvokedModel::isInit() const
304 {
305  return m_bIsInit;
306 }
307 
308 
309 //*************************************************************************************************************
310 
311 inline qint32 RealTimeEvokedModel::getNumSamples() const
312 {
313  return m_bIsInit ? m_matData.cols() : 0;
314 }
315 
316 
317 //*************************************************************************************************************
318 
319 inline QVariant RealTimeEvokedModel::data(int row, int column, int role) const
320 {
321  return data(index(row, column), role);
322 }
323 
324 
325 //*************************************************************************************************************
326 
327 inline const QMap<qint32,qint32>& RealTimeEvokedModel::getIdxSelMap() const
328 {
329  return m_qMapIdxRowSelection;
330 }
331 
332 
333 //*************************************************************************************************************
334 
335 inline qint32 RealTimeEvokedModel::numVLines() const
336 {
337  return (qint32)(m_matData.cols()/m_fSps) - 1;
338 }
339 
340 
341 //*************************************************************************************************************
342 
344 {
345  return m_pRTE->getNumPreStimSamples();
346 }
347 
348 
349 //*************************************************************************************************************
350 
352 {
353  return m_bIsFreezed;
354 }
355 
356 } // NAMESPACE
357 
358 #ifndef metatype_rowvectorxd
359 #define metatype_rowvectorxd
360 Q_DECLARE_METATYPE(Eigen::RowVectorXd);
361 #endif
362 
363 #endif // REALTIMEEVOKEDMODEL_H
Old fiff_type declarations - replace them.
QVariant data(int row, int column, int role=Qt::DisplayRole) const
const QMap< qint32, qint32 > & getIdxSelMap() const
Contains the declaration of the RealTimeSampleArrayChInfo class.
Contains the declaration of the RealTimeEvoked class.
Q_DECLARE_METATYPE(Eigen::RowVectorXd)
Definition: fiff.h:98
The RealTimeEvokedModel class implements the data access model for a real-time multi sample array dat...