v2.0.0
Loading...
Searching...
No Matches
rtsourcedataworker.h
Go to the documentation of this file.
1//=============================================================================================================
20
21#ifndef BRAINVIEW_RTSOURCEDATAWORKER_H
22#define BRAINVIEW_RTSOURCEDATAWORKER_H
23
24//=============================================================================================================
25// INCLUDES
26//=============================================================================================================
27
28#include "../disp3D_global.h"
29
30#include <QObject>
31#include <QList>
32#include <QMutex>
33#include <QVector>
34#include <QSharedPointer>
35#include <Eigen/Core>
36#include <Eigen/SparseCore>
37
38//=============================================================================================================
39// DEFINE NAMESPACE
40//=============================================================================================================
41
42namespace DISP3DLIB {
43
44//=============================================================================================================
55{
56 Q_OBJECT
57
58public:
59 //=========================================================================================================
65 explicit RtSourceDataWorker(QObject *parent = nullptr);
66
67 //=========================================================================================================
74 void addData(const Eigen::VectorXd &data);
75
76 //=========================================================================================================
80 void clear();
81
82 //=========================================================================================================
88 void setInterpolationMatrixLeft(QSharedPointer<Eigen::SparseMatrix<float>> mat);
89
90 //=========================================================================================================
96 void setInterpolationMatrixRight(QSharedPointer<Eigen::SparseMatrix<float>> mat);
97
98 //=========================================================================================================
104 void setNumberAverages(int numAvr);
105
106 //=========================================================================================================
112 void setColormapType(const QString &name);
113
114 //=========================================================================================================
122 void setThresholds(double min, double mid, double max);
123
124 //=========================================================================================================
130 void setLoopState(bool enabled);
131
132 //=========================================================================================================
138 void setSFreq(double sFreq);
139
140 //=========================================================================================================
152 void setStreamSmoothedData(bool bStreamSmoothedData);
153
154 //=========================================================================================================
162 void setSurfaceColor(const QVector<uint32_t> &baseColorsLh,
163 const QVector<uint32_t> &baseColorsRh);
164
165public slots:
166 //=========================================================================================================
171 void streamData();
172
173signals:
174 //=========================================================================================================
181 void newRtSmoothedData(const QVector<uint32_t> &colorsLh,
182 const QVector<uint32_t> &colorsRh);
183
184 //=========================================================================================================
191 void newRtRawData(const Eigen::VectorXd &dataLh,
192 const Eigen::VectorXd &dataRh);
193
194private:
195 //=========================================================================================================
203 uint32_t valueToColor(double value, uint8_t alpha = 255) const;
204
205 //=========================================================================================================
213 QVector<uint32_t> computeHemiColors(const Eigen::VectorXf &sourceData,
214 const QSharedPointer<Eigen::SparseMatrix<float>> &interpMat,
215 const QVector<uint32_t> &baseColors) const;
216
217 mutable QMutex m_mutex;
218
219 QList<Eigen::VectorXd> m_lDataQ;
220 QList<Eigen::VectorXd> m_lDataLoopQ;
221 Eigen::VectorXd m_vecAverage;
222 int m_iSampleCtr = 0;
223 int m_iCurrentSample = 0;
224
225 QSharedPointer<Eigen::SparseMatrix<float>> m_interpMatLh;
226 QSharedPointer<Eigen::SparseMatrix<float>> m_interpMatRh;
227
228 int m_iNumAverages = 1;
229 bool m_bIsLooping = true;
230 bool m_bStreamSmoothedData = true;
231 double m_dSFreq = 1000.0;
232
233 QString m_sColormapType = QStringLiteral("Hot");
234 double m_dThreshMin = 0.0;
235 double m_dThreshMid = 0.5;
236 double m_dThreshMax = 1.0;
237
238 QVector<uint32_t> m_baseColorsLh;
239 QVector<uint32_t> m_baseColorsRh;
240};
241
242} // namespace DISP3DLIB
243
244#endif // BRAINVIEW_RTSOURCEDATAWORKER_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
3-D brain visualisation using the Qt RHI rendering backend.
void setInterpolationMatrixRight(QSharedPointer< Eigen::SparseMatrix< float > > mat)
void setColormapType(const QString &name)
void setInterpolationMatrixLeft(QSharedPointer< Eigen::SparseMatrix< float > > mat)
void newRtRawData(const Eigen::VectorXd &dataLh, const Eigen::VectorXd &dataRh)
RtSourceDataWorker(QObject *parent=nullptr)
void setStreamSmoothedData(bool bStreamSmoothedData)
void setThresholds(double min, double mid, double max)
void addData(const Eigen::VectorXd &data)
void newRtSmoothedData(const QVector< uint32_t > &colorsLh, const QVector< uint32_t > &colorsRh)
void setSurfaceColor(const QVector< uint32_t > &baseColorsLh, const QVector< uint32_t > &baseColorsRh)