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
45//=============================================================================================================
56{
57 Q_OBJECT
58
59public:
60 //=========================================================================================================
66 explicit RtSourceDataWorker(QObject* parent = nullptr);
67
68 //=========================================================================================================
75 void addData(const Eigen::VectorXd& data);
76
77 //=========================================================================================================
81 void clear();
82
83 //=========================================================================================================
89 void setInterpolationMatrixLeft(QSharedPointer<Eigen::SparseMatrix<float>> mat);
90
91 //=========================================================================================================
97 void setInterpolationMatrixRight(QSharedPointer<Eigen::SparseMatrix<float>> mat);
98
99 //=========================================================================================================
105 void setNumberAverages(int numAvr);
106
107 //=========================================================================================================
113 void setColormapType(const QString& name);
114
115 //=========================================================================================================
123 void setThresholds(double min, double mid, double max);
124
125 //=========================================================================================================
131 void setLoopState(bool enabled);
132
133 //=========================================================================================================
139 void setSFreq(double sFreq);
140
141 //=========================================================================================================
153 void setStreamSmoothedData(bool bStreamSmoothedData);
154
155 //=========================================================================================================
163 void setSurfaceColor(const QVector<uint32_t>& baseColorsLh,
164 const QVector<uint32_t>& baseColorsRh);
165
166public slots:
167 //=========================================================================================================
172 void streamData();
173
174signals:
175 //=========================================================================================================
182 void newRtSmoothedData(const QVector<uint32_t>& colorsLh,
183 const QVector<uint32_t>& colorsRh);
184
185 //=========================================================================================================
192 void newRtRawData(const Eigen::VectorXd& dataLh,
193 const Eigen::VectorXd& dataRh);
194
195private:
196 //=========================================================================================================
204 uint32_t valueToColor(double value, uint8_t alpha = 255) const;
205
206 //=========================================================================================================
215 QVector<uint32_t> computeHemiColors(const Eigen::VectorXf& sourceData,
216 const QSharedPointer<Eigen::SparseMatrix<float>>& interpMat,
217 const QVector<uint32_t>& baseColors) const;
218
219 mutable QMutex m_mutex;
220
221 QList<Eigen::VectorXd> m_lDataQ;
222 QList<Eigen::VectorXd> m_lDataLoopQ;
223 Eigen::VectorXd m_vecAverage;
224 int m_iSampleCtr = 0;
225 int m_iCurrentSample = 0;
226
227 QSharedPointer<Eigen::SparseMatrix<float>> m_interpMatLh;
228 QSharedPointer<Eigen::SparseMatrix<float>> m_interpMatRh;
229
230 int m_iNumAverages = 1;
231 bool m_bIsLooping = true;
232 bool m_bStreamSmoothedData = true;
233 double m_dSFreq = 1000.0;
234
235 QString m_sColormapType = QStringLiteral("Hot");
236 double m_dThreshMin = 0.0;
237 double m_dThreshMid = 0.5;
238 double m_dThreshMax = 1.0;
239
240 QVector<uint32_t> m_baseColorsLh;
241 QVector<uint32_t> m_baseColorsRh;
242};
243
244} // namespace DISP3DLIB
245
246#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)