1 Introduction

This article aims to advance mathematical inverse methodology in focal localization of brain activity at different depths based on non-invasive electroencephalography (EEG) measurements [40]. In particular, we consider the challenging task of reconstructing simultaneous cortical and sub-cortical brain activity by comparing advanced reconstruction algorithms to find a solution. The EEG source localization task generally constitutes an ill-posed inverse problem [26], i.e., it does not have a unique solution and is sensitive to different modelling and measurement errors. Consequently, only a slight amount of noise in the measurement can significantly affect the reconstruction found by the inversion algorithm. This is especially the case for the far-field activity components, e.g., sub-cortical activity. The feasibility of depth-localization with non-invasive measurements has recently been suggested in studies concentrating on high-density measurements and filtering [44, 52].

We approach the source localization task presented via the recently proposed [47] distributional reconstruction strategy [47] that utilizes a hierarchical Bayesian model (HBM) to incorporate a priori information and, at the same time, decomposes the source space into randomized sets at several different resolution levels to reduce modelling errors. This hybrid technique comprises the iterative alternating sequential (IAS) [11] posterior optimization method and the so-called randomized multiresolution scan (RAMUS), i.e., a Monte Carlo sampling approach that aims at marginalizing the modelling erros over the source space decomposition. In this article, we introduce an extended version of this technique via the conditionally exponential prior (CEP), i.e., an exponential power distribution also referred to as a generalized normal distribution [39], which generalizes the well-known concept of the conditionally Gaussian prior (CGP) [11]. CEP includes a variable prior degree parameter q that defines the \(\ell _q\)-norm applied in the argument of the exponential prior probability density function. Bayesian formulation of the model allows us to use the methods of statistical analysis to find an estimate for the brain activity, especially, the expectation maximization (EM) and iterative alternating sequential (IAS) method which are, in the case of CEP, algorithmically similar to \(\ell _q\)-reweighted methods considered in [59] for \(q=1,2\). But, as a difference, the hierarchical prior structure allows taking into account [46] the physical and physiological properties of the underlying primary currents, here, in particular, the shape and scale parameter steering of the gamma hyperprior of CEP.

Our focus is in particular on developing a new methodology that is applicable in hybrid with the RAMUS technique to enhance the detectability of both cortical and sub-cortical activity [47]. RAMUS differs from the other recently introduced parcellation techniques [16, 35] as it does not try to reduce variable dimension, i.e., source space size, or divide spatially the problem to sub-problems but rather gathers information from multiple randomized source spaces with different resolutions to strengthen dipole localization at any depth. A similar method with a coarse-to-fine hierarchy has been shown to improve the detectability of sub-cortical activity in [32]. However, this method limits its parcellation to cortical level and changes the whole inversion problem with its observations progressively, whereas RAMUS keeps observation untouched, relying only on the sparsity of the source space.

We show mathematically how the HBM approach, previously introduced in [11], can be extended to the case of the CEP and how the resulting statistical framework can be associated with the previously described CGP model and the reweighted posterior optimization methods that are applicable with RAMUS as they allow a hyperparameter progression over multiple resolution levels. In previous studies, the RAMUS technique is applied with CGP [46, 47] concentrating on the detectability of the deep components, while here we investigate CEP as a potential focality enhancer. As shown in [47], the numerical implementation of the method is an important factor contributing to the eventual performance of the inverse model. Therefore, we investigate EM and IAS as two alternative techniques for maximizing the posterior, and compare the prior degrees \(q=1\) and \(q=2\) in reconstructing different synthetic source configurations. In the former case, the reconstruction is found by applying the Lasso algorithm [56]. Similar Laplace prior models have been previously studied in a Bayesian framework with variance components as hyperparameters in [3, 55].

In the numerical experiments, we aim to find the best combination of posterior maximizing algorithm and prior degree considering the estimation accuracy obtained for cortical and sub-cortical sources. RAMUS is applied to reduce the modelling errors to improve the detection of deep components. As a forward modelling technique, we apply the finite element method (FEM) [36, 37, 45] which is advantageous in the present application, since it, as a volumetric technique, allows the head model to be decomposed into multiple highly accurate cortical and sub-cortical compartments. The results are compared with estimates obtained with the Sequential semi-analytic Monte Carlo estimation (SESAME) technique, which is a recently introduced Monte Carlo-based algorithm [53] for Bayesian dipole localization.

The synthetic measurements are produced according to the well-studied somatosensory evoked potentials (SEPs) occurring in the human median nerve stimulation [1, 6, 7, 27, 40]. The median nerve SEPs have known originators, i.e., locations of neural sources at given measurement time points.. The early components occurring \(\le \) 20 ms post-stimulus involve sub-cortical far-field activity, i.e., activity far from the electrodes, which we here simulate and reconstruct numerically utilizing the CEP model together with a realistic head model segmentation. We consider especially the P14/N14, P16/N16 and P20/N20 components, i.e., the positive (P) and negative (N) 14, 16 and 20 ms post-stimulus peaks in the measured data with respect to the forehead potential. This setup not only fulfills the requirements of our numerical experiments but reflects to the source localization from real SEP data peaks [48].

The results obtained suggest that the first-degree CEP provides an advantageous approach to detect focal near- and far-field activity when it is applied together with the RAMUS technique. Namely, while both CEP prior degrees yield a similar source localization accuracy, the activity reconstructed via the first-degree CEP is overall more well-localized compared to CGP. This was found to be the case for simultaneous thalamic and cortical activity, approximating the simulated originators of P20/N20, as well as for a sub-thalamic dipolar or quadrupolar source configuration corresponding approximately to the originators of P14/N14 and P16/N16 [9, 41], respectively. Compared to SESAME, the proposed combination of RAMUS and CEP was found to be advantageous considering its robustness to high noise effects. In turn, SESAME can produce accurate localized activity in most cases, while it tends to show false activity on the cortical level in cases, where the cortical activity is absent (P14/N14 and P16/N16).

This article is organized as follows: In Sect. 2 we present a generalized exponential prior model to HBM-based source localization and the EM and IAS algorithms as well as the main principles behind RAMUS and SESAME. Section 3 concentrates on the implementation of this methodology. The results are presented in Sect. 4 and discussed in Sect. 5. Finally, Sect. 6 concludes the study.

2 Methods

In this section, we introduce the hierarchical Bayesian framework for CEP model. Next, the statistical iterative maximum a posterior algorithms are derived for the model and, after that, we give some hypothetical and theoretical background for the randomized multiresolution scanning and the usage of multiple source space resolutions. Finally, we introduce Sequential semi-analytic Monte Carlo estimation and the assumptions behind it.

2.1 Hierarchical Bayesian Framework for a Conditionally Exponential Prior

We consider the linear EEG observation model

$$\begin{aligned} \mathbf{y}=\mathbf{L} \mathbf{x}+\mathbf{e}, \end{aligned}$$
(1)

where \(\mathbf{x}\in \mathbb {R}^{3n}\), \(\mathbf{y} \in \mathbb {R}^m\) and \(\mathcal {N}(\mathbf{e};0,\sigma ^2)\) with \(\sigma \) a scale-invariant prior. From Bayes’ rule we have \( \pi (\mathbf{x} \mid \mathbf{y}) \propto \pi (\mathbf{y} \mid \mathbf{x})\pi (\mathbf{x})\). The leadfield matrix L is obtained via the finite element method applied to Maxwell’s equations in the quasi-static approximation. The unknown \(\mathbf{x}\) represents the discretized primary current distribution \(\mathbf{J}\) (vector field) of the neural activity in a three-dimensional source space with n possible source locations. At a given position, \(\mathbf{J}\) is described by a three-component vector or, equivalently, three entries of \(\mathbf{x}\), i.e., a vector \( \left( x_{3\mu -2},\, x_{3\mu -1},\, x_{3\mu } \right) \), where \(\mu =1\ldots n\). Given the likelihood function \(\pi (\mathbf{y} \mid \mathbf{x})\propto \)

\(\exp {\left( -\frac{1}{2\sigma ^2}\Vert \mathbf{L} \mathbf{x}-\mathbf{y}\Vert _2^2\right) }\) and a subjectively selected prior \(\pi (\mathbf{x})\), the posterior \(\pi (\mathbf{x} \mid \mathbf{y})\) is assumed to contain all the information about the underlying source activity. We associate each component \(x_i\) with an exponential power distribution

$$\begin{aligned} \pi (x_i ,1/\gamma _{i},q)\propto \gamma _{i}^{1/q}\exp {\left( -{\gamma _{i}|x_i|^{q}}\right) } \end{aligned}$$
(2)

determined by the hyperparameter \(\gamma _i\) and the degree q of the prior, which is selected to be either one or two in this study. Our choice of hyperparameter differs from a common choice, separable prior variance variables, that are reciprocal to \(\gamma _i\) [11, 23, 51, 58]. With this choice we gain two desirable properties: analytic expression for posterior maximizing hyperparameters and stability by avoiding a tendency to infinity. Selecting between \(q=1\) and \(q=2\) allows one to steer the focality of the reconstruction, since the exponential distribution can be justified to be more heavy-tailed in the former case (i.e., Laplace distribution). By introducing an extra level of hierarchy in this prior (2), we aim to obtain a minimization problem that allows reconstructing more focal, intensity-unbiased or deeper sources, as suggested in [11, 47], compared to the minimization problem that employs a fixed \(\gamma _{i}\) together with the Laplace prior, when \(q=1\), or the standard Gaussian prior, when \(q=2\). Consequently, the current analysis belongs to the hierarchical Bayesian adaptive framework introduced, e.g., in [38]. In particular, with \(\gamma _{i}\) being a random variable following a Gamma hyperprior distribution, i.e., \(\gamma _{i}\sim \mathrm {Ga}(\kappa _{},\theta _{})\) for \(i=1,\ldots ,3n\), where its density function is

$$\begin{aligned} \pi (\gamma _i)=\frac{\theta ^\kappa \gamma _i^{\kappa -1}e^{-\theta \gamma _i}}{\Gamma (\kappa )} \end{aligned}$$
(3)

for \(\kappa ,\, \theta >0\). \(\pi (\gamma _{i}|x_i)\) is also a Gamma distribution, that is, \(\gamma _{i}|x_i\sim \mathrm {Ga}(\gamma _{i}|x_i;\kappa _{}+1/q,\theta _{}+|x_i|^{q})\) by conjugacy. The full posterior obeying a CEP

\(\pi (\mathbf{x} \mid \mathbf{\gamma })\) is given by

$$\begin{aligned} \begin{aligned} \pi (\mathbf{x},{{\varvec{\gamma }}} \mid \mathbf{y})&\propto \pi (\mathbf{y}\mid \mathbf{x})\;\pi (\mathbf{x}\mid {{\varvec{\gamma }}})\;\pi ({{\varvec{\gamma }}})\\&=\pi (\mathbf{y}\mid \mathbf{x}) \; \prod _{i=1}^{3n} \pi (x_i \mid \gamma _{i}) \;\pi (\gamma _{i}), \end{aligned} \end{aligned}$$
(4)

where \(\pi (\mathbf{x}\mid {{\varvec{\gamma }}})\) and \(\pi ({{\varvec{\gamma }}})\) correspond to the CEP following from (2) and the hyperprior, respectively. In the following subsections, we use two different approaches to estimate the mode of the marginal posterior \(\pi (\mathbf{x} \mid \mathbf{y})\) given the CEP. The first one relies on EM and the second one on IAS [11,12,13].

2.2 EM for the Hierarchical Adaptive Framework

The EM-based maximum a posteriori (MAP) estimate is given by the system

$$\begin{aligned} \begin{aligned} \hat{\mathbf{x}}^{(j+1)}&= \,\underset{\mathbf{x}}{\hbox {arg max}} \Big \{ -\frac{1}{2\sigma ^2}\Vert \mathbf{L}{} \mathbf{x}-\mathbf{y}\Vert _2^2 \\&+\mathbb {E}_{\pi ({{\varvec{\gamma }}}|\hat{\mathbf{x}}^{(j)})}[\log \pi (\mathbf{x} \mid {{\varvec{\gamma }}})]\Big \}, \end{aligned} \end{aligned}$$
(5)

where the expectation of \(\log \pi (\mathbf{x} \mid {{\varvec{\gamma }}})\) with respect to the conditional probability density \(\pi ({{\varvec{\gamma }}}|\hat{\mathbf{x}}^{(j)})\) and \(\pi (\gamma _{i}|\hat{x}_i^{(j)})\) given the MAP estimate \(\hat{x}_i^{(j)}\) for \(i=1,\ldots ,3n\) is

$$\begin{aligned} \begin{aligned} \mathbb {E}_{\pi ({{\varvec{\gamma }}}|\hat{\mathbf{x}}^{(j)})}[\log \pi (\mathbf{x} | {{\varvec{\gamma }}})]&=\sum _{i=1}^{3n}\mathbb {E}_{\pi (\gamma _{i}|\hat{x}_i^{(j)})}[\log \pi (x_i|\gamma _{i})]\\&=\sum _{i=1}^{3n} \int _{0}^\infty \pi (\gamma _{i}|\hat{x}_i^{(j)}) \log \pi (x_i|\gamma _{i})\;d\gamma _{i} \\&=- \! \sum _{i=1}^{3n} \! |x_i|^{q \! }\int _{0}^\infty \! \gamma _{i} \, \pi (\gamma _{i}|\hat{x}_i^{(j)}) \; d\gamma _{i} \! + \! C, \end{aligned} \end{aligned}$$
(6)

with \(\mathbb {E}_{\pi (\gamma _{i}|\hat{x}_i^{(j)})}[\gamma _{i}]= \int _{0}^\infty \gamma _{i}\pi (\gamma _{i}|\hat{x}_i^{(j)}) \; d\gamma _{i}= \frac{\kappa _{}+1/q}{\theta _{}+|\hat{x}_i^{(j)}|^q}\). Therefore, we have the following optimization problem:

$$\begin{aligned} \begin{aligned} \bar{\gamma }_i^{(j)} =&\frac{\kappa _{}+1/q}{\theta _{}+|\hat{x}_i^{(j)}|^q} \text{ for } i=1,\ldots ,3n\\ \hat{\mathbf{x}}^{(j+1)}=&\,\underset{\mathbf{x}}{\hbox {arg min}} \left\{ \frac{1}{2\sigma ^2}\Vert \mathbf{L} \mathbf{x}-\mathbf{y}\Vert _2^2+\sum _{i=1}^{3n} \bar{\gamma }_i^{(j)} |x_i|^q \right\} . \end{aligned} \end{aligned}$$
(7)

When \(q=1\), this resembles the Lasso problem, which, expressed through (19), corresponds to a Laplace prior (16) with a fixed \(\gamma _{i}\). Notice that EM (7) finds the MAP estimate using as prior the marginal distribution of \(x_i\), i.e., \(\pi (x_i)=\int _{\gamma _i}\pi (x_i|\gamma _i)\;\pi (\gamma _i)\;d\gamma _i\),

$$\begin{aligned} \pi (x_i;\kappa _{},\theta _{},q)\propto \left( \frac{|x_i|^q}{\theta _{}}+1\right) ^{-(\kappa _{}+1/q)}, \end{aligned}$$
(8)

where \(\kappa _{}\) and \(\theta _{}\) are the shape and scale parameter of \(\mathrm {Ga}(\gamma _{i};\kappa _{},\theta _{})\), respectively.

2.3 Iterative Alternating Sequential algorithm

In IAS, we aim to estimating the MAP of the pair \((\mathbf{x},{\varvec{\gamma }})\) by solving the optimization problem \( (\hat{\mathbf{x}},\hat{{\varvec{\gamma }}})=\mathrm {arg}\max _{\mathbf{x},{{\varvec{\gamma }}}}\pi (\mathbf{x},{{\varvec{\gamma }}} \mid \mathbf{y})\). A common procedure [42] is to evaluate it by alternating optimization with respect to \(\mathbf{x}\) and \({{\varvec{\gamma }}}\) in the similar manner to [14, 20]. In particular, the MAP estimates can be extracted by solving alternatingly and recursively the following two optimization problems

$$\begin{aligned} \begin{aligned} \hat{{\varvec{\gamma }}}^{(j)}=&\underset{{{\varvec{\gamma }}}}{\hbox {arg max}}\log \pi ({{\varvec{\gamma }}} \mid \mathbf{y},\hat{\mathbf{x}}^{(j)}), \\ \hat{\mathbf{x}}^{(j+1)}=&\underset{\mathbf{x}}{\hbox {arg max}}\log \pi (\mathbf{x} \mid \mathbf{y},\hat{{\varvec{\gamma }}}^{(j)}) . \end{aligned} \end{aligned}$$
(9)

To express explicitly the two previous optimization problems, we write the full posterior \(\pi (\mathbf{x},{{\varvec{\gamma }}} \mid \mathbf{y})\) which is

$$\begin{aligned} \begin{aligned} \pi (\mathbf{x},{{\varvec{\gamma }}} \mid \mathbf{y})&\propto \exp \bigg (-\frac{1}{2\sigma ^2}\Vert \mathbf{L} \mathbf{x}-\mathbf{y}\Vert _2^2\\&-\sum _{i=1}^{3n} \big ( \gamma _{i}(|x_i|^q+\theta _{}) - (1/q+\kappa _{}-1)\log \gamma _{i} \big ) \bigg ). \end{aligned} \end{aligned}$$
(10)

It follows that the optimization problem (9) can be written as

$$\begin{aligned} \begin{aligned} \hat{\gamma }^{(j)}_i=&\frac{\kappa _{}+1/q-1}{|\hat{x}^{(j)}_i|^q+\theta _{}} \text{ for } i=1,\ldots ,3n,\\ \hat{\mathbf{x}}^{(j+1)}=&\underset{\mathbf{x}}{\hbox {arg min}} \left\{ \frac{1}{2\sigma ^2}\Vert \mathbf{L}{} \mathbf{x}-\mathbf{y}\Vert _2^2+\sum _{i=1}^{3n}\hat{\gamma }_i^{(j)}|x_i|^q \right\} . \end{aligned} \end{aligned}$$
(11)

2.4 Difference and Similarity between EM and IAS Approaches

One can observe that the difference between the problems of (7) and (11) is the step of updating the parameter \(\gamma \). In EM algorithm, the update of \(\gamma _{i}\) is based on the estimation of the expectation of \(\gamma _{i}\) (see 5) whereas in IAS, the update comes from the mode of \(\pi (\gamma _{i}|x_i)\). Since we have \(\gamma _{i}|x_i\sim \mathrm {Ga}(\gamma _{i};\kappa _{}+1/q,\theta _{}+|x_i|^q)\), we saw that the two updates can be explicitly expressed. In this article, we investigate how the prior degree \(q=1\) or \(q=2\) affects the source reconstructions and how the mode or expectation of \(\gamma _{i}\) as updating rules influence the performance of an EEG source localization solver. With these prior degrees, the algorithms resemble the separable \(\ell _1\) and \(\ell _2\) reweighting algorithms that are examined in [59].

2.5 Randomized Multiresolution Scanning (RAMUS)

The RAMUS technique was applied in finding a MAP estimate in order to maximize the robustness of the source localization outcome for various source depths [47]. That is, each MAP estimate was found for a large number of subsets of the source space and the final estimate was found as the average of all these subset-based estimates. In RAMUS, each subset contains a given number of randomly and uniformly distributed source positions. These subsets are divided into resolution levels according to the source position count. The estimates are evaluated in ascending order with respect to the resolution, i.e., progressing from coarse (sparse) to fine resolutions. Furthermore, the hyperparameter estimate obtained at one resolution level is used as the initial guess for the next one. The presence of coarse resolutions can be shown to be essential, specially, regarding the distinguishability of the deep activity [32], whereas finer resolutions can provide an enhanced accuracy for the detection of the near-field (cortical) activity. The average estimate found for a randomized set of source sub-spaces with a given number of sources provides an enhanced robustness for each resolution, as it diminishes discretization and modelling errors [47]. We consider RAMUS as a modelling error reduction technique based on the postulates presented in the following subsections.

2.5.1 Marginalization of Source Space Related Modelling Errors

We assume that the estimated unknown variable \(\hat{\mathbf{x}}\) depends on uncertainties and modelling errors of the forward model (\(\mathrm {FM}\)), inverse algorithms (\(\mathrm {IA}\)), and the statistical inverse model itself (\(\mathrm {IM}\)). Consequently, the modelling error is of the form

$$\begin{aligned} {\varvec{\varepsilon }}({\text { FM}},\text { IA},\text { IM})=\hat{\mathbf{y}}-\mathbf{L}(\text { FM}) \, \hat{\mathbf{x}} (\text { FM},\text { IA},\text { IM}), \end{aligned}$$
(12)

where \(\hat{\mathbf{y}}\) is noiseless data. As the statistical inverse model is not affected by the discretization of the leadfield, we assume the inverse error to be identically and independently distributed with respect to the selection of the source space. Consequently, a sample mean estimator obtained through a Monte Carlo sampling process can be interpreted to marginalize the error over the source space configurations that are uniformly distributed [47].

2.5.2 A Coarse-to-Fine Optimization Process

RAMUS uses the hyperparameter \({\varvec{\gamma }}\) as a surrogate [46] model to reduce the optimization bias towards superficial brain regions, which otherwise occurs with high-resolution source spaces [32]; the hyperparameter obtained after processing one resolution level constitutes the initial guess for the hyperparameter on the next level to maintain the activity of the deep structures found with low-resolutions when the optimizer proceeds toward the finest resolution level [47]. In this study, each source set in the coarsest resolution level includes 10 source positions and the source count is multiplied by a factor of 10 (sparsity factor) when moving up by one resolution level in the multiresolution hierarchy. The results were averaged over 100 different multiresolution decompositions.

2.5.3 Sparse Source Distinction

The use of coarse resolution levels below the number of measurement sensors is justified by the well-posedness of the corresponding Diriclet boundary value (forward) problem [21]. In particular, the diffusion operator following from the finite element discretization of the Maxwell’s equations under the quasi-static approximation is symmetric, continuous (bounded) and elliptic (coersive). By the Lax-Milgram theorem, given a Lipschitz domain \(\text{\O}mega \), positive-valued Lebesque integrable \(L_\infty (\text{\O}mega )\) function \(\sigma \), and a diverge conforming [45] primary current distribution with a normalized and square-integrable \(L_2(\text{\O}mega )\) divergence f, \(\Vert f \Vert =1\), the weak form \(\int _{\text{\O}mega } \sigma \nabla u \cdot \nabla v \, \hbox {d} {\text{\O}mega } = \int _{\text{\O}mega } f v \, \hbox {d} {\text{\O}mega }\) has a unique solution u which belongs to the Sobolev space \(H^1(\text{\O}mega )\) or to its finite dimensional subspace S such that the weak form is satisfied for any v in \(H^1(\text{\O}mega )\) or in S, respectively. Due to this well-posedness, any two boundary datasets \(g_1\) and \(g_2\) which tend infinitesimally closer and closer \(g_2 - g_1 \rightarrow 0\) correspond to solutions \(u_1\) and \(u_2\) with a similar property \(u_1 - u_2 \rightarrow 0\) and sources whose difference tends to zero weakly, i.e., \( \big |\int _{\text{\O}mega } (f_2 - f_1) v \, \hbox {d} {\text{\O}mega } \big | \rightarrow 0\) for any v in \(H^1(\text{\O}mega )\) or in S. It follows that each source in an N dimensional subspace S, sources \(f_1, f_2, \ldots , f_K\) can be distinguished (\(|\int _{\text{\O}mega } (f_i - f_j) v \, \hbox {d}{\text{\O}mega }| \ge \varepsilon \) for some \(\varepsilon > 0\) for all non-zero v in S and any pair \(i \ne j\)) based on their boundary datasets \(g_1, g_2, \ldots , g_K\), if S is spanned by a set of functions \(v_1,v_2, \ldots , v_N\) where any \(v_i\), \(i = 1, 2, \ldots , N\) overlaps with maximally one source \(f_j\), i.e., if the distribution of the sources is sparse enough. With a finite number of measurements, the maximum number of uniquely distinguishable sources is limited by the number of sensors, i.e., the number of linearly independent data vectors.

2.6 Sequential Semi-Analytic Monte Carlo Estimation (SESAME)

When a posterior distribution of the source localization problem cannot be expressed analytically, one possibility to approximate such a distribution is to use a class of particle filters called sequential Monte Carlo sampler algorithms, where one constructs a sequence of artificial distributions that starts from an analytical distribution and converges smoothly to the target distribution. SESAME by Sorrentino et al. [53, 54] utilizes this idea via the following artificial posterior:

$$\begin{aligned} \pi _i(\mathbf{x}\mid \mathbf{y})=\pi _0(\mathbf{x})\pi _i(\mathbf{y}\mid \mathbf{x})^{f(i)}, \end{aligned}$$
(13)

in which the power f(i) of the likelihood is given by

$$\begin{aligned} f(i)=\sum _{k=1}^i\delta _k,\quad \sum _{k=1}^{n}\delta _k=1 \end{aligned}$$
(14)

and n is the total number of iterations, sufficient to bring the estimate satisfyingly close to the target posterior, and increments \(\delta _k\) vary uniformly in the fixed interval \(\left[ 10^{-5},10^{-1}\right] \). The prior density \(\pi _0\) is based on the following assumptions: [54]

  1. 1.

    the number of dipoles is Poisson distributed;

  2. 2.

    the distribution of dipole locations and orientations is uniform;

  3. 3.

    dipole amplitude is random variable \(10^{3U}\), where U is uniform distributed in the interval (0, 1);

  4. 4.

    dipole location, amplitude and angle are independent from each other.

The final dipole estimates are obtained via importance sampling, i.e., as the weighted mean values from the conditional distributions known as importance

weights. Unlike CEP, SESAME does not provide a sparse solution, but a finite number of estimated dipole positions and orientations that best explain the measurement data. Therefore, SESAME needs the whole source space and leadfield to work with, and applying a multiresolution decomposition to it does not necessarily improve the estimation by design.

3 Implementation

The EM, IAS and SESAME source localization approaches were implemented as additional packages (plugins) of the MATLAB-based Zeffiro interface (ZI) code packageFootnote 1 [29] which allows for using the detailed multi-compartment head models obtained via high resolution magnetic resonance imaging (MRI) data. ZI’s plugin has its own user interface and an access to all the variables, parameters and handles. ZI utilizes the volumetric FEM [37] in the forward modelling stage which is why both cortical and sub-cortical compartments can be modelled accurately without limiting their number. The SESAME plugin combined ZI’s forward simulation routine also used in EM and IAS solver with the openly available core procedure of SESAMEFootnote 2 [53, 54]. The numerical calculations were performed using Dell Precision 5820 Tower Workstation with Intel Core i9-10900X X-series Processor CPUs, Quadro RTX 4000 GPUs and 128 GB RAM.

3.1 Discretization and Source Model

In ZI, a given head model is discretized using a tetrahedral finite element (FE) mesh. One-millimeter mesh resolution [50] is applied in order to achieve a high enough accuracy with respect to the strongly folded tissue structure of the brain and thin layers of the skull. The source space is modelled via the divergence conforming approach [36] in which the primary current density of the brain activity is formed by a superposition of dipole-like sources belonging to the Hilbert space H(div) of vector fields with a square integrable \(L_2(\text{\O}mega )\) divergence [4]. The H(div) model is advantageous, since it enables the accurate modelling of both well-localized dipolar and realistic distributed sources and, especially, since analytical dipoles are inapplicable (singular) as sources of the FEM forward simulation.

The H(div) sources are distributed evenly in the active compartments of the head model. The mesh-based source orientations following from the FEM discretization are interpolated into Cartesian directions using the position-based optimization approach [2] in the case of the 10-point stencil [45] in which the source contained by a center tetrahedron is modelled by six edge-wise and four face-intersecting sources associated with the edges and faces of that tetrahedron. Each source position is associated with the three Cartesian source orientations. The source distribution of the cerebral cortex was assumed to be parallel to its local surface normal due to the normally oriented axons of the cortex [17]. This normal constraint was implemented by projecting the Cartesian source field to the nearest surface normal direction in the grey matter compartment. The source orientations of the other compartments were unconstrained.

3.1.1 Accuracy Measures

The source localization accuracy with respect to a given dipolar source was investigated by comparing its position, orientation, and amplitude with the corresponding integral means obtained for the reconstructed distribution. Each integral mean was calculated in a region of interest (ROI) with 30 mm radius and center at the source position. The following measures were evaluated: (1) the Euclidean distance and (2) angle (degree) difference, and (3) the Briggsian logarithm of the amplitude ratio between the reconstructed and actual source, i.e., base 10 logarithm.

3.1.2 Focality Measures

We consider two different focality measures described in the following. (1) Hard thresholding is calculated by dividing the number of source positions, where the reconstruction is greater than 75 % of its maximum within the ROI, by the number of sources inside the ROI. (2) The earth mover’s distance (EMD), in units of mm, measures the minimum amount of work that needs to be done to shape and transfer a mass distribution to match another mass distribution at another location. The measure is originally defined as an analytical distance function between probability distributions in metric spaces in [31, 57]. The linear optimization form and the name of the distance originate from Rubner et al. [49]. We use EMD to compare distribution-like estimates that are spread over the whole domain to a set of dipoles at point locations. That is, we move the reconstruction mass to the set of true dipole locations in a way that the workload is minimized. In order to use EMD as a focality measure, we add a limit condition that the reconstruction mass beyond a certain distance away from the true source location is not moved. This is necessary since, otherwise, the base level noise for which a distributional source localization estimate exists in every source location will dictate the EMD results. We choose this moving limit to be 45 mm to have an approximately uniform set of source points between cortical and sub-cortical true sources. SESAME’s dipole estimation accuracy is measured using the EMD, while the distributional measures are not applicable [34].

3.1.3 Spherical Model for Source Localization Experiments

The quantitative performance of the EM and IAS techniques and SESAME were analyzed using the isotropical Ary model, which consists of three concentric spherical compartments modelling the brain, skull, and skin. The radii of these layers are 82, 86, and 92 mm and their electrical conductivities are 0.33, 0.0042, and 0.33 S/m, respectively. A spherical model is used to minimize the effect of tissue structure on the source localization accuracy. The Ary model was discretized using one-millimeter accuracy and the source space within the brain compartment consisted of 10,000 source positions. This relatively large source space size was selected as it gives an appropriate forward model accuracy and allows running each inverse method examined in this study in a few minutes. While the distributional EM and IAS methods would allow a greater source count without slowing down significantly, which was observed to be the case for the dipole search of SESAME.

3.1.4 MRI-Based Model for Source Localization Experiments

In the qualitative analysis, we used a multi-compartment segmentation generated using open T1-weighted MRI data obtained from a healthy subject. Using this data, a surface segmentation was generated using the FreeSurfer software suiteFootnote 3. The number of individual source positions was selected to be 100,000. The tissue conductivities suggested in [19] were applied, i.e., 0.14, 0.33, 0.0064, 1.79, and 0.33 S/m for the white and grey matter, skull, cerebrospinal fluid (CSF), and skin, respectively. In addition to these compartments, a set of sub-cortical compartments were included in the model. The conductivity of those was assumed to be 0.33 S/m.

Fig. 1
figure 1

Visualization of near- (cortical) and far-field (sub-cortical) source location in the spherical Ary (1st from the left) and MRI-based head model (2nd and 3rd from the left). Each source position and orientation is depicted by a pointer (green and red) which, in the case of Ary model, is surrounded by a sphere showing the extent of the corresponding ROI. Configuration (I) corresponding to P20/N20 component of the median nerve SEP includes a superficial and deep dipole which in the MRI-based model are located in the ventral posterolateral (VPL) [24, 28] thalamus (top row, middle) and in the Brodmann area 3b [6, 27] of the primary somatosensory cortex (bottom row, blue area on the middle picture), respectively. The cortical source inherits its normal orientation with respect to the cortical surface (here the white matter surface) from that of the cortical neurons. The thalamic source is oriented along the dorsal column–medial lemniscus pathway (blue dash) which is a bundle of basically vertical neuron fibers conducting the SEP from the median nerve through the brainstem and thalamus to the primary somatosensory cortex. A single upward-pointing deep dipole constitutes configuration (II) based on the P14/N14 component [41]. In the MRI-based model, it is located in the upper part of the brainstem, especially, in the medial lemniscus pathway [41]. Configuration (III) is quadrupolar, i.e., a combination of two oppositely oriented dipoles, a ventrolateral thalamic dipole with an upward orientation and a dipole in the cuneate nucleus with an opposite orientation, creating the positive and negative pole of P16/N16 [9, 30], respectively

3.1.5 Ary Model Experiments and Iteration Numbers

To analyze the accuracy and focality of the EM and IAS source localization estimates, we generated a sample of 100 different realizations of noise vectors utilizing the zero-mean Gaussian noise model with 5 % standard deviation relative to the largest absolute value in the simulated noiseless data vector. Mathematically, it is written as \(\max \left| y_j\right| \) for \(j=1,...,m\). Applying these noise realizations, a sample of EM and IAS estimates was obtained for the source configuration (I)—(III) evaluating the accuracy and focality measures for each estimate, Fig.1. To study the sensitivity of the methods to noise in more detail, we performed another experiment, where the reconstruction accuracy measures were calculated for seven different noise level standard deviations: 3, 5, 7, 9 11, 13, and 15 percents (signal-to-noise ratio (SNR) 30, 26, 23, 19, 18, and 16 decibels, respectively) considering the data entry with the largest amplitude. A total of 25 estimates were evaluated for every noise level.

Following the findings of [11, 47], the number of iterations applied to find a reconstruction was chosen to be 10. The number of the Lasso fixed-point iteration steps applied in finding \(\hat{\mathbf{x}}^{(j+1)}\) in (19) and (11) with \(q = 1\) was chosen to be 15 based on the convergence of \(\ell _2\)-norm of the reconstruction vector, see Fig. 2.

Fig. 2
figure 2

Convergence curves for IAS (red and orange) and EM (blue and violet) algorithms calculated as \(\ell _2\)-norm of difference of reconstruction vectors of sequential iteration steps from spherical Ary model (top) and MRI-based head model (bottom) with configuration (I) starting by a zero vector. We find 15 iteration steps appropriate because both algorithms are then stabilized. The calculation time of one iteration step is 12.5 s

The number of Monte Carlo samples is an iteration-like parameter for SESAME that can be adjusted. The only limiting factor for sample size is time and its effects on reconstruction accuracy have always uncertainty in it. We decided to use (a) a default value of 100 samples and (b) 700 samples that falls between the calculation times of CEP for both prior degrees. With CEP, the calculation time for degree 2 with 10 EM/IAS iterations is \(18.20\pm 0.01\) s and for degree 1 with 10 EM/IAS iterations and 15 Lasso iterations it is 3 min \(1.4\pm 0.1\) s. SESAME does not have constant iteration cycles because resampling is a random process and depends on the measurement data. The calculation time with 700 samples is 1 min \(20.5\pm 0.5\) s in average. SESAME was also tried with 1000 samples, but the results did not differ from the case of 700 samples. Longer processes were omitted as too time consuming compared to EM/IAS.

Fig. 3
figure 3

Left: The ratio between the expectation \(\mathbb {E}_{\pi (x_i \, ; \, \kappa , \theta , q)} [x_i]\) of the marginal prior and \(\theta ^{1/q}\) as a function of the shape parameter value \(\kappa \) from \(\kappa = 1.5\) to \(\kappa = 6\). The vertical line corresponds to the value \(\kappa = 4.4\) for which the cases \(q = 1\) and \(q = 2\) match. Right: The marginal prior (normalized to one) with the expectation set to 3E-4, approximating typical deviations due to noise. The shape parameter is \(\kappa = 4.4\) and the scale parameter \(\theta = \hbox {1E-3}\), when \(q = 1\), and \(\theta = \hbox {1E-6}\), when \(q =2\), resulting into \(\mathbb {E}_{\pi (x_i \, ; \, \kappa , \theta , q)} [x_i] = \hbox {3E-4}\) in both cases. With these parameter choices the expectation can be assumed to appropriately coincide with the amplitude of the expected random fluctuations of the reconstruction and the intensity of the actual source to be found is located in the tail part, i.e., it is an outlier with respect to the noise level (Sect. 3.2)

Table 1 Collected information of the synthetic originators used in numerical experiments
Fig. 4
figure 4

The source localization accuracy measures (position, angle, and amplitude) evaluated in the spherical Ary model (Sect. 3.1.3) with 5 % noise for source configuration (I) and (II) from Sect. 3.2.1 applying the EM and IAS algorithm. The histograms show the results obtained for 100 different reconstructions, each corresponding to a different realization of the measurement noise. The measures concern the difference between the actual source and the mass centre of the reconstructed distribution in the corresponding ROI. The units of the position, angle and amplitude are, respectively, in mm, degrees and \(\log _{10} (A_r / A_s)\), where \(A_r\) is the amplitude of the reconstructed and \(A_s\) of the actual source

3.2 Physiology-Based Parameter Choice

To select the shape and scale parameter of the hyperprior optimally, we choose the expectation \(\mathbb {E}_{\pi (x_i \, ; \, \kappa , \theta , q)[x_i]}\) of the marginal prior (8) as suggested in [46], i.e., so that it corresponds to the expected entry-wise deviation of the reconstruction vector, to match the random fluctuations predicted by the hyperprior approximately with the noise-induced fluctuations of the reconstruction. Consequently, the actual brain activity to be found will appropriately correspond to the tail part of the hyperprior, i.e., the brain activity constitutes a data outlier compared to the measurement noise. Due to the linear forward model, the relative noise level of the reconstruction may be assumed to be roughly that of the measurement noise. Thus, a random fluctuation may be assumed to have an amplitude of the relative measurement noise standard deviation (here 3 oe 5 %) multiplied by a typical dipolar primary current amplitude in the brain, e.g., 10 nAm (1E-8 Am) [26]. By taking into account that the largest absolute value in the measurement data is set to one microvolt which is a typical EEG measurement amplitude [40] and the leadfield matrix is presented in SI-units, we can conclude the relative noise level of reconstruction to be \(\alpha \cdot \hbox {1E-8} \cdot \hbox {1E6}\) in micro units, where \(\alpha \) is the standard deviation of the Gaussian noise associated with the likelihood. If we choose 3 % as the likelihood, it follows that the expected deviation is \(\hbox {3E-4}\). The shape parameter is chosen to be \(\kappa = 4.4\) for which the ratio between \(\mathbb {E}_{\pi (x_i \, ; \, \kappa , \theta , q)}[x_i]\) and \(\theta ^{1/q}\) is equal for both prior degrees \(q = 1\) and \(q =2\), i.e., \( \left. \frac{\mathbb {E}_{\pi (x_i \, ; \, \kappa , \theta , q)}[x_i]}{\theta ^{1/q}} \right| _{q = 1} = \left. \frac{\mathbb {E}_{\pi (x_i \, ; \, \kappa , \theta , q)}[x_i]}{\theta ^{1/q}} \right| _{q = 2} \approx 0.3\). In this way, we try to reduce the effect of the parameters in the comparison between prior degrees q, Fig. 3. Consequently, the value of \(\mathbb {E}_{\pi (x_i \, ; \, \kappa , \theta , q)}[x_i]\) follows from the scale parameter which is set to be \(\theta = \hbox {1E-3}\) and \(\theta = \hbox {1E-6}\) for \(q = 1\) and \(q =2\), respectively, in order to obtain the correspondence to the noise as described above.

Fig. 5
figure 5

The focality measure hard threshold evaluated in the spherical Ary model (Sect. 3.1.3) with 5 % noise for source configuration (I) and (II) applying the EM and IAS algorithm. The histograms show the results obtained for 100 different reconstructions, each corresponding to a different realization of the measurement noise. The hard threshold measure concerns the area where the intensity of the reconstruction is at least 75 % of its maximum in the corresponding ROI

Fig. 6
figure 6

The earth mover’s distance (EMD) with 45 mm moving limit evaluated in the spherical Ary model (Sect. 3.1.3) with 5 % noise for source configuration (I) and (II) applying the EM and IAS algorithm

3.2.1 Synthetic Data of Somatosensory Evoked Potentials

As an example case in the numerical experiments, we consider the detection of synthetic SEPs modelled according to the SEPs occurring in human median nerve stimulation. SEPs occur as a response to electrical pulses that stimulate the median nerve in the wrist area. We modelled the originators of three SEP components of which the P20/N20 component originates 20 ms post-stimulus at 3b Brodmann area, and involves simultaneous sub-cortical activity at the ventral posterolateral (VPL) thalamus [24, 28, 41, 48]. P20/N20 is preceded by far-field components P14/N14 and P16/N16 occurring at 14 and 16 ms post-stimulus, respectively. P14/N14 originates in the brainstem, where the spike afferent volley travels through medial lemniscus pathway [41] . The quadrupolar P16/N16 includes a positive thalamic and a negative sub-thalamic originator [9, 30]. The first one of these is located at the ventrolateral thalamus and the second one is at the cuneate nucleus.

The following three configurations (I)–(III) of dipolar sources were applied to model SEP components. Configuration (I) consists of two sources modelling the simultaneous near- (cortical) and far-field (thalamic) activity corresponding to P20/N20. The amplitude of the cortical source is assumed to be 70 % of the thalamic one, modelling a situation in which the amplitude of the cortical activity intensifies before reaching its maximum. (II) is formed by a single source in the medial lemniscus pathway approximating the sub-cortical activity of P14/N14. (III) includes a quadrupolar configuration with an upward component in the ventral thalamus and a downward component in the cuneate nucleus of the brainstem [30]. Since the thalamic component is likely to be peaked slightly after 16 ms [30], its amplitude is assumed to be 77 % compared to the amplitude of the sub-thalamic component. The present quadrupolar setup is not to be mixed with a quadrupolar afferent volley which is difficult to be detected as is. Instead the two dipolar components correspond to two subsequent quadrupolar spikes with one of the dipolar components visible due to a local discontinuity of the conductivity distribution [9]. The details of the originators are collected in Table 1. A spherical and an MRI-based model were applied in the source localization tests. Configuration (III) was applied only to the MRI-based model, which allows distinguishing the thalamic and brainstem areas. In the first one of these, the source positions were selected according to [6, 9] and, in the second one, they were placed in the aforementioned originator areas (Fig. 1). The noise vector \(\mathbf{e}\) in (1) was assumed to be zero-mean Gaussian random variable with diagonal covariance and 5 % relative standard deviation compared to the amplitude of the noiseless signal.

4 Results

The accuracy and focality results obtained with the spherical Ary model are shown as histograms in Figures 4, 5, 6 and 7 for 5 % noise. The CEP prior model reconstructs the near- and far-field activity with both prior degrees \(q = 1\) and \(q = 2\) and reconstruction techniques EM and IAS. While the degree of the prior does not directly appear to affect the accuracy of position and orientation, the reconstructions were overall more focal in the case \(q=1\) compared to \(q = 2\). With \(q = 1\) the reconstruction of the near-field source was more focal compared to that of the deep one, while with \(q=2\) such a tendency was less obvious or absent. The EMD and the hard threshold measuring the dynamical structure of the reconstructed distribution (Sect. 3.1.2), show a similar tendency among each other. Of these, EMD reveals smaller relative differences, suggesting that the overall variation of the reconstruction is rather similar for \(q=1\) and \(q = 2\) or the amount of artifacts is roughly the same, while the focality of the maximum peak varies more significantly. The mutual differences between the EM and IAS reconstruction techniques are less obvious than those following from the depth of the source, the degree of the prior and the noise level. The results for SESAME show high accuracy for a near-field source, but the localization error for a far-field source is diminished. However, SESAME gives an accurate estimation for dipole angle and amplitude regardless of the estimated location. It can also be seen that in the case of the P14/N14 component, there is no significant difference in the accuracy obtained with 100 samples and 700 samples. EMD results for the configuration (II) shows the effect of sample size on the location estimates obtained for SESAME: the median does not change as much as 90 % credibility is shrunk.

Fig. 7
figure 7

The source localization accuracy measures (position, angle, amplitude, and maximum) evaluated in the spherical Ary model (Sect. 3.1.3) with 5 % noise for source configuration (I) and (II) applying the SESAME algorithm with 100 and 700 samples. Results are obtained with the same scheme as in the case of CEP

Fig. 8
figure 8

The reconstructions obtained with the MRI-based head multi-compartment model with 3 % noise for source configuration (I) including two sources, one placed in the left 3b Brodmann area of the central sulcus, pointing inwards in the direction of the local surface normal vector, and a vertical source placed in the ventral posterolateral part of the left thalamus (Fig. 1). The actual source position is visualized by a green pointer in each image. The first-degree conditionally exponential prior (CEP), i.e., the case \(q = 1\), leads to a more focal reconstruction than the second-degree CEP (\(q = 2\)). The dipole estimations of SESAME are indicated by magenta pointers

Fig. 9
figure 9

The reconstructions obtained with the MRI-based head multi-compartment model with 3 % noise for source configuration (II), including a single deep source placed in the brainstem (green pointer). The maximum found corresponds to the actual position, a similar amplitude is obtained with both \(q = 1\) and \(q = 2\), the focality being greater with \(q = 1\). The EM and IAS reconstruction methods were found to perform essentially similarly for both source configurations with the most significant differences in the deep component of the configuration (I). Magenta pointers in SESAME section represents its dipole estimations

The results obtained with the MRI-based head model are visualized in Figures 8, 9, 10, 11, 12, 13 and in Figures 14, 15, 16 for 3 and 5 % noise, respectively. The first-degree CEP, i.e., the case \(q = 1\), leads to an overall more focal reconstruction compared to \( q = 2\). Akin to the results obtained for the Ary model, the near-field component, i.e., with the cortical pattern obtained with configuration (I) is more focal with \(q = 1\) than with \(q = 2\); in the former case, it is clearly restricted to the Brodmann 3b area, where cortical true source is located. In the latter one, it spreads more clearly towards the back areas of the brain: posterior cortex, e.g., Brodmann areas 5 and 7. Neither of the cases finds the accurate location of the simultaneous deep activity that appears to be more focal with \(q =1\). On the contrary, the dipole-estimating SESAME finds both sources with high accuracy. For the single-source configuration (II), agreeing with the case of the Ary model, the estimated maximum activity of the deep source found corresponds to the actual position and a similar amplitude is obtained with both \(q = 1\) and \(q = 2\), while in the former case, the distribution is more concentrated around the actual source position at the medial lemniscus pathway, distinguishing the upper brainstem as the area of activity. The EM and IAS reconstruction methods were found to perform essentially similarly for both source configurations, with the most significant differences in the deep component of the configuration (I). SESAME finds the dipole location roughly, but produces many false sources with significant dipole strength. For (III), the thalamic and sub-thalamic components of the quadrupolar configuration are detected with both prior degrees \(q = 1\) and \(q = 2\), the results being more focal in the former case concerning, especially, the lateral localization accuracy; with \(q = 1\), the activity is more clearly limited to the left lobe of the thalamus, while with \(q = 2\), both lobes show activity. SESAME detects activities also correctly, although, for 3 % noise we obtain false cortical activities similarly to (II).

The result for multiple noise levels shown in Figs. 11 and 12 shows that, on the one hand, CEP localizes the near-field component slightly better with \(q=1\) compared to \(q=2\). On the other hand, CEP localizes the far-field component better with \(q=2\). Between EM and IAS posterior maximizers, there are no significant differences considering the overall accuracy of the spherical Ary model and EEG. The dipole amplitude reconstruction has a natural downward trend with respect to increasing noise due to increasing dispersion. This decreasing tendency is weaker with prior degree 1. The reason for this can be explained by the lasso step, which acts as an “inhibitor” of the propagation of the activity estimate. Comparing the result with SESAME, one can observe that, with low noise, CEP is not as accurate on angle and amplitude, yet it is more robust with respect to growing noise. With configuration (I), SESAME did not find the cortical source in two out of 25 cases at noise levels 13 and 15 % with both sample sizes. The sub-cortical source was not detected with 100 samples in 7 cases at 7 %, 6 cases at 9 %, 11 cases at 11 %, 16 cases at 13 % and 22 cases at 15 % noise level. For the case of 700 samples, there were 6 cases at 7 %, 10 cases at 9 %, 20 cases at 11 %, 23 cases at 13 % and 23 cases at 15 % noise level, where the sub-cortical source was not found.

Fig. 10
figure 10

The reconstructions obtained with the MRI-based head multi-compartment model with 3 % noise for source configuration (III) with a quadrupolar deep source configuration formed by two dipolar components, one in the ventral part of the left thalamus [9] and another one in lower medulla of the brainstem [30] (green arrows). The quadrupolar configuration is detected with both \(q = 1\) and \(q = 2\), and also with SESAME (magenta pointers). The reconstruction obtained is more focal in the former case

Our comparison demonstrates that CEP, when implemented in the context of the RAMUS technique, gives an advantage to reconstruct far-field activities more accurately. Looking at the EMD measurements with multiple noise levels in Fig. 13, a clear difference is observed between the prior degrees: the median of the first-degree CEP does not change much, while the EMD of the second-degree CEP is increasing, indicating an increase in the reconstruction mass, i.e., the propagation of the estimated activity, since the localization accuracy does not deteriorate so strongly. For SESAME, the results show a progressive deterioration in both deep and cortical source localization with a significant number of outliers occurring in the case of 700 samples.

As shown by the box plot, the results obtained are generally of lower quality when noise is increased. Considering the MRI-based head model, the focality of the estimates obtained with \(q = 1\) maintains pronounced compared to the case of \(q = 2\) with the 5 % noise level. Moreover, EM yields a superior reconstruction of the simultaneous cortical and deep activity of P20/N20 compared to the IAS algorithm. Since the histograms and box plots for elevated noise do not suggest significant differences between EM and IAS, we deem that these observations might be due to the increased overall level of uncertainty.

5 Discussion

In this study, we investigated the newly introduced hybrid of hierarchical Bayesian modelling (HBM) and randomized multiresolution scanning (RAMUS) approach [47] as a method to enhance the performance of focal depth localization in EEG. Technically, RAMUS constitutes a frequentist hybrid solver that is applied to reduce the unknown modelling errors of the Bayesian source localization process. Namely, it relies on the frequentist principle according to which the actual distribution the random variables (modelling errors) obey is unknown, but that it is possible to estimate those via sampling. A frequentist model is applied due to the necessity that the modelling accuracy is limited, i.e., there is no a priori information available beyond some limit, e.g., the resolution of the head model. While hybrid methods have been introduced and their importance has been shown in various contexts [60, 61], there is no general agreement on how to combine Bayesian and Frequentist methodologies, and therefore we consider RAMUS here rather as a technique to improve the posterior optimization process than as a fully independent statistical method. Future work considering RAMUS as a frequentist method is, however, well-motivated method development goal to find out, e.g., the expected loss of the proposed sample mean estimator [38].

Fig. 11
figure 11

The source localization accuracy measures (position, angle and amplitude) for multiple noise levels. A total of 25 estimates have been calculated for each noise level. The error measures are evaluated in the spherical Ary model for source configurations (I) and (II) as shown in Sect. 3.2.1 by applying CEP with the EM and IAS algorithm and both prior degrees 1 and 2

Fig. 12
figure 12

Dipole reconstruction errors for SESAME-based source localization estimates calculated for multiple noise levels. Each box-plot bar has been obtained based on 25 reconstructions

Fig. 13
figure 13

The earth mover’s distance (EMD) evaluated in a 45 mm radius sphere co-centered with the true source for noise levels from 3 to 15 %. For SESAME, the dipoles with a distance greater than 45 mm to the true source location were excluded from the EMD evaluation. Each box-plot bar has been obtained using 25 different reconstructions

Fig. 14
figure 14

The reconstructions obtained with 5 % noise and the MRI-based head multi-compartment model for source configuration (I) including two sources, one placed in the left 3b Brodmann area of the central sulcus, pointing inwards in the direction of the local surface normal vector, and a vertical source placed in the ventral posterolateral part of the left thalamus (Fig. 1). The actual source position is visualized by a green pointer in each image. Magenta pointers are dipole realizations of SESAME

Fig. 15
figure 15

The reconstructions obtained with 5 % noise and the MRI-based head multi-compartment model for source configuration (II), including a single deep source placed in the brainstem (green pointer). The dipole estimations of SESAME are presented by magenta pointers

Fig. 16
figure 16

The reconstructions obtained with 5 % noise and the MRI-based head multi-compartment model for source configuration (III) with a quadrupolar deep source formed by two dipolar components, one in the ventral part of the left thalamus [9] and another one in lower medulla of the brainstem [30] (green arrows). SESAME has found both of the dipole locations with high accuracy (magenta pointers)

Here, the conditionally Gaussian prior (CGP) model [11], previously applied in the context of RAMUS in [47, 48], was interpreted as a special case of the conditionally exponential prior (CEP) to improve its focal reconstruction capability. These two priors were compared in numerical experiments using two different reconstruction techniques: the expectation maximization (EM) and iterative alternating sequential (IAS) algorithm, and as an alternative sampling-based technique the recently introduced sequential semi-analytic Monte Carlo estimation (SESAME) technique [53, 54]. Whereas EM and IAS find the primary source current density of the brain as a distribution, SESAME reconstructs a finite set of dipolar sources.

The performance of the CEP was analyzed numerically using both the spherical three-compartment Ary model and an MRI-based multi-compartment model. The first one of these was applied in quantitative accuracy and focality analysis considering multiple noise levels and focusing more carefully on the reconstructions within 5 % noise, and the second one, MRI-based, in a qualitative investigation, especially, to learn about the possible physiological relevance of the reconstruction difference. The EM and IAS method were implemented in the context of RAMUS to enable the simultaneous detection of both cortical and sub-cortical activities. In particular, as shown in Sect. 3.2, the combination of CEP and RAMUS allows selecting the source-wise shape and scale parameters of the hyperprior through the physiological properties of the brain activity [26, 40] relating the expected reconstruction noise and amplitude levels to those suggested in [46]. This combination omits the group effects following from a single focal activity being associated with multiple densely distributed sources. This is possible, since in RAMUS, the initial reconstruction is first found for a coarse and randomly distributed set of sources (here a set of 10 source positions) and after that propagated towards a denser distribution of sources. If this is not the case, the scale parameters need to be adjusted based on the density of the source space: the greater the source space size, the smaller the scale [29, 46].

To reconstruct the far-field components optimally regardless of the electrode positioning, a multiresolution method such as RAMUS might be required to apply the source sparsity technique [32, 47]. Reflecting the observed results with the experimental localization errors obtained with a spherical head model [18], RAMUS assisted reconstruction techniques are below (< 8 mm including outliers) the experimental limit found for a far-field source (8.8 – 11.3 mm in [18] with SNR between 25 and 15 dB). Thus, both CGP and CEP, when combined with RAMUS and physiology-based parameter selection, proved to be robust to an increased noise level up to 15 % (16 dB SNR) of the entry-wise maximum measurement deviation. This is an interesting finding, given that methods have been developed to reduce the effect of noise [10, 33]. While SESAME outperforms the other techniques numerically with low noise, the spread (the interquartile range between 25 and 75 % quantiles) of its localization error is greater than the experimentally obtained limit, when the noise level is above 13 % (18 dB). In the case of SESAME, the superior dipole estimation quality obtained with low noise can at least partially follow from the usage of dipoles in both generating the synthetic dataset and reconstructing the activity. This qualitatively implies that SESAME’s posterior distribution is relatively narrow and thus very vulnerable when modelling errors and measurement noise are present (similarly to overfitting problems). On the other hand, CEP which employs the distributed source model (in the likelihood) and sparsity priors, has more flexibility in the sense that it does not assume the activity to be limited in only a few locations and a strict number of sources.

Based on the results obtained with low or moderate noise, it is evident that RAMUS tends to spread the far-field components if this tendency is not taken into account a priori. CEP seems to provide a potential alternative for limiting the spread that occurs with CGP, while CGP can still be considered advantageous for distinguishing activity when multiple sources are simultaneously active. When coupled with RAMUS, the CEP was found to localize deep activity with both prior degrees \(q = 1\) and \(q = 2\). Relying on the results, the source localization performance provided by the first-order prior can be seen to be crucial for the focal detection of both nearand far-field activity. In the case \(q = 1\), the near-field fluctuations (cortical patterns) in configuration (I) as well as the far-field (thalamic and sub-thalamic) components in (II) and (III) were observed to be more concentrated to their actual positions, which is potentially significant in identifying activity in the corresponding brain regions. For the configuration (II) involving simultaneous near- and far-field components, the deep activity obtained with \(q = 1\), was slightly deviated with respect to the actual position, clearly following from the difficulty to recover a weakly detectable deep source in the presence of the near-field activity. This difference is, nevertheless, minor in the case of the MRI-based head model which distinguishes the sub-cortical areas as disentangled compartments. Overall, the EM and IAS methods were found to provide qualitatively similar results.

The combination of first-degree CEP and RAMUS constitutes a potential technique for localizing focal sources with limited distinguishability, e.g., SEP-originators. Those are classically observed via invasive depth electrodes, i.e., stereo-EEG, to improve the visibility of the weak components. The present results suggest overall that non-invasive measurements might be successfully used to detect focal deep sources via an efficient source localization strategy, e.g., the CEP. The feasibility of detecting deep activity non-invasively has been shown recently [44, 52]. Studies concerning the originators of median nerve SEPs [5, 8, 9, 30] associate a significant uncertainty on the early far-field components. Of the median nerve SEP components, the clearest visibility has been obtained for P14/N14, considered here as an example. P14/N14 is observed when the median nerve SEP propagates within the brainstem. The components P16/N16, modelled in this study, and P18/N18 occurring 16 and 18 ms post-stimulus, respectively, are likely to involve more than one deep originator and there is yet no exact knowledge on the actual location of those. The P20/N20 component, also considered here, is the first one involving cortical activity, the presence of which, if not taken into account appropriately, might hinder the detection of simultaneous deep activity. Based on our results, the originators of the P14/N14, P16/N16 and P20/20 component might be non-invasively detectable. Furthermore, the identification of these might be enhanced with the first-degree CEP (\(q = 1\)). Surely, the detectability of different SEP originators will need to be carefully studied further both via numerical simulations and with experimental data in order to gain a deeper insight into the practical applicability of the CEP.

The present source localization approach provides a potential solution for investigating the function and connectivity of the neural activity networks with focal and weakly detectable far-field components, the analysis of the SEP originators being only one example of potential future applications. To obtain an optimal performance in connectivity analysis, RAMUS will need to be employed as a part of a dynamical process, where a reconstruction is obtained based on multiple time points. A dynamical version of RAMUS can be obtained either via a straightforward extension of the present single-time sampling (averaging) process or, alternatively, by applying data from multiple points in a single sampling run, where the source correlations could also be taken into account. Our present approach to use a single simulated time step as a basis of the reconstruction can be considered to be the most relevant, when the investigated processes, e.g., the early SEP components, have a short duration (a few milliseconds), i.e., when the number of available measurements per time point is likely to be small.

6 Conclusion

This paper introduced a hybrid of CEP and RAMUS as a means to enhance the focality of the reconstructions in the localization of near- and far-field sources in EEG measurements. This combination was shown to allow selecting the shape and scale parameters of the hyperprior relying on a typical brain activity and measurement amplitude, incorporating the noise level due to different uncertainty factors, e.g., measurement and forward modelling errors, thus differentiating it from iterative reweighted \(\ell _1\) and \(\ell _2\) methods. We observed that CEP, when combined with RAMUS, provides robust source localization estimates up to a 15 % noise level and that it outperforms SESAME when the noise is high. The first-degree CEP was found to improve the focality of the source localization estimate compared to the second-degree case, which corresponds to the previously introduced CGP. This improvement was found to be significant, especially in the reconstruction of both near- and far-field sources, e.g., to distinguishing activity in the thalamus simultaneously with a source in the Brodmann 3b area or a dipolar or a quadrupolar source configuration focally in the brainstem. These findings might be crucial, for example, in reconstructing and analyzing SEPs, e.g., the originators of the P20/N20, P14/N14 and P16/N16 components of the median nerve SEP, respectively.