31 const QString &rhPath,
39 , m_lhSurface(lhSurface)
40 , m_rhSurface(rhSurface)
41 , m_cancelDist(cancelDist)
53QSharedPointer<Eigen::SparseMatrix<float>> StcLoadingWorker::computeInterpolationMatrix(
54 const Eigen::MatrixX3f &matVertices,
55 Eigen::VectorXi &vecSourceVertices,
57 const QString &hemiLabel,
61 emit
progress(progressStart, QString(
"Computing %1 geodesic interpolation...").arg(hemiLabel));
64 std::vector<Eigen::VectorXi> vecNeighbors;
65 if (hemiLabel ==
"LH" && m_lhSurface) {
67 }
else if (hemiLabel ==
"RH" && m_rhSurface) {
68 vecNeighbors = m_rhSurface->computeNeighbors();
75 const int progressRange = progressEnd - progressStart;
76 auto progressCallback = [
this, &hemiLabel, progressStart, progressRange](
int current,
int total) {
77 if (m_cancelled.load(std::memory_order_relaxed))
79 int pct = progressStart + (progressRange * current) / total;
80 emit
progress(pct, QString(
"%1 geodesic interpolation %2/%3").arg(hemiLabel).arg(current).arg(total));
93 if (m_cancelled.load(std::memory_order_relaxed))
94 return QSharedPointer<Eigen::SparseMatrix<float>>();
96 emit
progress(progressEnd, QString(
"%1 interpolation matrix ready").arg(hemiLabel));
104 emit
progress(0,
"Loading STC files...");
107 if (!m_lhPath.isEmpty()) {
108 QFile file(m_lhPath);
114 emit
error(QString(
"Failed to read LH STC file: %1").arg(m_lhPath));
118 emit
progress(5,
"Loading RH STC file...");
121 if (!m_rhPath.isEmpty()) {
122 QFile file(m_rhPath);
128 emit
error(QString(
"Failed to read RH STC file: %1").arg(m_rhPath));
132 if (!m_hasLh && !m_hasRh) {
133 emit
error(
"No STC data could be loaded.");
138 if (m_cancelled.load(std::memory_order_relaxed)) { emit
finished(
false);
return; }
141 if (m_hasLh && m_lhSurface) {
142 Eigen::MatrixX3f matVertices = m_lhSurface->verticesAsMatrix();
143 Eigen::VectorXi vecSourceVertices = m_stcLh.vertices;
145 if (vecSourceVertices.size() > 0) {
146 m_interpMatLh = computeInterpolationMatrix(matVertices, vecSourceVertices, m_cancelDist,
148 if (m_cancelled.load(std::memory_order_relaxed)) { emit
finished(
false);
return; }
153 if (m_hasRh && m_rhSurface) {
154 Eigen::MatrixX3f matVertices = m_rhSurface->verticesAsMatrix();
155 Eigen::VectorXi vecSourceVertices = m_stcRh.vertices;
157 if (vecSourceVertices.size() > 0) {
158 m_interpMatRh = computeInterpolationMatrix(matVertices, vecSourceVertices, m_cancelDist,
160 if (m_cancelled.load(std::memory_order_relaxed)) { emit
finished(
false);
return; }
Renderable cortical / BEM mesh with interleaved vertex attributes and Qt-RHI buffer management.
Background worker that loads source-time-course (.stc) files and prepares per-hemisphere interpolatio...
Distance-based sparse interpolation weights and per-frame signal smoothing on triangulated meshes.
Surface-constrained geodesic distance and sensor-to-mesh projection helpers.
static QSharedPointer< Eigen::SparseMatrix< float > > scdcInterpolationMat(const Eigen::MatrixX3f &matVertices, const std::vector< Eigen::VectorXi > &vecNeighborVertices, const Eigen::VectorXi &vecVertSubset, double(*interpolationFunction)(double), double dCancelDist, std::function< void(int, int)> progressCallback=nullptr, const std::atomic< bool > *cancelledFlag=nullptr)
scdcInterpolationMat Computes geodesic distances (SCDC) and builds the sparse interpolation matrix in...
static double cubic(const double dIn)
cubic Cubic hyperbola interpolation function.
Renderable cortical surface mesh with per-vertex color, curvature data, and GPU buffer management.
std::vector< Eigen::VectorXi > computeNeighbors() const
void error(const QString &message)
void progress(int percent, const QString &message)
void finished(bool success)
StcLoadingWorker(const QString &lhPath, const QString &rhPath, BrainSurface *lhSurface, BrainSurface *rhSurface, double cancelDist=0.05, QObject *parent=nullptr)
Source-space inverse-solution container with dense grid plus optional focal-dipole,...
static bool read(QIODevice &p_IODevice, InvSourceEstimate &p_stc)