v2.0.0
Loading...
Searching...
No Matches
inv_cmne.h
Go to the documentation of this file.
1//=============================================================================================================
26
27#ifndef INV_CMNE_H
28#define INV_CMNE_H
29
30//=============================================================================================================
31// INCLUDES
32//=============================================================================================================
33
34#include "../inv_global.h"
36#include "inv_cmne_settings.h"
37
38//=============================================================================================================
39// EIGEN INCLUDES
40//=============================================================================================================
41
42#include <Eigen/Core>
43#include <Eigen/Dense>
44
45//=============================================================================================================
46// FORWARD DECLARATIONS
47//=============================================================================================================
48
49#ifndef WASMBUILD
50namespace UTILSLIB
51{
53}
54#endif
55
56//=============================================================================================================
57// DEFINE NAMESPACE INVLIB
58//=============================================================================================================
59
60namespace INVLIB
61{
62
63//=============================================================================================================
79
80//=============================================================================================================
93{
94public:
95 //=========================================================================================================
107 static InvCMNEResult compute(
108 const Eigen::MatrixXd& matEvoked,
109 const Eigen::MatrixXd& matGain,
110 const Eigen::MatrixXd& matNoiseCov,
111 const Eigen::MatrixXd& matSrcCov,
112 const InvCMNESettings& settings);
113
114 //=========================================================================================================
129 static bool applyCmne(const Eigen::MatrixXd& matDspmData,
130 const QString& onnxModelPath,
131 Eigen::MatrixXd& sensing,
132 Eigen::MatrixXd& prediction,
133 Eigen::MatrixXd& cmne);
134
135 //=========================================================================================================
145 static Eigen::MatrixXd controlEstimate(const Eigen::MatrixXd& matDspmData, int lookBack);
146
147 //=========================================================================================================
155 static Eigen::MatrixXd zScoreRectify(const Eigen::MatrixXd& matStcData);
156
157 //=========================================================================================================
158#ifndef WASMBUILD
184 const QString& fwdPath,
185 const QString& covPath,
186 const QString& epochsPath,
187 const QString& outOnnxPath,
188 const InvCMNESettings& settings,
189 const QString& gtStcPrefix = {},
190 int hiddenSize = 256,
191 int numLayers = 1,
192 int trainEpochs = 50,
193 double learningRate = 1e-3,
194 int batchSize = 64,
195 const QString& finetuneOnnxPath = {},
196 const QString& pythonExe = QStringLiteral("python3"));
197#endif
198
199private:
200 //=========================================================================================================
211 static Eigen::MatrixXd computeDspmKernel(
212 const Eigen::MatrixXd& matGain,
213 const Eigen::MatrixXd& matNoiseCov,
214 const Eigen::MatrixXd& matSrcCov,
215 double lambda2);
216
217 static Eigen::MatrixXd standardize(const Eigen::MatrixXd& matStcData);
218};
219
220} // namespace INVLIB
221
222#endif // INV_CMNE_H
INVLIB library export/import macros, build-info accessors, and namespace docstring for the inverse-so...
#define INVSHARED_EXPORT
Definition inv_global.h:38
InvSourceEstimate value type — central source-space data container produced by every INVLIB inverse s...
Settings record for the INVLIB::InvCMNE solver (model path, sliding-window length,...
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Inverse source estimation (MNE, dSPM, sLORETA, dipole fitting).
Source-space inverse-solution container with dense grid plus optional focal-dipole,...
CMNE result.
Definition inv_cmne.h:72
InvSourceEstimate stcSensing
Definition inv_cmne.h:74
InvSourceEstimate stcDspm
Definition inv_cmne.h:73
InvSourceEstimate stcCmne
Definition inv_cmne.h:75
Eigen::MatrixXd matKernelDspm
Definition inv_cmne.h:77
InvSourceEstimate stcLstmPredict
Definition inv_cmne.h:76
CMNE inverse solver.
Definition inv_cmne.h:93
static InvCMNEResult compute(const Eigen::MatrixXd &matEvoked, const Eigen::MatrixXd &matGain, const Eigen::MatrixXd &matNoiseCov, const Eigen::MatrixXd &matSrcCov, const InvCMNESettings &settings)
Definition inv_cmne.cpp:68
static Eigen::MatrixXd zScoreRectify(const Eigen::MatrixXd &matStcData)
Definition inv_cmne.cpp:178
static Eigen::MatrixXd controlEstimate(const Eigen::MatrixXd &matDspmData, int lookBack)
Definition inv_cmne.cpp:185
static bool applyCmne(const Eigen::MatrixXd &matDspmData, const QString &onnxModelPath, Eigen::MatrixXd &sensing, Eigen::MatrixXd &prediction, Eigen::MatrixXd &cmne)
Definition inv_cmne.cpp:197
static UTILSLIB::PythonRunnerResult trainLstm(const QString &fwdPath, const QString &covPath, const QString &epochsPath, const QString &outOnnxPath, const InvCMNESettings &settings, const QString &gtStcPrefix={}, int hiddenSize=256, int numLayers=1, int trainEpochs=50, double learningRate=1e-3, int batchSize=64, const QString &finetuneOnnxPath={}, const QString &pythonExe=QStringLiteral("python3"))
Definition inv_cmne.cpp:245
Script execution result container.