-
Notifications
You must be signed in to change notification settings - Fork 1
Inverse problem solver
Alejandro Ojeda edited this page Apr 15, 2025
·
5 revisions
This function implements the RSBL inverse filtering algorithm described here. The RSBL algorithm does automatic data cleaning, source separation, and imaging. This implementation works as a filter, sample by sample, trial by trial, so the results are a "cleaned" EEG and source time series of the same trial dimension as the input.
If you use this code, please cite our paper below. Thank you!
Ojeda A, Kreutz-Delgado K, Mishra J. Bridging M/EEG Source Imaging and Independent Component Analysis Frameworks Using Biologically Inspired Sparsity Priors. Neural Comput. 2021 Aug 19;33(9):2408-2438. doi: 10.1162/neco_a_01415. PMID: 34412115; PMCID: PMC8384561.
EEG = pop_rsbl(EEG, saveFull, account4artifacts, src2roiReductionType, solverType, updateFreq)
Input arguments:
-
EEG
: EEGLAB's structure with a validEEG.etc.src.hmfile
field, otherwise it callspop_forwardModel
to compute the forward model, -
saveFull
: enables saving the current density tensor in the cortical space (default: true). This option is necessary to visualize source maps on the cortical surface (e.g., with functionpop_eegbrowserx
). This option can take a lot of RAM, so it is not recommended for processing unepoch data. If the source tensor does not fit into RAM, we use memory-mapped files (under the hood). -
account4artifacts
: enables artifact modeling (default: true). -
src2roiReductionType
: method for reducing the source activity from the cortical space to the ROI space (default: mean). Supported methods are: mean - each ROI takes the mean of the source values within it, sum - each ROI takes the sumation of allthe source values within it, power - each ROI takes the power of the source values within it (the power makes sense when xyz components are estimated). -
solverType
: optimization algorithm, usebsbl
orloreta
. -
updateFreq
: we update the parameter that controls the sensor noise variancelambda
and the sparsity profile of the sourcesgamma
everyupdateFreq
samples (default: 1). Values over 10 may speed up the algorithm significantly at the price of perhaps missing transient dynamics.
Output arguments:
-
EEG.data
: tensor of the same size of the input data but reconstructed using cortical source activity, -
EEG.etc.src.actFull
: a tensor of number of sources byEEG.pnts
byEEG.trials
that contains the source time series, -
EEG.etc.src.act
: same asEEG.etc.src.actFull
but the first dimension is collapsed within ROIs that correspond to the atlas in the head model, resulting in a tensor of number of ROI byEEG.pnts
byEEG.trials
, -
EEG.etc.src.roi
: cell array of ROI labels. -
EEG.etc.src.gamma
: array of sparsity profile of the sources (scale) of size number of ROI (and artifact sources in case thataccount4artifacts=true
) by time by trials. -
EEG.etc.src.indG
: indices of cortical cources, e.g.,x = EEG.etc.src.actFull(EEG.etc.src.indG,:,:);
, -
EEG.etc.src.indV
: indices of artifact sources, e.g.,a = EEG.etc.src.actFull(EEG.etc.src.indV,:,:);
-
EEG.etc.src.logE
: value of the optimization function obtained everyupdateFreq
samples.