MNE-CPP  beta 1.0
frequencyspectrummodel.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef FREQUENCYSPECTRUMMODEL_H
37 #define FREQUENCYSPECTRUMMODEL_H
38 
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // INCLUDES
43 //=============================================================================================================
44 
45 #include <fiff/fiff_types.h>
46 #include <fiff/fiff_info.h>
47 
48 
49 //*************************************************************************************************************
50 //=============================================================================================================
51 // Qt INCLUDES
52 //=============================================================================================================
53 
54 #include <QAbstractTableModel>
55 
56 
57 //*************************************************************************************************************
58 //=============================================================================================================
59 // Eigen INCLUDES
60 //=============================================================================================================
61 
62 #include <Eigen/Core>
63 
64 
65 //*************************************************************************************************************
66 //=============================================================================================================
67 // DEFINE NAMESPACE XDISPLIB
68 //=============================================================================================================
69 
70 namespace XDISPLIB
71 {
72 
73 
74 //*************************************************************************************************************
75 //=============================================================================================================
76 // USED NAMESPACES
77 //=============================================================================================================
78 
79 using namespace FIFFLIB;
80 using namespace Eigen;
81 
82 
83 //=============================================================================================================
89 class FrequencySpectrumModel : public QAbstractTableModel
90 {
91  Q_OBJECT
92 public:
93 
94  //=========================================================================================================
100  FrequencySpectrumModel(QObject *parent = 0);
101 
102  //=========================================================================================================
110  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const ;
111 
112  //=========================================================================================================
120  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
121 
122  //=========================================================================================================
131  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
132 
133  //=========================================================================================================
143  virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
144 
145  //=========================================================================================================
151  void setInfo(FiffInfo::SPtr &info);
152 
153  //=========================================================================================================
159  void setScaleType(qint8 ScaleType);
160 
161  //=========================================================================================================
167  void addData(const MatrixXd &data);
168 
169  //=========================================================================================================
175  inline FiffInfo::SPtr getInfo() const;
176 
177  //=========================================================================================================
183  inline RowVectorXd getFreqScale() const;
184 
185  //=========================================================================================================
191  inline RowVectorXd getFreqScaleBound() const;
192 
193  //=========================================================================================================
199  inline qint32 getNumStems() const;
200 
201  //=========================================================================================================
207  inline const QMap<qint32,qint32>& getIdxSelMap() const;
208 
209  //=========================================================================================================
215  void selectRows(const QList<qint32> &selection);
216 
217  //=========================================================================================================
221  void resetSelection();
222 
223  //=========================================================================================================
229  void toggleFreeze(const QModelIndex &index);
230 
231  //=========================================================================================================
237  inline bool isFreezed() const;
238 
239  //=========================================================================================================
246  void setBoundaries(float fLowerFrqBound, float fUpperFrqBound);
247 
248  //=========================================================================================================
254  inline qint32 getLowerFrqBound() const;
255 
256  //=========================================================================================================
262  inline qint32 getUpperFrqBound() const;
263 
264 signals:
265  //=========================================================================================================
271  void newSelection(QList<qint32> selection);
272 
273 private:
274  FiffInfo::SPtr m_pFiffInfo;
276  QMap<qint32,qint32> m_qMapIdxRowSelection;
278  RowVectorXd m_vecFreqScale;
280  RowVectorXd m_vecFreqScaleBound;
282  //Fiff data structure
283  MatrixXd m_dataCurrent;
285  MatrixXd m_dataCurrentFreeze;
287  float m_fSps;
288  qint32 m_iT;
290  bool m_bIsFreezed;
292  bool m_bInitialized;
294  qint32 m_iLowerFrqIdx;
295  qint32 m_iUpperFrqIdx;
297  qint8 m_iScaleType;
298 
299 };
300 
301 
302 //*************************************************************************************************************
303 //=============================================================================================================
304 // INLINE DEFINITIONS
305 //=============================================================================================================
306 
308 {
309  return m_pFiffInfo;
310 }
311 
312 
313 //*************************************************************************************************************
314 
316 {
317  return m_vecFreqScale;
318 }
319 
320 
321 //*************************************************************************************************************
322 
324 {
325  return m_vecFreqScaleBound;
326 }
327 
328 
329 //*************************************************************************************************************
330 
332 {
333  return m_dataCurrent.cols();
334 }
335 
336 
337 //*************************************************************************************************************
338 
339 inline const QMap<qint32,qint32>& FrequencySpectrumModel::getIdxSelMap() const
340 {
341  return m_qMapIdxRowSelection;
342 }
343 
344 
345 //*************************************************************************************************************
346 
348 {
349  return m_bIsFreezed;
350 }
351 
352 
353 //*************************************************************************************************************
354 
356 {
357  return m_iLowerFrqIdx;
358 }
359 
360 
361 //*************************************************************************************************************
362 
364 {
365  return m_iUpperFrqIdx;
366 }
367 
368 } // NAMESPACE
369 
370 #ifndef metatype_rowvectorxd
371 #define metatype_rowvectorxd
372 Q_DECLARE_METATYPE(Eigen::RowVectorXd);
373 #endif
374 
375 #endif // FREQUENCYSPECTRUMMODEL_H
Old fiff_type declarations - replace them.
const QMap< qint32, qint32 > & getIdxSelMap() const
The FrequencySpectrumModel class implements the data access model for a real-time multi sample array ...
QSharedPointer< FiffInfo > SPtr
Definition: fiff_info.h:99
Q_DECLARE_METATYPE(Eigen::RowVectorXd)
FiffInfo class declaration.
Definition: fiff.h:98