v2.0.0
Loading...
Searching...
No Matches
rtsourceinterpolationmatworker.h
Go to the documentation of this file.
1//=============================================================================================================
24
25#ifndef BRAINVIEW_RTSOURCEINTERPOLATIONMATWORKER_H
26#define BRAINVIEW_RTSOURCEINTERPOLATIONMATWORKER_H
27
28//=============================================================================================================
29// INCLUDES
30//=============================================================================================================
31
32#include "../disp3D_global.h"
33
34#include <QObject>
35#include <QMutex>
36#include <QSharedPointer>
37#include <QVector>
38#include <QMap>
39#include <QList>
40#include <QString>
41#include <vector>
42#include <Eigen/Core>
43#include <Eigen/SparseCore>
44
45//=============================================================================================================
46// FORWARD DECLARATIONS
47//=============================================================================================================
48
49namespace FSLIB
50{
51class FsLabel;
52}
53
54//=============================================================================================================
55// DEFINE NAMESPACE
56//=============================================================================================================
57
58namespace DISP3DLIB
59{
60
61//=============================================================================================================
84{
85 Q_OBJECT
86
87public:
88 //=========================================================================================================
97
98 //=========================================================================================================
104 explicit RtSourceInterpolationMatWorker(QObject* parent = nullptr);
105
106 //=========================================================================================================
114 void setInterpolationFunction(const QString& sInterpolationFunction);
115
116 //=========================================================================================================
123 void setCancelDistance(double dCancelDist);
124
125 //=========================================================================================================
133 void setInterpolationInfoLeft(const Eigen::MatrixX3f& matVertices,
134 const std::vector<Eigen::VectorXi>& vecNeighborVertices,
135 const Eigen::VectorXi& vecSourceVertices);
136 //=========================================================================================================
144 void setInterpolationInfoRight(const Eigen::MatrixX3f& matVertices,
145 const std::vector<Eigen::VectorXi>& vecNeighborVertices,
146 const Eigen::VectorXi& vecSourceVertices);
147 //=========================================================================================================
155 void setVisualizationType(int iVisType);
156
157 //=========================================================================================================
166 void setAnnotationInfoLeft(const Eigen::VectorXi& vecLabelIds,
167 const QList<FSLIB::FsLabel>& lLabels,
168 const Eigen::VectorXi& vecVertNo);
169
170 //=========================================================================================================
178 void setAnnotationInfoRight(const Eigen::VectorXi& vecLabelIds,
179 const QList<FSLIB::FsLabel>& lLabels,
180 const Eigen::VectorXi& vecVertNo);
181
182public slots:
183 //=========================================================================================================
189 void computeInterpolationMatrix();
190
191signals:
192 //=========================================================================================================
198 void newInterpolationMatrixLeftAvailable(QSharedPointer<Eigen::SparseMatrix<float>> interpMat);
199
200 //=========================================================================================================
206 void newInterpolationMatrixRightAvailable(QSharedPointer<Eigen::SparseMatrix<float>> interpMat);
207
208private:
209 //=========================================================================================================
216 static double (*resolveInterpolationFunction(const QString& name))(double);
217
218 //=========================================================================================================
229 static QSharedPointer<Eigen::SparseMatrix<float>> computeHemi(
230 const Eigen::MatrixX3f& matVertices,
231 const std::vector<Eigen::VectorXi>& vecNeighborVertices,
232 Eigen::VectorXi vecSourceVertices,
233 double dCancelDist,
234 double (*interpFunc)(double));
235
236 //=========================================================================================================
248 static QSharedPointer<Eigen::SparseMatrix<float>> computeAnnotationOperator(
249 const QList<FSLIB::FsLabel>& lLabels,
250 const QMap<qint32, qint32>& mapLabelIdSrc,
251 const QList<int>& vertNos,
252 int nVertices);
253
254 mutable QMutex m_mutex;
255
256 // LH geometry
257 Eigen::MatrixX3f m_matVerticesLh;
258 std::vector<Eigen::VectorXi> m_vecNeighborsLh;
259 Eigen::VectorXi m_vecSourceVerticesLh;
260 bool m_hasLh = false;
261
262 // RH geometry
263 Eigen::MatrixX3f m_matVerticesRh;
264 std::vector<Eigen::VectorXi> m_vecNeighborsRh;
265 Eigen::VectorXi m_vecSourceVerticesRh;
266 bool m_hasRh = false;
267
268 // Interpolation parameters
269 double m_dCancelDist = 0.05;
270 QString m_sInterpolationFunction = QStringLiteral("cubic");
271
272 // Visualization type
273 int m_iVisualizationType = InterpolationBased;
274
275 // LH annotation data
276 QList<FSLIB::FsLabel> m_lLabelsLh;
277 QMap<qint32, qint32> m_mapLabelIdSourcesLh;
278 QList<int> m_vertNosLh;
279 int m_nAnnotationVerticesLh = 0;
280 bool m_bAnnotationLhInit = false;
281
282 // RH annotation data
283 QList<FSLIB::FsLabel> m_lLabelsRh;
284 QMap<qint32, qint32> m_mapLabelIdSourcesRh;
285 QList<int> m_vertNosRh;
286 int m_nAnnotationVerticesRh = 0;
287 bool m_bAnnotationRhInit = false;
288};
289
290} // namespace DISP3DLIB
291
292#endif // BRAINVIEW_RTSOURCEINTERPOLATIONMATWORKER_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
FreeSurfer surface, annotation and parcellation I/O for mne-cpp.
3-D brain visualisation using the Qt RHI rendering backend.
Background worker for computing source interpolation matrices.
void newInterpolationMatrixRightAvailable(QSharedPointer< Eigen::SparseMatrix< float > > interpMat)
void newInterpolationMatrixLeftAvailable(QSharedPointer< Eigen::SparseMatrix< float > > interpMat)
A FreeSurfer/MNE surface label: per-vertex indices, Tk-RAS positions and scalar values for one hemisp...
Definition fs_label.h:81