v2.0.0
Loading...
Searching...
No Matches
frequencyspectrummodel.h
Go to the documentation of this file.
1//=============================================================================================================
21
22#ifndef FREQUENCYSPECTRUMMODEL_H
23#define FREQUENCYSPECTRUMMODEL_H
24
25//=============================================================================================================
26// INCLUDES
27//=============================================================================================================
28
29#include "../../disp_global.h"
30
31#include <fiff/fiff_types.h>
32
33//=============================================================================================================
34// QT INCLUDES
35//=============================================================================================================
36
37#include <QAbstractTableModel>
38#include <QSharedPointer>
39
40//=============================================================================================================
41// EIGEN INCLUDES
42//=============================================================================================================
43
44#include <Eigen/Core>
45
46//=============================================================================================================
47// FORWARD DECLARATIONS
48//=============================================================================================================
49
50namespace FIFFLIB
51{
52class FiffInfo;
53}
54
55//=============================================================================================================
56// DEFINE NAMESPACE DISPLIB
57//=============================================================================================================
58
59namespace DISPLIB
60{
61
62//=============================================================================================================
63// DISPLIB FORWARD DECLARATIONS
64//=============================================================================================================
65
66//=============================================================================================================
74class DISPSHARED_EXPORT FrequencySpectrumModel : public QAbstractTableModel
75{
76 Q_OBJECT
77
78public:
79 typedef QSharedPointer<FrequencySpectrumModel> SPtr;
80 typedef QSharedPointer<const FrequencySpectrumModel> ConstSPtr;
81
82 //=========================================================================================================
88 FrequencySpectrumModel(QObject* parent = 0);
89
90 //=========================================================================================================
98 virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
99
100 //=========================================================================================================
108 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
109
110 //=========================================================================================================
119 virtual QVariant data(const QModelIndex& index,
120 int role = Qt::DisplayRole) const;
121
122 //=========================================================================================================
132 virtual QVariant headerData(int section, Qt::Orientation orientation,
133 int role = Qt::DisplayRole) const;
134
135 //=========================================================================================================
141 void setInfo(QSharedPointer<FIFFLIB::FiffInfo>& info);
142
143 //=========================================================================================================
149 void setScaleType(qint8 ScaleType);
150
151 //=========================================================================================================
157 void addData(const Eigen::MatrixXd& data);
158
159 //=========================================================================================================
165 inline QSharedPointer<FIFFLIB::FiffInfo> getInfo() const;
166
167 //=========================================================================================================
173 inline Eigen::RowVectorXd getFreqScale() const;
174
175 //=========================================================================================================
181 inline Eigen::RowVectorXd getFreqScaleBound() const;
182
183 //=========================================================================================================
189 inline qint32 getNumStems() const;
190
191 //=========================================================================================================
197 inline const QMap<qint32, qint32>& getIdxSelMap() const;
198
199 //=========================================================================================================
205 void selectRows(const QList<qint32>& selection);
206
207 //=========================================================================================================
211 void resetSelection();
212
213 //=========================================================================================================
219 void toggleFreeze(const QModelIndex& index);
220
221 //=========================================================================================================
227 inline bool isFreezed() const;
228
229 //=========================================================================================================
236 void setBoundaries(float fLowerFrqBound, float fUpperFrqBound);
237
238 //=========================================================================================================
244 inline qint32 getLowerFrqBound() const;
245
246 //=========================================================================================================
252 inline qint32 getUpperFrqBound() const;
253
254signals:
255 //=========================================================================================================
261 void newSelection(QList<qint32> selection);
262
263private:
264 QSharedPointer<FIFFLIB::FiffInfo> m_pFiffInfo;
265
266 QMap<qint32, qint32> m_qMapIdxRowSelection;
267
268 Eigen::RowVectorXd m_vecFreqScale;
269 Eigen::RowVectorXd m_vecFreqScaleBound;
270 Eigen::MatrixXd m_dataCurrent;
271 Eigen::MatrixXd m_dataCurrentFreeze;
272
273 float m_fSps;
274 qint32 m_iT;
275 qint32 m_iLowerFrqIdx;
276 qint32 m_iUpperFrqIdx;
277 qint8 m_iScaleType;
278 bool m_bIsFreezed;
279 bool m_bInitialized;
280};
281
282//=============================================================================================================
283// INLINE DEFINITIONS
284//=============================================================================================================
285
286QSharedPointer<FIFFLIB::FiffInfo> FrequencySpectrumModel::getInfo() const
287{
288 return m_pFiffInfo;
289}
290
291//=============================================================================================================
292
293Eigen::RowVectorXd FrequencySpectrumModel::getFreqScale() const
294{
295 return m_vecFreqScale;
296}
297
298//=============================================================================================================
299
301{
302 return m_vecFreqScaleBound;
303}
304
305//=============================================================================================================
306
308{
309 return m_dataCurrent.cols();
310}
311
312//=============================================================================================================
313
314inline const QMap<qint32, qint32>& FrequencySpectrumModel::getIdxSelMap() const
315{
316 return m_qMapIdxRowSelection;
317}
318
319//=============================================================================================================
320
322{
323 return m_bIsFreezed;
324}
325
326//=============================================================================================================
327
329{
330 return m_iLowerFrqIdx;
331}
332
333//=============================================================================================================
334
336{
337 return m_iUpperFrqIdx;
338}
339} // NAMESPACE
340
341#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
342#ifndef metatype_rowvectorxd
343#define metatype_rowvectorxd
344Q_DECLARE_METATYPE(Eigen::RowVectorXd);
345#endif
346#endif
347
348#endif // FREQUENCYSPECTRUMMODEL_H
Q_DECLARE_METATYPE(Eigen::MatrixXf)
MatrixXi selectRows(const MatrixXi &events, const std::vector< bool > &keep)
Primitive scalar typedefs and forward-compatible aliases backing the FIFF type system.
Export macros and build-info hooks for the DISPLIB shared library.
#define DISPSHARED_EXPORT
Definition disp_global.h:38
FIFF file I/O, in-memory data structures and high-level readers/writers.
2-D display widgets and visualisation helpers (charts, topography, colour maps).
QSharedPointer< FrequencySpectrumModel > SPtr
void newSelection(QList< qint32 > selection)
void setBoundaries(float fLowerFrqBound, float fUpperFrqBound)
QSharedPointer< const FrequencySpectrumModel > ConstSPtr
QSharedPointer< FIFFLIB::FiffInfo > getInfo() const
const QMap< qint32, qint32 > & getIdxSelMap() const
void addData(const Eigen::MatrixXd &data)
void toggleFreeze(const QModelIndex &index)
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
void setInfo(QSharedPointer< FIFFLIB::FiffInfo > &info)
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Eigen::RowVectorXd getFreqScaleBound() const
Eigen::RowVectorXd getFreqScale() const
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...
Definition fiff_info.h:90