CMNE inverse solver. More...
#include <inv_cmne.h>
Static Public Member Functions | |
| static InvCMNEResult | compute (const Eigen::MatrixXd &matEvoked, const Eigen::MatrixXd &matGain, const Eigen::MatrixXd &matNoiseCov, const Eigen::MatrixXd &matSrcCov, const InvCMNESettings &settings) |
| static Eigen::MatrixXd | applyLstmCorrection (const Eigen::MatrixXd &matDspmData, const QString &onnxModelPath, int lookBack) |
| static UTILSLIB::PythonRunnerResult | trainLstm (const QString &fwdPath, const QString &covPath, const QString &epochsPath, const QString &outOnnxPath, const InvCMNESettings &settings, const QString >StcPrefix={}, int hiddenSize=256, int numLayers=1, int trainEpochs=50, double learningRate=1e-3, int batchSize=64, const QString &finetuneOnnxPath={}, const QString &pythonExe=QStringLiteral("python3")) |
CMNE inverse solver.
Contextual Minimum Norm Estimate (CMNE) inverse solver.
Implements the algorithm from: Dinh et al. "Contextual Minimum-Norm Estimates (CMNE): A Deep Learning Method for Source Estimation in Neuroimaging", 2021.
Definition at line 92 of file inv_cmne.h.
|
static |
Apply LSTM-based temporal correction to z-scored rectified dSPM data.
| [in] | matDspmData | Z-scored rectified dSPM data (n_sources x n_times). |
| [in] | onnxModelPath | Path to ONNX model file. |
| [in] | lookBack | Number of past time steps (k). |
Definition at line 234 of file inv_cmne.cpp.
|
static |
Compute CMNE inverse solution.
| [in] | matEvoked | Evoked data (n_channels x n_times). |
| [in] | matGain | Forward gain matrix (n_channels x n_sources). |
| [in] | matNoiseCov | Noise covariance (n_channels x n_channels). |
| [in] | matSrcCov | Source covariance (n_sources x n_sources, diagonal). |
| [in] | settings | CMNE settings. |
Definition at line 77 of file inv_cmne.cpp.
|
static |
Train the CMNE LSTM model by invoking the Python training script.
This is a convenience wrapper that calls scripts/ml/training/train_cmne_lstm.py via UTILSLIB::PythonRunner. The heavy lifting (PyTorch LSTM training + ONNX export) happens in Python; C++ only launches the process and streams its output.
| [in] | fwdPath | Path to forward solution FIFF file. |
| [in] | covPath | Path to noise covariance FIFF file. |
| [in] | epochsPath | Path to epochs FIFF file. |
| [in] | outOnnxPath | Desired output path for the ONNX model. |
| [in] | settings | CMNE settings (look-back, method, SNR are forwarded). |
| [in] | gtStcPrefix | Ground-truth STC prefix (optional; empty = simulation mode). |
| [in] | hiddenSize | LSTM hidden dimension (default 256). |
| [in] | numLayers | LSTM layers (default 1). |
| [in] | trainEpochs | Number of training epochs (default 50). |
| [in] | learningRate | Learning rate (default 1e-3). |
| [in] | batchSize | Batch size (default 64). |
| [in] | finetuneOnnxPath | Existing ONNX model to fine-tune from (optional). |
| [in] | pythonExe | Python interpreter (default "python3"). |
Definition at line 329 of file inv_cmne.cpp.