MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
rtsourcedatacontroller.cpp
Go to the documentation of this file.
1//=============================================================================================================
35//=============================================================================================================
36// INCLUDES
37//=============================================================================================================
38
41#include "rtsourcedataworker.h"
42
43//=============================================================================================================
44// QT INCLUDES
45//=============================================================================================================
46
47#include <QDebug>
48
49//=============================================================================================================
50// EIGEN INCLUDES
51//=============================================================================================================
52
53#include <Eigen/Core>
54
55//=============================================================================================================
56// USED NAMESPACES
57//=============================================================================================================
58
59using namespace DISP3DLIB;
60using namespace Eigen;
61using namespace FSLIB;
62
63//=============================================================================================================
64// DEFINE MEMBER METHODS
65//=============================================================================================================
66
68: m_iMSecInterval(17)
69{
70 //Stream data
73
74 connect(&m_rtSourceDataWorkerThread, &QThread::finished,
75 m_pRtSourceDataWorker.data(), &QObject::deleteLater);
76
78 this, &RtSourceDataController::onNewRtRawData, Qt::BlockingQueuedConnection);
79
81 this, &RtSourceDataController::onNewSmoothedRtRawData, Qt::BlockingQueuedConnection);
82
83 connect(&m_timer, &QTimer::timeout,
85
87 m_pRtSourceDataWorker.data(), &RtSourceDataWorker::addData, Qt::DirectConnection);
88
91
94
97
99 m_pRtSourceDataWorker.data(), &RtSourceDataWorker::setThresholds, Qt::DirectConnection);
100
103
105 m_pRtSourceDataWorker.data(), &RtSourceDataWorker::setLoopState, Qt::DirectConnection);
106
108 m_pRtSourceDataWorker.data(), &RtSourceDataWorker::setNumberAverages, Qt::DirectConnection);
109
111 m_pRtSourceDataWorker.data(), &RtSourceDataWorker::setColormapType, Qt::DirectConnection);
112
115
117
118 //Calculate interpolation matrix left hemisphere
121
124
125 connect(&m_rtInterpolationLeftWorkerThread, &QThread::finished,
126 m_pRtInterpolationLeftWorker.data(), &QObject::deleteLater);
127
130
133
136
139
142
144
145 //Calculate interpolation matrix right hemisphere
148
151
152 connect(&m_rtInterpolationRightWorkerThread, &QThread::finished,
153 m_pRtInterpolationRightWorker.data(), &QObject::deleteLater);
154
157
160
163
166
169
171}
172
173//=============================================================================================================
174
184
185//=============================================================================================================
186
188{
189 if(bStreamingState) {
191 } else {
192 m_timer.stop();
193 }
194}
195
196//=============================================================================================================
197
198void RtSourceDataController::setInterpolationFunction(const QString &sInterpolationFunction)
199{
200 emit interpolationFunctionChanged(sInterpolationFunction);
201}
202
203//=============================================================================================================
204
206{
207 emit loopStateChanged(bLoopState);
208}
209
210//=============================================================================================================
211
213{
214 emit cancelDistanceChanged(dCancelDist);
215}
216
217//=============================================================================================================
218
220{
221// if(iMSec < 17) {
222// qDebug() << "RtSourceDataController::setTimeInterval - The minimum time interval is 17mSec.";
223// iMSec = 17;
224// }
225
226 m_iMSecInterval = iMSec;
227 m_timer.setInterval(m_iMSecInterval);
228}
229
230//=============================================================================================================
231
232void RtSourceDataController::setInterpolationInfo(const MatrixX3f &matVerticesLeft,
233 const MatrixX3f &matVerticesRight,
234 const QVector<QVector<int> > &vecNeighborVerticesLeft,
235 const QVector<QVector<int> > &vecNeighborVerticesRight,
236 const VectorXi &vecVertNoLeftHemi,
237 const VectorXi &vecVertNoRightHemi)
238{
239 QVector<int> vecMappedSubsetLeft, vecMappedSubsetRight;
240
241 for(int i = 0; i < vecVertNoLeftHemi.rows(); ++i) {
242 vecMappedSubsetLeft.append(vecVertNoLeftHemi[i]);
243 }
244
245 for(int i = 0; i < vecVertNoRightHemi.rows(); ++i) {
246 vecMappedSubsetRight.append(vecVertNoRightHemi[i]);
247 }
248
249 emit interpolationInfoLeftChanged(matVerticesLeft,
250 vecNeighborVerticesLeft,
251 vecMappedSubsetLeft);
252
253 emit interpolationInfoRightChanged(matVerticesRight,
254 vecNeighborVerticesRight,
255 vecMappedSubsetRight);
256}
257
258//=============================================================================================================
259
260void RtSourceDataController::setSurfaceColor(const MatrixX4f &matColorLeft,
261 const MatrixX4f &matColorRight)
262{
263 emit surfaceColorChanged(matColorLeft,
264 matColorRight);
265}
266
267//=============================================================================================================
268
269void RtSourceDataController::setAnnotationInfo(const VectorXi &vecLabelIdsLeftHemi,
270 const VectorXi &vecLabelIdsRightHemi,
271 const QList<Label> &lLabelsLeftHemi,
272 const QList<Label> &lLabelsRightHemi,
273 const VectorXi &vecVertNoLeft,
274 const VectorXi &vecVertNoRight)
275{
276 emit annotationInfoLeftChanged(vecLabelIdsLeftHemi,
277 lLabelsLeftHemi,
278 vecVertNoLeft);
279
280 emit annotationInfoRightChanged(vecLabelIdsRightHemi,
281 lLabelsRightHemi,
282 vecVertNoRight);
283}
284
285//=============================================================================================================
286
287void RtSourceDataController::setThresholds(const QVector3D &vecThresholds)
288{
289 emit thresholdsChanged(vecThresholds);
290}
291
292//=============================================================================================================
293
295{
296 emit visualizationTypeChanged(iVisType);
297}
298
299//=============================================================================================================
300
301void RtSourceDataController::setColormapType(const QString &sColormapType)
302{
303 emit colormapTypeChanged(sColormapType);
304}
305
306//=============================================================================================================
307
309{
310 emit numberAveragesChanged(iNumAvr);
311}
312
313//=============================================================================================================
314
316{
317 emit sFreqChanged(dSFreq);
318}
319
320//=============================================================================================================
321
323{
324 emit streamSmoothedDataChanged(bStreamSmoothedData);
325}
326
327//=============================================================================================================
328
329void RtSourceDataController::addData(const MatrixXd& data)
330{
331 emit rawDataChanged(data);
332}
333
334//=============================================================================================================
335
336void RtSourceDataController::onNewRtRawData(const VectorXd &vecDataVectorLeftHemi,
337 const VectorXd &vecDataVectorRightHemi)
338{
339 emit newRtRawDataAvailable(vecDataVectorLeftHemi,
340 vecDataVectorRightHemi);
341}
342
343//=============================================================================================================
344
345void RtSourceDataController::onNewSmoothedRtRawData(const MatrixX4f &matColorMatrixLeftHemi,
346 const MatrixX4f &matColorMatrixRightHemi)
347{
348 emit newRtSmoothedDataAvailable(matColorMatrixLeftHemi,
349 matColorMatrixRightHemi);
350}
351
352//=============================================================================================================
353
354void RtSourceDataController::onNewInterpolationMatrixLeftCalculated(QSharedPointer<Eigen::SparseMatrix<float> > pMatInterpolationMatrixLeftHemi)
355{
356 emit newInterpolationMatrixLeftAvailable(pMatInterpolationMatrixLeftHemi);
357}
358
359//=============================================================================================================
360
361void RtSourceDataController::onNewInterpolationMatrixRightCalculated(QSharedPointer<Eigen::SparseMatrix<float> > pMatInterpolationMatrixRightHemi)
362{
363 emit newInterpolationMatrixRightAvailable(pMatInterpolationMatrixRightHemi);
364}
365
RtSourceDataController class declaration.
RtSourceDataWorker class declaration.
RtSourceInterpolationMatWorker class declaration.
QPointer< RtSourceInterpolationMatWorker > m_pRtInterpolationRightWorker
void setSurfaceColor(const Eigen::MatrixX4f &matColorLeft, const Eigen::MatrixX4f &matColorRight)
void addData(const Eigen::MatrixXd &data)
void numberAveragesChanged(int iNumAvr)
QPointer< RtSourceDataWorker > m_pRtSourceDataWorker
void annotationInfoRightChanged(const Eigen::VectorXi &vecLabelIdsRightHemi, const QList< FSLIB::Label > &lLabels, const Eigen::VectorXi &vecVertNoRight)
void rawDataChanged(const Eigen::MatrixXd &data)
void surfaceColorChanged(const Eigen::MatrixX4f &matColorLeft, const Eigen::MatrixX4f &matColorRight)
void newRtSmoothedDataAvailable(const Eigen::MatrixX4f &matColorMatrixLeftHemi, const Eigen::MatrixX4f &matColorMatrixRightHemi)
void setStreamSmoothedData(bool bStreamSmoothedData)
void colormapTypeChanged(const QString &sColormapType)
QPointer< RtSourceInterpolationMatWorker > m_pRtInterpolationLeftWorker
void sFreqChanged(double dSFreq)
void newInterpolationMatrixRightAvailable(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrixRightHemi)
void setStreamingState(bool bStreamingState)
void newInterpolationMatrixLeftAvailable(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrixLeftHemi)
void setThresholds(const QVector3D &vecThresholds)
void loopStateChanged(bool bLoopState)
void interpolationFunctionChanged(const QString &sInterpolationFunction)
void onNewSmoothedRtRawData(const Eigen::MatrixX4f &matColorMatrixLeftHemi, const Eigen::MatrixX4f &matColorMatrixRightHemi)
void onNewInterpolationMatrixLeftCalculated(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrixLeftHemi)
void thresholdsChanged(const QVector3D &vecThresholds)
void interpolationInfoRightChanged(const Eigen::MatrixX3f &matVerticesRight, const QVector< QVector< int > > &vecNeighborVerticesRight, const QVector< int > &vecMappedSubsetRight)
void newRtRawDataAvailable(const Eigen::VectorXd &vecDataVectorLeftHemi, const Eigen::VectorXd &vecDataVectorRightHemi)
void setInterpolationInfo(const Eigen::MatrixX3f &matVerticesLeft, const Eigen::MatrixX3f &matVerticesRight, const QVector< QVector< int > > &vecNeighborVerticesLeft, const QVector< QVector< int > > &vecNeighborVerticesRight, const Eigen::VectorXi &vecVertNoLeftHemi, const Eigen::VectorXi &vecVertNoRightHemi)
void annotationInfoLeftChanged(const Eigen::VectorXi &vecLabelIdsLeftHemi, const QList< FSLIB::Label > &lLabels, const Eigen::VectorXi &vecVertNoLeft)
void setInterpolationFunction(const QString &sInterpolationFunction)
void cancelDistanceChanged(double dCancelDist)
void visualizationTypeChanged(int iVisType)
void interpolationInfoLeftChanged(const Eigen::MatrixX3f &matVerticesLeft, const QVector< QVector< int > > &vecNeighborVerticesLeft, const QVector< int > &vecMappedSubsetLeft)
void streamSmoothedDataChanged(bool bStreamSmoothedData)
void onNewRtRawData(const Eigen::VectorXd &vecDataVectorLeftHemi, const Eigen::VectorXd &vecDataVectorRightHemi)
void setAnnotationInfo(const Eigen::VectorXi &vecLabelIdsLeftHemi, const Eigen::VectorXi &vecLabelIdsRightHemi, const QList< FSLIB::Label > &lLabelsLeftHemi, const QList< FSLIB::Label > &lLabelsRightHemi, const Eigen::VectorXi &vecVertNoLeft, const Eigen::VectorXi &vecVertNoRight)
void onNewInterpolationMatrixRightCalculated(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrixRightHemi)
void setColormapType(const QString &sColormapType)
This worker streams either interpolated or raw data.
void setColormapType(const QString &sColormapType)
void newRtRawData(const Eigen::VectorXd &vecDataVectorLeftHemi, const Eigen::VectorXd &vecDataVectorRightHemi)
void setInterpolationMatrixRight(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrixRight)
void setSFreq(const double dSFreq)
void setInterpolationMatrixLeft(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrixLeft)
void addData(const Eigen::MatrixXd &data)
void setThresholds(const QVector3D &vecThresholds)
void setStreamSmoothedData(bool bStreamSmoothedData)
void newRtSmoothedData(const Eigen::MatrixX4f &matColorMatrixLeftHemi, const Eigen::MatrixX4f &matColorMatrixRightHemi)
void setSurfaceColor(const Eigen::MatrixX4f &matColorLeft, const Eigen::MatrixX4f &matColorRight)
This worker calculates the interpolation matrix.
void setInterpolationFunction(const QString &sInterpolationFunction)
void setAnnotationInfo(const Eigen::VectorXi &vecLabelIds, const QList< FSLIB::Label > &lLabels, const Eigen::VectorXi &vecVertNo)
void newInterpolationMatrixCalculated(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrix)
void setInterpolationInfo(const Eigen::MatrixX3f &matVertices, const QVector< QVector< int > > &vecNeighborVertices, const QVector< int > &vecMappedSubset)