MNE-CPP  beta 1.0
realtimemultisamplearraymodel.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef REALTIMEMULTISAMPLEARRAYMODEL_H
37 #define REALTIMEMULTISAMPLEARRAYMODEL_H
38 
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // INCLUDES
43 //=============================================================================================================
44 
46 #include <fiff/fiff_types.h>
47 #include <fiff/fiff_info.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 #include <Eigen/SparseCore>
65 
66 
67 //*************************************************************************************************************
68 //=============================================================================================================
69 // DEFINE NAMESPACE XDISPLIB
70 //=============================================================================================================
71 
72 namespace XDISPLIB
73 {
74 
75 
76 //*************************************************************************************************************
77 //=============================================================================================================
78 // USED NAMESPACES
79 //=============================================================================================================
80 
81 using namespace XMEASLIB;
82 using namespace FIFFLIB;
83 using namespace Eigen;
84 
85 
86 //=============================================================================================================
92 class RealTimeMultiSampleArrayModel : public QAbstractTableModel
93 {
94  Q_OBJECT
95 public:
96 
97  //=========================================================================================================
103  RealTimeMultiSampleArrayModel(QObject *parent = 0);
104 
105  //=========================================================================================================
113  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const ;
114 
115  //=========================================================================================================
123  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
124 
125  //=========================================================================================================
134  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
135 
136  //=========================================================================================================
146  virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
147 
148  //=========================================================================================================
154  void setChannelInfo(QList<RealTimeSampleArrayChInfo> &chInfo);
155 
156  //=========================================================================================================
162  void setFiffInfo(FIFFLIB::FiffInfo::SPtr& p_pFiffInfo);
163 
164  //=========================================================================================================
172  void setSamplingInfo(float sps, int T, float dest_sps = 128.0f);
173 
174  //=========================================================================================================
180  void addData(const QList<MatrixXd> &data);
181 
182  //=========================================================================================================
190  fiff_int_t getKind(qint32 row) const;
191 
192  //=========================================================================================================
200  fiff_int_t getUnit(qint32 row) const;
201 
202  //=========================================================================================================
210  fiff_int_t getCoil(qint32 row) const;
211 
212  //=========================================================================================================
218  inline qint32 getMaxSamples() const;
219 
220  //=========================================================================================================
226  inline const QMap<qint32,qint32>& getIdxSelMap() const;
227 
228  //=========================================================================================================
234  void selectRows(const QList<qint32> &selection);
235 
236  //=========================================================================================================
240  void resetSelection();
241 
242  //=========================================================================================================
248  inline qint32 numVLines() const;
249 
250  //=========================================================================================================
256  void toggleFreeze(const QModelIndex &index);
257 
258  //=========================================================================================================
264  inline bool isFreezed() const;
265 
266  //=========================================================================================================
272  inline const QMap< qint32,float >& getScaling() const;
273 
274  //=========================================================================================================
280  void setScaling(const QMap< qint32,float >& p_qMapChScaling);
281 
282  //=========================================================================================================
286  void updateProjection();
287 
288 signals:
289  //=========================================================================================================
295  void newSelection(QList<qint32> selection);
296 
297 private:
298  QList<RealTimeSampleArrayChInfo> m_qListChInfo;
299  FiffInfo::SPtr m_pFiffInfo;
300  RowVectorXi m_vecBadIdcs;
301  MatrixXd m_matProj;
302  SparseMatrix<double> m_matSparseProj;
303  bool m_bProjActivated;
305  QMap<qint32,qint32> m_qMapIdxRowSelection;
307  //Fiff data structure
308  QVector<VectorXd> m_dataCurrent;
309  QVector<VectorXd> m_dataLast;
311  QVector<VectorXd> m_dataCurrentFreeze;
312  QVector<VectorXd> m_dataLastFreeze;
314  float m_fSps;
315  qint32 m_iT;
316  qint32 m_iDownsampling;
317  qint32 m_iMaxSamples;
318  qint32 m_iCurrentSample;
320  bool m_bIsFreezed;
322  QMap< qint32,float > m_qMapChScaling;
323 };
324 
325 
326 //*************************************************************************************************************
327 //=============================================================================================================
328 // INLINE DEFINITIONS
329 //=============================================================================================================
330 
332 {
333  return m_iMaxSamples;
334 }
335 
336 
337 //*************************************************************************************************************
338 
339 inline const QMap<qint32,qint32>& RealTimeMultiSampleArrayModel::getIdxSelMap() const
340 {
341  return m_qMapIdxRowSelection;
342 }
343 
344 
345 //*************************************************************************************************************
346 
348 {
349  return (m_iT - 1);
350 }
351 
352 
353 //*************************************************************************************************************
354 
356 {
357  return m_bIsFreezed;
358 }
359 
360 
361 //*************************************************************************************************************
362 
363 inline const QMap< qint32,float >& RealTimeMultiSampleArrayModel::getScaling() const
364 {
365  return m_qMapChScaling;
366 }
367 
368 } // NAMESPACE
369 
370 #endif // REALTIMEMULTISAMPLEARRAYMODEL_H
const QMap< qint32, float > & getScaling() const
Old fiff_type declarations - replace them.
const QMap< qint32, qint32 > & getIdxSelMap() const
The RealTimeMultiSampleArrayModel class implements the data access model for a real-time multi sample...
QSharedPointer< FiffInfo > SPtr
Definition: fiff_info.h:99
Contains the declaration of the RealTimeSampleArrayChInfo class.
FiffInfo class declaration.
Definition: fiff.h:98