MNE-CPP  0.1.9
A Framework for Electrophysiology
rtsensordatacontroller.cpp
Go to the documentation of this file.
1 //=============================================================================================================
35 //=============================================================================================================
36 // INCLUDES
37 //=============================================================================================================
38 
39 #include "rtsensordatacontroller.h"
41 #include "rtsensordataworker.h"
42 
43 //=============================================================================================================
44 // QT INCLUDES
45 //=============================================================================================================
46 
47 //=============================================================================================================
48 // EIGEN INCLUDES
49 //=============================================================================================================
50 
51 #include <Eigen/Core>
52 
53 //=============================================================================================================
54 // USED NAMESPACES
55 //=============================================================================================================
56 
57 using namespace DISP3DLIB;
58 using namespace Eigen;
59 using namespace FIFFLIB;
60 
61 //=============================================================================================================
62 // DEFINE MEMBER METHODS
63 //=============================================================================================================
64 
66 : m_iMSecInterval(17)
67 {
68  //Stream data
71 
72  connect(&m_rtSensorDataWorkerThread, &QThread::finished,
73  m_pRtSensorDataWorker.data(), &QObject::deleteLater);
74 
77 
80 
81  connect(&m_timer, &QTimer::timeout,
83 
86 
89 
92 
94  m_pRtSensorDataWorker.data(), &RtSensorDataWorker::setThresholds, Qt::DirectConnection);
95 
98 
101 
103  m_pRtSensorDataWorker.data(), &RtSensorDataWorker::setNumberAverages, Qt::DirectConnection);
104 
106  m_pRtSensorDataWorker.data(), &RtSensorDataWorker::setColormapType, Qt::DirectConnection);
107 
110 
112 
113  //Calculate interpolation matrix
116 
119 
120  connect(&m_rtInterpolationWorkerThread, &QThread::finished,
121  m_pRtInterpolationWorker.data(), &QObject::deleteLater);
122 
125 
128 
131 
134 
136 }
137 
138 //=============================================================================================================
139 
141 {
146 }
147 
148 //=============================================================================================================
149 
151 {
152  if(bStreamingState) {
153  m_timer.start(m_iMSecInterval);
154  } else {
155  m_timer.stop();
156  }
157 }
158 
159 //=============================================================================================================
160 
161 void RtSensorDataController::setInterpolationFunction(const QString &sInterpolationFunction)
162 {
163  emit interpolationFunctionChanged(sInterpolationFunction);
164 }
165 
166 //=============================================================================================================
167 
169 {
170  emit loopStateChanged(bLoopState);
171 }
172 
173 //=============================================================================================================
174 
176 {
177  emit cancelDistanceChanged(dCancelDist);
178 }
179 
180 //=============================================================================================================
181 
183 {
184 // if(iMSec < 17) {
185 // qDebug() << "RtSensorDataController::setTimeInterval - The minimum time interval is 17mSec.";
186 // iMSec = 17;
187 // }
188 
189  m_iMSecInterval = iMSec;
190  m_timer.setInterval(m_iMSecInterval);
191 }
192 
193 //=============================================================================================================
194 
195 void RtSensorDataController::setInterpolationInfo(const Eigen::MatrixX3f &matVertices,
196  const QVector<QVector<int> > &vecNeighborVertices,
197  const QVector<Vector3f> &vecSensorPos,
198  const FiffInfo &fiffInfo,
199  int iSensorType)
200 {
201  emit numberVerticesChanged(matVertices.rows());
202 
203  emit interpolationInfoChanged(matVertices,
204  vecNeighborVertices,
205  vecSensorPos,
206  fiffInfo,
207  iSensorType);
208 }
209 
210 //=============================================================================================================
211 
212 void RtSensorDataController::setThresholds(const QVector3D &vecThresholds)
213 {
214  emit thresholdsChanged(vecThresholds);
215 }
216 
217 //=============================================================================================================
218 
219 void RtSensorDataController::setColormapType(const QString &sColormapType)
220 {
221  emit colormapTypeChanged(sColormapType);
222 }
223 
224 //=============================================================================================================
225 
227 {
228  emit numberAveragesChanged(iNumAvr);
229 }
230 
231 //=============================================================================================================
232 
234 {
235  emit sFreqChanged(dSFreq);
236 }
237 
238 //=============================================================================================================
239 
241 {
242  emit badChannelsChanged(info);
243 }
244 
245 //=============================================================================================================
246 
247 void RtSensorDataController::setStreamSmoothedData(bool bStreamSmoothedData)
248 {
249  emit streamSmoothedDataChanged(bStreamSmoothedData);
250 }
251 
252 //=============================================================================================================
253 
254 void RtSensorDataController::addData(const MatrixXd& data)
255 {
256  emit rawDataChanged(data);
257 }
258 
259 //=============================================================================================================
260 
261 void RtSensorDataController::onNewRtRawData(const VectorXd &vecDataVector)
262 {
263  emit newRtRawDataAvailable(vecDataVector);
264 }
265 
266 //=============================================================================================================
267 
268 void RtSensorDataController::onNewSmoothedRtRawData(const MatrixX4f &matColorMatrix)
269 {
270  emit newRtSmoothedDataAvailable(matColorMatrix);
271 }
272 
273 //=============================================================================================================
274 
275 void RtSensorDataController::onNewInterpolationMatrixCalculated(QSharedPointer<SparseMatrix<float> > pMatInterpolationMatrix)
276 {
277  emit newInterpolationMatrixAvailable(pMatInterpolationMatrix);
278 }
DISP3DLIB::RtSensorDataController::badChannelsChanged
void badChannelsChanged(const FIFFLIB::FiffInfo &info)
DISP3DLIB::RtSensorDataWorker::setThresholds
void setThresholds(const QVector3D &vecThresholds)
Definition: rtsensordataworker.cpp:136
DISP3DLIB::RtSensorDataController::addData
void addData(const Eigen::MatrixXd &data)
Definition: rtsensordatacontroller.cpp:254
DISP3DLIB::RtSensorDataController::rawDataChanged
void rawDataChanged(const Eigen::MatrixXd &data)
FIFFLIB::FiffInfo
FIFF measurement file information.
Definition: fiff_info.h:84
DISP3DLIB::RtSensorDataWorker::newRtSmoothedData
void newRtSmoothedData(const Eigen::MatrixX4f &matColorMatrix)
DISP3DLIB::RtSensorDataController::streamSmoothedDataChanged
void streamSmoothedDataChanged(bool bStreamSmoothedData)
DISP3DLIB::RtSensorDataController::newInterpolationMatrixAvailable
void newInterpolationMatrixAvailable(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrix)
DISP3DLIB::RtSensorDataController::RtSensorDataController
RtSensorDataController()
Definition: rtsensordatacontroller.cpp:65
DISP3DLIB::RtSensorDataController::onNewSmoothedRtRawData
void onNewSmoothedRtRawData(const Eigen::MatrixX4f &matColorMatrix)
Definition: rtsensordatacontroller.cpp:268
DISP3DLIB::RtSensorInterpolationMatWorker::setBadChannels
void setBadChannels(const FIFFLIB::FiffInfo &info)
Definition: rtsensorinterpolationmatworker.cpp:148
DISP3DLIB::RtSensorDataController::setStreamingState
void setStreamingState(bool bStreamingState)
Definition: rtsensordatacontroller.cpp:150
DISP3DLIB::RtSensorInterpolationMatWorker::setInterpolationFunction
void setInterpolationFunction(const QString &sInterpolationFunction)
Definition: rtsensorinterpolationmatworker.cpp:74
DISP3DLIB::RtSensorDataController::thresholdsChanged
void thresholdsChanged(const QVector3D &vecThresholds)
DISP3DLIB::RtSensorDataController::setTimeInterval
void setTimeInterval(int iMSec)
Definition: rtsensordatacontroller.cpp:182
DISP3DLIB::RtSensorDataController::~RtSensorDataController
~RtSensorDataController()
Definition: rtsensordatacontroller.cpp:140
DISP3DLIB::RtSensorDataWorker::streamData
void streamData()
Definition: rtsensordataworker.cpp:164
DISP3DLIB::RtSensorDataController::m_pRtSensorDataWorker
QPointer< RtSensorDataWorker > m_pRtSensorDataWorker
Definition: rtsensordatacontroller.h:254
DISP3DLIB::RtSensorDataController::m_pRtInterpolationWorker
QPointer< RtSensorInterpolationMatWorker > m_pRtInterpolationWorker
Definition: rtsensordatacontroller.h:255
DISP3DLIB::RtSensorDataController::setLoopState
void setLoopState(bool bLoopState)
Definition: rtsensordatacontroller.cpp:168
DISP3DLIB::RtSensorDataController::m_rtSensorDataWorkerThread
QThread m_rtSensorDataWorkerThread
Definition: rtsensordatacontroller.h:251
DISP3DLIB::RtSensorInterpolationMatWorker::setCancelDistance
void setCancelDistance(double dCancelDist)
Definition: rtsensorinterpolationmatworker.cpp:97
DISP3DLIB::RtSensorDataController::interpolationFunctionChanged
void interpolationFunctionChanged(const QString &sInterpolationFunction)
DISP3DLIB::RtSensorDataWorker::addData
void addData(const Eigen::MatrixXd &data)
Definition: rtsensordataworker.cpp:83
DISP3DLIB::RtSensorDataController::m_rtInterpolationWorkerThread
QThread m_rtInterpolationWorkerThread
Definition: rtsensordatacontroller.h:252
rtsensorinterpolationmatworker.h
RtSensorInterpolationMatWorker class declaration.
DISP3DLIB::RtSensorDataController::newRtRawDataAvailable
void newRtRawDataAvailable(const Eigen::VectorXd &vecDataVector)
DISP3DLIB::RtSensorDataWorker::newRtRawData
void newRtRawData(Eigen::VectorXd vecDataVector)
rtsensordatacontroller.h
RtSensorDataController class declaration.
DISP3DLIB::RtSensorDataWorker::setColormapType
void setColormapType(const QString &sColormapType)
Definition: rtsensordataworker.cpp:128
DISP3DLIB::RtSensorDataController::setNumberAverages
void setNumberAverages(int iNumAvr)
Definition: rtsensordatacontroller.cpp:226
DISP3DLIB::RtSensorDataController::newRtSmoothedDataAvailable
void newRtSmoothedDataAvailable(const Eigen::MatrixX4f &matColorMatrix)
DISP3DLIB::RtSensorInterpolationMatWorker
This worker calculates the interpolation matrix.
Definition: rtsensorinterpolationmatworker.h:76
DISP3DLIB::RtSensorDataController::interpolationInfoChanged
void interpolationInfoChanged(const Eigen::MatrixX3f &matVertices, const QVector< QVector< int > > &vecNeighborVertices, const QVector< Eigen::Vector3f > &vecSensorPos, const FIFFLIB::FiffInfo &fiffInfo, int iSensorType)
DISP3DLIB::RtSensorDataWorker::setStreamSmoothedData
void setStreamSmoothedData(bool bStreamSmoothedData)
Definition: rtsensordataworker.cpp:121
DISP3DLIB::RtSensorDataController::m_iMSecInterval
int m_iMSecInterval
Definition: rtsensordatacontroller.h:257
DISP3DLIB::RtSensorDataWorker::setSFreq
void setSFreq(const double dSFreq)
Definition: rtsensordataworker.cpp:151
DISP3DLIB::RtSensorDataController::setColormapType
void setColormapType(const QString &sColormapType)
Definition: rtsensordatacontroller.cpp:219
DISP3DLIB::RtSensorDataWorker
This worker streams either interpolated or raw data.
Definition: rtsensordataworker.h:81
rtsensordataworker.h
RtSensorDataWorker class declaration.
DISP3DLIB::RtSensorDataController::setThresholds
void setThresholds(const QVector3D &vecThresholds)
Definition: rtsensordatacontroller.cpp:212
DISP3DLIB::RtSensorInterpolationMatWorker::newInterpolationMatrixCalculated
void newInterpolationMatrixCalculated(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrix)
DISP3DLIB::RtSensorDataController::setInterpolationFunction
void setInterpolationFunction(const QString &sInterpolationFunction)
Definition: rtsensordatacontroller.cpp:161
DISP3DLIB::RtSensorDataController::m_timer
QTimer m_timer
Definition: rtsensordatacontroller.h:249
DISP3DLIB::RtSensorDataController::sFreqChanged
void sFreqChanged(double dSFreq)
DISP3DLIB::RtSensorInterpolationMatWorker::setInterpolationInfo
void setInterpolationInfo(const Eigen::MatrixX3f &matVertices, const QVector< QVector< int > > &vecNeighborVertices, const QVector< Eigen::Vector3f > &vecSensorPos, const FIFFLIB::FiffInfo &fiffInfo, int iSensorType)
Definition: rtsensorinterpolationmatworker.cpp:107
DISP3DLIB::RtSensorDataWorker::setNumberVertices
void setNumberVertices(int iNumberVerts)
Definition: rtsensordataworker.cpp:105
DISP3DLIB::RtSensorDataController::loopStateChanged
void loopStateChanged(bool bLoopState)
DISP3DLIB::RtSensorDataWorker::setInterpolationMatrix
void setInterpolationMatrix(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrix)
Definition: rtsensordataworker.cpp:158
DISP3DLIB::RtSensorDataController::numberVerticesChanged
void numberVerticesChanged(int iNumberVerts)
DISP3DLIB::RtSensorDataController::onNewRtRawData
void onNewRtRawData(const Eigen::VectorXd &vecDataVector)
Definition: rtsensordatacontroller.cpp:261
DISP3DLIB::RtSensorDataController::setSFreq
void setSFreq(double dSFreq)
Definition: rtsensordatacontroller.cpp:233
DISP3DLIB::RtSensorDataController::setInterpolationInfo
void setInterpolationInfo(const Eigen::MatrixX3f &matVertices, const QVector< QVector< int > > &vecNeighborVertices, const QVector< Eigen::Vector3f > &vecSensorPos, const FIFFLIB::FiffInfo &fiffInfo, int iSensorType)
Definition: rtsensordatacontroller.cpp:195
DISP3DLIB::RtSensorDataController::numberAveragesChanged
void numberAveragesChanged(int iNumAvr)
DISP3DLIB::RtSensorDataController::setBadChannels
void setBadChannels(const FIFFLIB::FiffInfo &info)
Definition: rtsensordatacontroller.cpp:240
DISP3DLIB::RtSensorDataWorker::setNumberAverages
void setNumberAverages(int iNumAvr)
Definition: rtsensordataworker.cpp:114
DISP3DLIB::RtSensorDataController::setCancelDistance
void setCancelDistance(double dCancelDist)
Definition: rtsensordatacontroller.cpp:175
DISP3DLIB::RtSensorDataController::colormapTypeChanged
void colormapTypeChanged(const QString &sColormapType)
DISP3DLIB::RtSensorDataController::cancelDistanceChanged
void cancelDistanceChanged(double dCancelDist)
DISP3DLIB::RtSensorDataController::setStreamSmoothedData
void setStreamSmoothedData(bool bStreamSmoothedData)
Definition: rtsensordatacontroller.cpp:247
DISP3DLIB::RtSensorDataWorker::setLoopState
void setLoopState(bool bLoopState)
Definition: rtsensordataworker.cpp:144
DISP3DLIB::RtSensorDataController::onNewInterpolationMatrixCalculated
void onNewInterpolationMatrixCalculated(QSharedPointer< Eigen::SparseMatrix< float > > pMatInterpolationMatrix)
Definition: rtsensordatacontroller.cpp:275