InvPwlRapMusic
Namespace: INVLIB · Library: Inverse Library
#include <inv/inv_pwl_rap_music.h>
class INVLIB::InvPwlRapMusic
Powell-accelerated RAP MUSIC variant using gradient-free optimization for refined dipole fitting.
ToDo Detailed description
// Noise-free data from the two sources with different time courses; RAP-MUSIC scans source pairs.
const int nSamples = 60;
MatrixXd measured(G.rows(), nSamples);
for (int t = 0; t < nSamples; ++t)
measured.col(t) = g1 * std::sin(0.21 * t) + g2 * std::sin(0.53 * t + 0.4);
QList<InvDipolePair<double>> pairs;
InvRapMusic rap(fwd, false, 1, 0.5); // one correlated pair, subspace correlation >= 0.5
rap.calculateInverse(measured, pairs);
QList<InvDipolePair<double>> powellPairs;
InvPwlRapMusic pwlRap(fwd, false, 1, 0.5); // Powell coordinate search: far fewer pairs, may stop at a local optimum
pwlRap.calculateInverse(measured, powellPairs);
Inheritance
Public Methods
InvPwlRapMusic()
Default constructor creates an empty POWELL RAP MUSIC algorithm which still needs to be initialized.
InvPwlRapMusic(p_pFwd, p_bSparsed, p_iN, p_dThr)
Constructor which initializes the POWELL RAP MUSIC algorithm with the given model.
Parameters:
-
p_pFwd : MNEForwardSolution & The model which contains the gain matrix and its corresponding grid matrix.
-
p_bSparsed : bool True when sparse matrices should be used.
-
p_iN : int The number (default 2) of uncorrelated sources, which should be found. Starting with. the strongest.
-
p_dThr : double The correlation threshold (default 0.5) at which the search for sources stops.
~InvPwlRapMusic()
calculateInverse(p_fiffEvoked, pick_normal)
Note: Since they are virtual they have to be implemented to be called.
Even so the base class RAP MUSIC implementation is called.
Parameters:
-
p_fiffEvoked : const FiffEvoked & Evoked data to localize.
-
pick_normal : bool Keep only the component normal to the cortex.
calculateInverse(data, tmin, tstep, pick_normal)
Note: Since they are virtual they have to be implemented to be called.
Even so the base class RAP MUSIC implementation is called.
Parameters:
-
data : const Eigen::MatrixXd & Measurement data (channels x samples).
-
tmin : float Time of the first sample in seconds.
-
tstep : float Time between samples in seconds.
-
pick_normal : bool Keep only the component normal to the cortex.
calculateInverse(p_matMeasurement, p_RapDipoles)
getName()
Static Methods
PowellOffset(p_iRow, p_iNumPoints)
PowellIdxVec(p_iRow, p_iNumPoints, p_pVecElements)
Example
- Full source:
src/examples/ex_inv_beamformer/main.cpp - Build target:
ex_inv_beamformer(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_inv_beamformer
Inverse library: LCMV and DICS beamformers and the RAP-MUSIC family of dipole scanners.
InvRapMusic rap(fwd, false, 1, 0.5); // one correlated pair, subspace correlation >= 0.5
rap.calculateInverse(measured, pairs);
QList<InvDipolePair<double>> powellPairs;
InvPwlRapMusic pwlRap(fwd, false, 1, 0.5); // Powell coordinate search: far fewer pairs, may stop at a local optimum
pwlRap.calculateInverse(measured, powellPairs);
ok &= expect(pairs.size() == 1 && isPair(pairs[0], 10, 50) && pairs[0].m_vCorrelation > 1.0 - 1e-6 && powellPairs.size() == 1 && powellPairs[0].m_vCorrelation > 0.99,
QString("InvRapMusic/InvPwlRapMusic/InvDipolePair: the exhaustive scan finds sources 10 and 50 (correlation 1), Powell a pair at %1")
.arg(powellPairs.isEmpty() ? 0.0 : powellPairs[0].m_vCorrelation, 0, 'f', 4));
ex_clustered_inverse_pwl_rap_music_raw
Example of the computation of a raw clustered inverse Powell RAP-MUSIC.
//
// Compute inverse solution
//
InvPwlRapMusic t_pwlRapMusic(t_clusteredFwd, false, numDipolePairs);
ex_inverse_pwl_rap_music
Example of MNEForwardSolution and Powell Rap Music application.
InvPwlRapMusic t_pwlRapMusic(t_clusteredFwd, false, numDipolePairs);
Also used in ex_roi_clustered_inverse_pwl_rap_music, ex_st_clustered_inverse_pwl_rap_music.
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>