34 const QString& rhPath,
42, m_lhSurface(lhSurface)
43, m_rhSurface(rhSurface)
44, m_cancelDist(cancelDist)
56QSharedPointer<Eigen::SparseMatrix<float>> StcLoadingWorker::computeInterpolationMatrix(
57 const Eigen::MatrixX3f& matVertices,
58 Eigen::VectorXi& vecSourceVertices,
60 const QString& hemiLabel,
64 emit
progress(progressStart, QString(
"Computing %1 geodesic interpolation...").arg(hemiLabel));
67 std::vector<Eigen::VectorXi> vecNeighbors;
68 if (hemiLabel ==
"LH" && m_lhSurface) {
70 }
else if (hemiLabel ==
"RH" && m_rhSurface) {
78 const int progressRange = progressEnd - progressStart;
79 auto progressCallback = [
this, &hemiLabel, progressStart, progressRange](
int current,
int total) {
80 if (m_cancelled.load(std::memory_order_relaxed))
82 int pct = progressStart + (progressRange * current) / total;
83 emit
progress(pct, QString(
"%1 geodesic interpolation %2/%3").arg(hemiLabel).arg(current).arg(total));
95 if (m_cancelled.load(std::memory_order_relaxed))
96 return QSharedPointer<Eigen::SparseMatrix<float>>();
98 emit
progress(progressEnd, QString(
"%1 interpolation matrix ready").arg(hemiLabel));
106 emit
progress(0,
"Loading STC files...");
109 if (!m_lhPath.isEmpty()) {
110 QFile file(m_lhPath);
116 emit
error(QString(
"Failed to read LH STC file: %1").arg(m_lhPath));
120 emit
progress(5,
"Loading RH STC file...");
123 if (!m_rhPath.isEmpty()) {
124 QFile file(m_rhPath);
130 emit
error(QString(
"Failed to read RH STC file: %1").arg(m_rhPath));
134 if (!m_hasLh && !m_hasRh) {
135 emit
error(
"No STC data could be loaded.");
140 if (m_cancelled.load(std::memory_order_relaxed)) {
146 if (m_hasLh && m_lhSurface) {
147 Eigen::MatrixX3f matVertices = m_lhSurface->verticesAsMatrix();
148 Eigen::VectorXi vecSourceVertices = m_stcLh.vertices;
150 if (vecSourceVertices.size() > 0) {
151 m_interpMatLh = computeInterpolationMatrix(matVertices, vecSourceVertices, m_cancelDist,
153 if (m_cancelled.load(std::memory_order_relaxed)) {
161 if (m_hasRh && m_rhSurface) {
162 Eigen::MatrixX3f matVertices = m_rhSurface->verticesAsMatrix();
163 Eigen::VectorXi vecSourceVertices = m_stcRh.vertices;
165 if (vecSourceVertices.size() > 0) {
166 m_interpMatRh = computeInterpolationMatrix(matVertices, vecSourceVertices, m_cancelDist,
168 if (m_cancelled.load(std::memory_order_relaxed)) {
Background worker that loads source-time-course (.stc) files and prepares per-hemisphere interpolatio...
Renderable cortical / BEM mesh with interleaved vertex attributes and Qt-RHI buffer management.
Distance-based sparse interpolation weights and per-frame signal smoothing on triangulated meshes.
Surface-constrained geodesic distance and sensor-to-mesh projection helpers.
3-D brain visualisation using the Qt RHI rendering backend.
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 finished(bool success)
void progress(int percent, const QString &message)
StcLoadingWorker(const QString &lhPath, const QString &rhPath, BrainSurface *lhSurface, BrainSurface *rhSurface, double cancelDist=0.05, QObject *parent=nullptr)
void error(const QString &message)
Source-space inverse-solution container with dense grid plus optional focal-dipole,...
static bool read(QIODevice &p_IODevice, InvSourceEstimate &p_stc)