1. Introduction
The human brain composed of neurons that connect with each other via electrical signals. One can record and measure these activities using an electroencephalogram (EEG). An essential use of the EEG is in locating the generating source of these signals, usually approximated by dipoles. This is important because, in some particular circumstances, neurons may not function optimally and could make the equivalent dipole generate abnormal signals. This could be the result of seizures or other brain disorders. In order to isolate such disorders, the challenge is to find a non-invasive way to locate the anomalous source. In [
1], the authors addressed the location of abnormality for mildly depressed patients. In this case, only few regions were associated with depression. Thus, to treat these disorders, source localization is crucial and vital in clinical subjects exhibiting such neural activity [
2].
EEG signals’ source localization has been extensively studied. Cohen et al. in [
3] additionally compared the accuracy of using EEG signals versus magnetoencephalogram (MEG) signals and showed that EEG signals are as useful as MEG signals for source localization problems. Furthermore, in [
4], the authors described trend source localization methods using the finite element method for modeling the human head, as well as defined a time-slices approach.
Among all the studies, there are two important steps for source localization: (1) The forward model for EEG signal approximation; and (2) The inverse problem for locating the generating source. In the forward problem, the electrode potentials are calculated based on the given source properties. Many review articles address different forward problem approaches pertaining to source localization as in [
5]. Other studies such as [
6,
7] focused on a specific forward problem approach such as implementing the boundary element method (BEM) and its effect on source localization error. Moreover, in [
8], the effect of forward model errors, and the way to remove them using a Monte Carlo approach is also discussed. The inverse problem, on the other hand, is solved when the EEG signals are available and measured by electrodes, and the goal is essentially to estimate the signal properties. There are several inverse problem approaches available to find the source location of the signal generators or the dipoles. Robert Grech and their co-authors present a comprehensive review of the approaches, including minimum norm estimates, low-resolution electromagnetic tomography (LORETA), local auto-regressive average (LAURA), adaptive standardized LORETA/FOCUSS (ALF), and multiple signal classification (MUSIC) [
9]. Among these mentioned methods, MUSIC is widely cited (and used) and the main idea is based on the subspace decomposition technique [
10]. In other words, this technique tries to select the best signal subspace that works properly for the forward model. Ref. [
11] builds upon this by introducing a new algorithm based on QR decomposition, and compares it with other available algorithms such as recursively applied and projected MUSIC (RAP-MUSIC) [
12]. One of the recent studies showed promising results using the
norm to solve the underlying ill-posed inverse problem based on Bernoulli Laplacian Priors [
13].
Besides the need for robust mathematical algorithms to solve the source localization problem from EEG signals, there is also the need to model the propagation of the signal through the brain media (matter) before the signal is picked up by the sensors. Among the key factors that affect the signal quality is the conductivity of the brain matter. For example, refs. [
14,
15] implement non-uniform conductivity for the head model. In similar studies, researchers have mostly considered different conductivity for the skin, compact bone, spongy bone, and the brain. Despite these models’ popularity, other novel methods exist to solve the forward problem more accurately. For instance, ref. [
16] presents a two-volume integral equation for the inhomogeneous and anisotropic forward problem, which is more precise than common differential equation-based available methods.
Another important aspect that impacts the source localization solution is the number, and the distribution of the sensors. Many studies are available that show the sensitivity of the solution to different number of sensors, as well as examine the number of sensors needed to have a precise solution [
17,
18]. There are also studies such as [
19] that quantify the mislocation of sensors, considering them as random variables. However, these studies do not address the effect of the distance from electrodes to the signal resource nor the received signal strength (RSS) attenuation in the source localization problem.
In this paper, a new algorithm will be introduced to estimate the dipoles’ properties, namely strength, location, and orientation, using EEG-like signals. The main contribution is the development of a mathematical model that can be utilized in the inverse solution to determine the source location and orientation. The developed model considers randomly distributed conductivity in the ‘head model’ as well as randomly distributed sensor locations. This model captures a wide variety of signals received from head models (Finite Element Method-based on specified conductivities for matter inside). The models are verified using the tools from Brain Electrical Source Analysis (BESA) (
https://www.besa.de/products/besa-research/features/head-model-selection/, accessed on 15 January 2023).
In the following sections of this paper, the inverse problem is setup by describing the components of a measurement model. Following this, the solution methodology is presented that describes a constrained optimization approach to solve the inverse problem. The introduced algorithm is applied to three different datasets. First, synthetic data generated by a forward model is utilized to assess the accuracy of the source properties estimation. Second, two different clinical datasets, including a seizure, are considered. Eventually, all the results are compared using a widely available tool-EEGLAB [
20].
4. Solution Methodology
The parameters to be estimated for the
i-th dipole are denoted compactly as the vector
:
The above-mentioned unknowns all appear in the right side of Equation (
6). Thus, the inverse problem is solved to obtain the unknown components in the
vector.
Among the different approaches to solving an inverse problem, this paper chooses an optimization method where the
norm of the estimation error is minimized. The estimation error is defined as the difference in the real measured signals and those predicted by the estimated values of the unknown parameters using the measurement model in Equation (
6).
The predicted value of the EEG signal from the parameter estimates is given by
The objective of the inverse problem is to minimize the weighted
norm of the measurement residuals, shown as:
where
is a symmetric weighting matrix. In this paper,
is chosen to be an identity matrix. The cost function is augmented with the unit norm constraint of the dipole orientation, i.e.,
.
where
is the Lagrange Multiplier corresponding to the
dipole orientation constraint in the equation above. Note that the procedure for solving this problem would be to set up the necessary conditions (from the gradient of the cost), and determine an update for the parameters from one iteration to the next using the gradient and the Hessian (second derivative of the cost function with respect to the decision variables), and the application of the Karush–Kuhn–Tucker (KKT) conditions. These procedures are built into a nonlinear solver such as ‘fmincon’ in the Optimization Toolbox of MATLAB, which allows for an explicit specification of the cost to be minimized, nonlinear constraints that the decision variables satisfy, as well as any bounds on the decision values that need to be respected. The results obtained are discussed in the next section.
5. Simulation Results
Before presenting the detailed simulation results, a thorough sensitivity and characteristics analysis of the solution to the inverse problem with regard to the number of sensors to be employed and the number of samples required to reliably provide a converged solution was performed. The signals generated for the analysis have an average signal-to-noise ratio (SNR) of approximately 20.
5.1. Model Sensitivity and Characteristics Analysis Using Synthetic Data and the Spherical Head Model
Table 1 provides the results of the simulation in this study. As shown in the table, the source localization process uses an initial guess and iteratively converges to the actual values. As shown in
Table 1, the estimated value is very accurate for all three selected dipoles, indicating that the source localization algorithm is consistent.
To study the sensitivity of the estimation algorithm to the number of sensors and samples, the simulation is performed for different numbers of sensors, as well as samples for three different dipoles, and the results are shown in
Figure 6,
Figure 7 and
Figure 8. These 3D plots show the changes in the total error percentage of the estimated values in terms of the increasing number of sensors and samples simultaneously. As expected, by growing the number of samples and sensors, the amount of collected data increases. As a result, the estimation of unknown values is more accurate. Moreover, one can determine the least value of error and the corresponding number of samples and sensors. For instance,
in this simulation, 48 sensors and 350 samples gave the least error percentage.
In order to study the effect of the distance between dipoles and sensors, three different locations are chosen for the simulation, one deeper in the brain, one closer to the scalp and sensors, and one dipole is chosen somewhere in between the locations of the other two. Based on the estimation algorithm described in the previous section, sensors receive weaker signals from the deeper dipoles. This leads to a higher amount of estimation error for the deeper dipoles, i.e., dipole #1 in this study. Considering this information regarding the location of the dipoles, one can interpret
Figure 6,
Figure 7 and
Figure 8 more accurately. This case can be observed by comparing the magnitude of the estimation error for each dipole from these three figures.
Figure 9,
Figure 10,
Figure 11,
Figure 12 and
Figure 13 present the error percentage for estimating each variable in the parameter vector
separately, where the error bar is the confidence interval value. It was mentioned previously that the electrodes are randomly located on the patient’s scalp to make sure this simulation is working correctly regardless of the sensors’ location. However, in some cases, the sensors could be located somewhere far from the dipole, and as a result, the collected data are noisier and weaker. Clearly, this happens when the number of sensors is excessively low and they cannot cover the scalp adequately. As a result, the confidence intervals for the low number of sensors are more significant. In other words, if the small number of sensors are located in some place near the dipoles, the result is still acceptable.
Figure 9,
Figure 10 and
Figure 11 show the error percentage for each variable. There is a lower error for each variable in terms of the number of sensors. Thus, it is not possible to choose the optimum number of sensors only using the error in each variable. To address this problem, an average error of all the parameters is studied, as shown in
Figure 12 which provides a more robust estimate for the optimum number of sensors required. We note that (a) the minimum error percentage occurs when around 19 sensors are used; and (b) the error percentage reduces as the number of sensors increase (in general). This occurs because a higher number of sensors cover more of the scalp area, and as a result, the collected EEG data have more information. To summarize,
Figure 12 represents a converged and consistent value of error after a specific number of sensors (20 sensors) are used. This means a specific amount of collected data are enough to make the model equations well defined, and the estimation problem well posed to find a consistent estimate. Thus, one can use the minimum number of sensors, as indicated by these numerical experiments, and conduct a simpler actual experiment (in terms of cost and computational burden). In order to further test this hypothesis, this simulation was performed using up to 100 sensors, and the result is provided in
Figure 13.
It was previously discussed that 19 sensors would be good enough for this study to estimate the dipole properties. Similarly, a sensitivity study with respect to the number of samples was carried out.
Figure 14 shows the changes in error percentage by increasing the number of samples. It was determined that 400 samples were sufficient to estimate all the dipoles’ parameters.
The effect of distance between the sensor and a dipole is one of the important considerations in this study. In order to see this, two different sensors are considered, one closer to a specific dipole, and the other one far from the same dipole, as was previously shown in
Figure 1. The collected EEG signal from these two dipoles is shown in
Figure 15. As can be seen from this figure, the sensor collected a stronger EEG signal from the closer dipole (shown in blue) rather than the dipole far from the sensor (shown in red).
In conclusion, the proposed mathematical model for the dipole is very general and captures the key features of signal propagation from the source to the sensor. This simple model allows significant flexibility in terms of medium dependent conduction, signal strength variation due to distance, as well as other unmodeled noises.
5.2. Model Performance for Source Localization Using EEGLAB
In this study, the half-sphere head model is used to simplify the simulation. Furthermore, different parts of the brain’s conductivity are assumed to be random numbers between
and
as mentioned before in
Section 2.
In order to check how precise these assumptions are, one can compare the derived results provided by the present algorithm with the generated results from available open source software such as BESA, Cartool, EEGLAB, etc. [
24]. In this study, the EEGLAB [
25] software is chosen, with several options to choose the head model. The MNI head model is one of the most accurate ones selected in this study to compare with the spherical head model.
The first step in using EEGLAB is to import the same generated signal used in the previous section. The location of sensors in the MATLAB-generated EEG signal are the standard 64 locations of BioSemi (known as 10–20 standard system), and the same locations will be considered in EEGLAB. The MNI head model in EEGLAB has a head radius of 85 mm. Note that, for having a more accurate comparison, the head model in the previous sections that considered a half sphere is also modified to an 85 mm radius.
Note that prior to the source localization step using clinical data in EEGLAB, the user has to reject certain data by visual inspection.
The proposed algorithm (discussed previously) on the other hand does not require this manual step. Furthermore, since only dipole activities generate the available EEG data, there is no need to denoise or cancel any other ‘artifact’ in this case. The DIPFIT toolbox is used in EEGLAB to generate the source localization results. This MNE-based toolbox is designed by Robert Oostenveld and is available at Fieldtrip [
26]. Applying the DIPFIT function in EEGLAB gives the dipole’s location in Talairach coordinates, as shown in
Figure 16a. Furthermore,
Figure 16a,b are located next to each other to show the similarity of the source localization from the proposed algorithm and the result obtained from EEGLAB. Given the differences between these two approaches and those associated with the representations (Talairach coordinates vs. the Cartesian coordinates), the results are in close agreement. Besides the visual presentation of the results,
Table 2 provides the numerical results for the three dipoles located in the head model. The error mentioned in this table is the distance between the actual source and the source localization result in mm, which is defined in Equation (
11).
Note that for all three dipoles, the error is significantly lower for the present algorithm compared to the EEGLAB result. We thus verify that the constrained nonlinear least-squares-based source localization method’s performance agrees well with that produced by EEGLAB.
5.3. Characteristics Analysis Using the Clinical Data and the MNI Coordinates
Now that the efficacy of the proposed algorithm has been proven in the previous sections, one can assess this algorithm using clinical sample data. Therefore, a suggested dataset from EEGLAB is used in this section [
20,
27]. This dataset belongs to a visual attention task. In this task, each event is a three-second time interval where the subject should press a button right after seeing a square on a screen in front of them. Given the quality of the dataset and the presence of bad quality signals, it is suggested to select good quality time intervals rather than using the whole dataset. Thus, in this study, two different time intervals are selected to quantify the source localization algorithm. As illustrated in
Figure 17, one of the selected events is from 113 to 116 s, and the other is from 146 to 149 s.
The selected events are utilized to generate the source localization results on both the EEGLAB software and the introduced algorithm. The EEGLAB source localization algorithm suggests the number of dipole locations to be as many as the channel numbers. In other words, for this specific dataset that was recorded by 30 EEG signals, EEGLAB found 30 possible dipoles that generate this signal. However, only the results with residual variances (RVs) less than 15% are acceptable according to EEGLAB [
28]. The residual variance in EEGLAB software is defined based on matching the dipole projection to the EEG electrodes. Based on this definition, it is also important to mention that smaller numbers of RV indicate the most accuracy, and the results are more reliable.
Figure 18 and
Figure 19 represent the source localization results for the experiment that started at 113 s and finished at 116 s.
Figure 18 illustrates all the dipole estimations simultaneously. Given this general presentation of results, one can see the similarity between the EEGLAB result and the introduced algorithm result. Note that, as mentioned earlier,
Figure 18b is the general result by EEGLAB where all the dipole estimations are not necessarily correct.
Figure 18c is the final result where any estimation with the RV over 15% is filtered out.
EEGLAB usually utilizes an MRI scan to show the source localization result, making the comparison less convenient. This suggests providing another method to compare the results, and
Figure 19 is provided to compare the dipole estimations individually in the same brain map using the Talairach coordinates.
Among the 24 dipoles from EEGLAB results, there are 18 similar results available from the present algorithm. The average distance of the EELAB estimation to the proposed algorithm’s result for these 18 dipoles is only mm, and the standard deviation is mm. This result clearly illustrates the accuracy of the introduced algorithm when using the clinical data.
Similarly to the sample data for the 113–116 s time interval,
Figure 20 and
Figure 21 illustrate the source localization result for the 146–149 s time interval. It should be noted that for this time interval, 27 out of 30 dipole estimations from EEGLAB are acceptable with an RV greater than 15%. Furthermore, the number of similar results from the present algorithm is 19 dipoles.
Finally, the algorithm is also tested on clinical data collected from a patient with an active seizure case. The Temple University Hospital provided the EEG data used in this section as their open source database [
29]. These data were collected by 19 EEG sensors with the international 10–20 EEG electrodes, as shown in
Figure 22b.
After applying the EEG source localization to the seizure EEG data, the comparison in
Figure 23 shows that the EEGLAB provides 19 estimated dipoles, and only four have an RV > 15%. However, the proposed algorithm results in 35 dipole estimations, including the four dipole results from EEGLAB.
Figure 24 presents the four similar results compared individually.
Given a more significant number of dipole estimations from the MATLAB simulation compared to the EEGLAB, the accuracy of this result is illustrated by providing the channel data. As shown in
Figure 22, the highest brain activity occurs around sensors Fp1, Fp2, and F3, which matches both the EEGLAB and MATLAB simulation result. On the other hand, there are other channels with noticeable brain activity, such as Cz, C3, Pz, and P4. This means there could be other sources of brain activity around the central area, even though they are not as strong as the frontal head area. These sources are also discerned by the proposed algorithm’s result, as shown in
Figure 23a. In other words, the introduced algorithm is more sensitive to all the brain signals and covers a broader range of source localization.
6. Conclusions
This study introduces a constrained nonlinear least-squares algorithm to estimate the dipole properties based on the collected EEG signals. The mathematical model for a signal from the dipole is shown to be very flexible and includes features that model piece-wise conductivity, varying received signal strength (RSS), and random sensor distribution on the scalp. This model flexibility enables one to solve the inverse problem for many different head types and/or numbers or sensors and samples. To give an illustration of this fact, this algorithm is applied to two different types of EEG data: (1) synthetic data generated by the forward model; and (2) clinical data. The results emphasize the accuracy and performance of the present algorithm for both EEG signal categories. The source localization error for the synthetic data is less than 0.1 percent. In the case of testing the clinical data, this algorithm works as accurately as EEGLAB, which is illustrated in the figures. The results also show that the presented algorithm performs extremely well for the localization of multiple dipoles and is verified with the results obtained from EEGLAB. Notably, the introduced algorithm can be more sensitive to different sources in the head model. As a result, for some cases, such as the seizure data utilized in this study, the proposed source localization algorithm can find more active dipoles compared to EEGLAB. Future work will focus on further optimizing the number of sensors, decreasing the computation load of source localization algorithms where the FEM and BEM are used, and prototyping the algorithm on a chip that can be embedded in an EEG helmet.