MNE-CPP  beta 1.0
eventmodel.h
Go to the documentation of this file.
1 //=============================================================================================================
37 #ifndef EVEMODEL_H
38 #define EVEMODEL_H
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // INCLUDES
43 //=============================================================================================================
44 
45 #include "../Utils/rawsettings.h"
46 
47 
48 //*************************************************************************************************************
49 //=============================================================================================================
50 // Qt INCLUDES
51 //=============================================================================================================
52 
53 #include <QAbstractTableModel>
54 #include <QBrush>
55 #include <QSettings>
56 #include <QVector>
57 #include <QPair>
58 
59 
60 //*************************************************************************************************************
61 //=============================================================================================================
62 // Eigen INCLUDES
63 //=============================================================================================================
64 
65 #include <Eigen/Core>
66 
67 
68 //*************************************************************************************************************
69 //=============================================================================================================
70 // MNE INCLUDES
71 //=============================================================================================================
72 
73 #include <fiff/fiff.h>
74 #include <mne/mne.h>
75 
76 
77 //*************************************************************************************************************
78 //=============================================================================================================
79 // USED NAMESPACES
80 //=============================================================================================================
81 
82 using namespace Eigen;
83 using namespace MNELIB;
84 
85 
86 //*************************************************************************************************************
87 //=============================================================================================================
88 // DEFINE NAMESPACE MNEBrowseRawQt
89 //=============================================================================================================
90 
91 namespace MNEBrowseRawQt
92 {
93 
94 //=============================================================================================================
98 class EventModel : public QAbstractTableModel
99 {
100  Q_OBJECT
101 
102 public:
103  EventModel(QObject *parent);
104  EventModel(QFile& qFile, QObject *parent);
105 
106  //=========================================================================================================
111  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
112  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
113  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
114  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
115  bool insertRows(int position, int span, const QModelIndex & parent = QModelIndex());
116  bool removeRows(int position, int span, const QModelIndex & parent = QModelIndex());
117  Qt::ItemFlags flags(const QModelIndex & index) const;
118  bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
119 
120  //=========================================================================================================
126  bool loadEventData(QFile& qFile);
127 
128  //=========================================================================================================
134  bool saveEventData(QFile& qFile);
135 
136  //=========================================================================================================
142  void setFiffInfo(FiffInfo& fiffInfo);
143 
144  //=========================================================================================================
151  void setFirstLastSample(int firstSample, int lastSample);
152 
153  //=========================================================================================================
159  void setCurrentMarkerPos(int markerPos);
160 
161  //=========================================================================================================
166  FiffInfo getFiffInfo() const;
167 
168  //=========================================================================================================
173  QPair<int, int> getFirstLastSample() const;
174 
175  //=========================================================================================================
181  void setEventFilterType(const QString eventType);
182 
183  //=========================================================================================================
188  QStringList getEventTypeList() const;
189 
190  //=========================================================================================================
195  const QMap<int, QColor> & getEventTypeColors();
196 
197  //=========================================================================================================
202  void clearModel();
203 
204  //=========================================================================================================
211  void addNewEventType(const QString &eventType, const QColor &typeColor);
212 
215 private:
216  QVector<int> m_dataSamples;
217  QVector<int> m_dataTypes;
218  QVector<int> m_dataIsUserEvent;
220  QMap<int, QColor> m_eventTypeColor;
222  QVector<int> m_dataSamples_Filtered;
223  QVector<int> m_dataTypes_Filtered;
224  QVector<int> m_dataIsUserEvent_Filtered;
226  FiffInfo m_fiffInfo;
228  int m_iFirstSample;
229  int m_iLastSample;
230  int m_iCurrentMarkerPos;
231  QSettings m_qSettings;
232  QString m_sFilterEventType;
234  QStringList m_eventTypeList;
236 signals:
237  //=========================================================================================================
243  void updateEventTypes(const QString& currentFilterType);
244 };
245 
246 } // NAMESPACE
247 
248 #endif // EVEMODEL_H
249 
250 
FIFF class declaration, which provides static wrapper functions to stay consistent with mne matlab to...