1 Introduction

The activation in human brain is caused due to any physical or mental task which causes production of magnetic field or electrical current [1]. These fields create particular sources inside various brain regions depending upon the stimuli or activity done by body. Hence, brain source localization is applied to localize such active sources. It has got variety of applications in healthcare centers and hospitals for various brain disorders. Among them, epilepsy is most common as it affects 1% of the world population [2]. Thus, these applications include the localizing of epileptogenic sources for epilepsy cure, localization of brain tumor to be extracted and localizing of brain regions which are affected by mentioned brain disorders. For this purpose, various neuroimaging techniques are used having various features related to temporal and spatial resolution. These neuroimaging modalities include functional magnetic positron emission tomography (PET), electroencephalography (EEG), magnetoencephalography (MEG) [3]. fMRI is the most powerful functional neuroimaging modality as the MRI scanner used for it can provide both anatomical and functional features with high spatial resolution but at high instrumentation cost. However, statistical analysis regarding to instrumentation cost for different neuroimaging methods demonstrates that EEG is least expensive and easy to handle neuroimaging method for clinical and research purposes with high temporal resolution (in milliseconds), followed by PET, MEG and nIRS, respectively. Also the fact that EEG and MEG are electromagnetic imaging methods means they treat brain as electric current generator. Thus, according to cost and availability, EEG is considered most feasible among them. EEG treats brain as electric current generator and thus measures the electromagnetic fields inside the brain by using set of sensors (74,128,256) placed directly on the scalp. However, fMRI measures the differences of blood oxygenation related to neuronal activities. Hence, when EEG is used for brain source localization, then this field is termed as EEG source localization [4]. As the number of unknown quantities, i.e., active sources (> 10 K), outnumbers the number of known, i.e., sensors used for measurement, the problem is severely underdetermined in nature. Mathematically, these problems are termed as ill-posed problems. Hence, the problem of brain source localization is also termed as inverse problem as one has to construct the sources with available data [5].

There is a significant impact of number of sensors which are used to take measurements from scalp using various EEG caps. In [6], it is mentioned that a proper sampling of spatial frequencies of electric potentials should lead to better resolution for topographic features. It has been reported by various authors through simulated as well as real-time EEG data that interelectrode distances of around 2–3 cm are needed to avoid distortions of the scalp potential distribution. Hence, for this simulation study was carried out in [5], with various number of electrodes and with various source localization algorithms. Thus, it was revealed that there is no linear relationship between the number of electrodes and source localization precision. However, there are some methods which have suggested RAP-MUSIC [7] in conjunction with developed reduced conductivity method for source localization.

This research work adopts a unique way to reduce the number of sensors and observe the behavior of well-known localization algorithms for reduced number of sensors. For this, minimum norm estimation (MNE) [8], low-resolution brain electromagnetic tomography (LORETA) [9], beamformer and multiple sparse priors (MSP) [10, 11] are used to analyze the behavior of the system with reduced number of electrodes. The source localization precision is analyzed by using negative variational free energy [12, 13] and localization error for real-time EEG data and synthetically generated EEG at very low SNR level, i.e., 5 dB.

Section 2 discusses the methodology adopted for this research work which includes brief summaries of methods used, Sect. 3 discusses the results and provides the discussion on them, and Sect. 4 provides conclusion for this work.

2 Literature review

Prior to give detailed explanation for the methodology adopted, firstly a brief mathematical equations-based introduction is provided for basic understanding of methods used. Hence, starting from generalized linear model (GLM) for EEG measurements, which is explained as [14]:

$$\begin{aligned} Y=LJ+\in \end{aligned}$$
(1)

where \(Y\in \mathfrak {R}^{N_c\times N_n}\) is EEG dataset acquired by \(N_c \) sensors and the number of time samples is \(N_n\). The current density \(J\in \mathfrak {R}^{N_d \times N_n }\) is responsible for the propagation of the energy of \(N_d \) current dipoles distributed through the cortical surface. However, the dataset (Y) and the sources (J) are related through gain matrix L which is also termed as leadfield matrix.

Also, the assumptions of zero-mean Gaussian noise \(\in \) are taken into consideration. Thus, EEG source localization algorithms target at finding unknown current density (J) with available potential differences measurements (Y) and conductivity measurements. In this research work, the techniques used are defined below:

2.1 Minimum norm estimation (MNE)

This technique works upon basic principle of minimum norm which is used for underdetermined (ill-posed) systems. The system equation for the solution of EEG inverse problem is given by:

$$\begin{aligned} J_\mathrm{MNE} =L^{T}(LL^{T})Y \end{aligned}$$
(2)

This technique works upon the assumption of no a priori information. The only assumption it takes into account for solution is that the current distribution should have minimum overall intensity (smallest L2-norm) [6]. The technique was developed in [7]. Further details are provided in review paper [15].

2.2 LORETA

LORETA stands for low-resolution brain electromagnetic tomography, and it was developed by R.D. Pascual–Marqui in [8]. LORETA calculates current distribution throughout full brain volume. This technique was proposed to localize the 3D solutions properly as compared to previous minimum norm approaches where there was no prior knowledge. LORETA has prior knowledge about the sources since it selects the solution with smoothest current source distribution. It is not location specific as Laplacian is not well defined for surface. This spatial smoothness constraint is expressed using the 3D discretized Laplacian matrix. The solution for LORETA is given by:

$$\begin{aligned} J^{{\prime }}= & {} TY,\nonumber \\ \hbox {with}\,T= & {} \left( {WB^{T}BW} \right) ^{-1}L^{T}\left\{ {L\left( {WB^{T}BW} \right) ^{-1}L^{T}} \right\} ^{+} \end{aligned}$$
(3)

Here B is discrete Laplacian operator, and W is weight matrix. Also, \(A^{+}\) denotes the Moore–Penrose pseudo-inverse of matrix A.

LORETA provides good solution but with low spatial resolution which is not desirable for pattern recognition features. Some of the other methods related to LORETA are standardized LORETA (sLORETA) [16], exact LORETA (eLORETA) [17, 18] and WMN-LORETA [19] etc.

2.3 Beamformer

Beamforming is applied in array signal processing which includes sonar, radar and seismic exploration. For EEG data, beamforming acts as a spatial filter being applied to any location and thus attenuates the effect of all other sources and estimate the source at that particular position by using EEG data. Considering a beamformer which is monitoring signals from a dipole at any location, then a vector beamformer having three spatial filters (for covering three dimensions) is needed to estimate the location of source such that the output vector y(t) is formed as the product of a \(3\times N\) spatial filtering matrix \(W^{T}\) with m(t), the signal at the array at time t. Hence, it can be expressed as:

$$\begin{aligned} y(t)=W^{T}m(t) \end{aligned}$$
(4)

Thus, the spatial filter has following constraints to obey:

$$\begin{aligned} W^{T}A\left( r \right) =\left\{ {{\begin{array}{l} {I\left\| {r-r_q } \right\| \le \delta } \\ {0\left\| {r-r_q } \right\| >\delta } \\ \end{array} }} \right. \end{aligned}$$
(5)

The first one is pass-band and the next one is stop-band constraint, respectively.

Here \(A(r)=\left[ {a(r,\theta _1 ),a(r,\theta _2 ),a(r,\theta _3 )} \right] \) is the forward matrix for three orthogonal dipoles at location r. The spatial filter should ideally pass signals within a small distance \(\delta \) of the location of interest \(r_{q}\).

2.4 Multiple sparse priors (MSP)

MSP is based on Bayesian framework which means it works upon basic formulation provided by Bayes’ theorem. The covariance matrices are calculated for sensor as well as source level. In this method, the assumption of zero-mean Gaussian noise is taken into consideration. The Bayesian model which allows calculating the posterior source activity distribution by using prior probability of the source activity based on previous knowledge of brain for fitting the data using the likelihood is given by:

$$\begin{aligned} p(J|Y)=\frac{p(Y|J)p(J)}{p(Y)} \end{aligned}$$
(6)

Hence, to find out the estimated magnitude of the current dipole which model the brain source activation, the expectation operator is applied on current density (J) such that:

$$\begin{aligned} \mathop J\limits ^\wedge =E\left[ {p(J|Y)} \right] \end{aligned}$$
(7)

After some mathematical manipulation which is explained in detail in [13], the estimated current density with known values of source covariance (Q) and prior sensor-level covariance matrix \((\Sigma _\in )\) is given by:

$$\begin{aligned} \mathop J\limits ^\wedge =QL^{T}(\Sigma _\in +LQL^{T})^{-1}Y \end{aligned}$$
(8)

The details of this method related to mathematical derivations are provided in [14].

In this research work, the methods are compared in terms of free energy and localization error. Hence, after defining the mathematical model for MNE, LORETA, beamformer and MSP, there is need to define the free energy and localization error in terms of mathematical relations they follow. The negative variational free energy or simply free energy is used as cost function which relates accuracy and complexity as a function of hyperparameters. Thus, the relation is given as:

$$\begin{aligned} F(h)= \hbox {Accuracy}\,(h) -\hbox {Complexity}\,(h) \end{aligned}$$
(9)

where ,

$$\begin{aligned} \hbox {Accuracy}= & {} \frac{N_n }{2}tr\left( {\Sigma _Y \Sigma _Y^{-1} } \right) -\frac{N_n }{2}\hbox {log} \left| {\Sigma _Y } \right| \nonumber \\&-\frac{N_c N_n }{2}\hbox {log} \left( {2\pi } \right) , \end{aligned}$$
(10)

whereas the complexity term is defined as:

$$\begin{aligned} \hbox {Complexity}=-\sum _{i=1}^{N_\mathrm{p}} {f_i h_i } \end{aligned}$$
(11)

where \({N_\mathrm{p}}\) is number of patches and \({h_i}\) is hyperparameters.

From the above equation, it is evident that there exists a trade-off between the accuracy and complexity. The accuracy is dependent upon the number of covariance increased; however, at a certain point with an increase in covariance components, the accuracy increases but at the cost of high complexity. So a balance is maintained for increase in number of patches and thus covariance components so as to maintain a good trade-off between accuracy and complexity. The patches are defined for Bayesian-based models as the covariance components having an assumption that cortical currents have some local coherence within a distance of few millimeters. Hence, these set of patches form the search space for the inverse problem. For the MSP solution, the set of selected covariance components or patches is very important. In the absence of prior information, i.e., size, shape and location of neural current flow, the set of covariance components should ideally be composed of patches for all search space [14].

Continuing the discussion for another parameter i.e., localization error, it is defined as quantifying the localization capability of a particular source estimation algorithm. Thus, localization error is defined by computing Euclidean distance between true and estimated source location. Hence, mathematically,

$$\begin{aligned} Localization error=\left\| {S_\mathrm{true} -S_\mathrm{estimated} } \right\| \end{aligned}$$
(12)

The error is calculated for 3D, i.e., (xyz) positions for dipoles.

3 Methodology

The methodology adopted for implementation of reduced electrodes strategy is defined for synthetically generated EEG data and real-time EEG data. Hence, firstly the synthetic data generation protocol is defined and then real-time data are defined.

The synthetic EEG data are generated with a well-defined protocol by using MATLAB and SPM12 [20]. So firstly, the number of sources (two in our case) is defined. Thereafter, their position in CTF head model is defined. In this research work, the position is arbitrarily kept at 2000 and 5700 dipole position. Thus, the coordinates are calculated by using program. The amplitude of the dipoles is set with a particular frequency. Thereafter, BEM is used for head modeling. This head modeling follows all necessary steps from domain discretization to final model generation. After the head model is created, the data are corrupted with white noise at different SNR levels. In this work, the SNR level is kept at 5 dB. However, the real-time EEG data are taken from SPM software package which is then preprocessed using filtering, artifact removal, etc., in MATLAB environment.

Fig. 1
figure 1

Source activity related to 7-electrode synthetically generated EEG data

Fig. 2
figure 2

Source activity for various localization algorithms. a MSP, b LORETA, c MNE, d beamformer, e MSP (best case for 1100 patches)

Table 1 Free energy and localization error comparison for various techniques

In this research work, multimodal face evoked dataset is used for inversion for all algorithms. This dataset is available online on SPM website [20] which is kindly provided by Prof. Rik Henson. It is termed as multimodal because it has data from magnetometers (generating MEG data), gradiometers (also generating MEG data) and electrodes (generating EEG data), respectively. Many publications have followed this dataset for analyzing the localization for MEG and EEG modalities. The data were recorded by providing visual stimulus to healthy patients. The participants were members of MRC Cognition and Brain Sciences Unit participant panel. The multimodal data were compiled from total 19 participants (11 male and 8 female) with age group of 23–37 years with Caucasian origin. The study was approved by Cambridge University psychological ethics committee with written consent from participants. The stimuli provided during this study were series of faces half of which were famous (known to participants) and half non-famous (unknown to participants). The total number was 300 faces with half male and half female. Different variations were adapted for faces which ranges from difference in hair style, expression change (happy and neutral both) and change in orientation with majority of them between full-frontal to 3/4 view perspective. Besides this stimuli, another face dataset was created which was named as ‘scrambled faces’ as it was generated by scrambling either famous faces or unfamiliar faces by taking 2D Fourier transform of them by permuting the phase information and then inverse transforming back into image space. In this way, the power density spectrum of image remained maintained. Thus, scrambled faces were subjected to cropping by using mask created by combination of famous and unfamiliar faces. The MEG and EEG data were captured in a slight magnetically shielded room using an Elekta Neuromag vectorview 306 system (Helsinki, FI). The EEG was recorded by using a 74 channel Easycap EEG cap. The standard 10–10% electrode system was applied for readings. The sampling rate was kept at 1100 Hz with a low-pass filter at 350 Hz and no high pass filter. The reference electrode was placed at nose, and the common ground electrode was placed at the left collar bone. The electrooculograms (VEOG and HEOG) were measured by placing two sets of bipolar electrodes.

The captured EEG data are passed through some preprocessing steps such as data epoching, data downsampling, filtering to remove unwanted low- and high-frequency components, artifact removal by using thresholding technique and finally averaging to generate ERP signal.

After EEG data generation from synthetically generated protocol and real-time EEG data, the electrodes which are used to acquire the EEG data are mapped into Enobio EEG electrode layout [21] (See Fig. 6). The EEG was recorded by using a 74 channel Easycap EEG cap [22] (See Fig. 5). The standard 10–10% electrode system was applied for readings. This electrode mapping is shown in “Appendix”. The green channels are those which are selected for analysis only.

Fig. 3
figure 3

Event-related potential (ERP) signal from a random EEG channel

The next step is selecting the green colored electrodes in layout shown below and making all the remaining electrodes as ‘other’ in MATLAB-based SPM environment. This will reduce the number of electrodes from 74 to 7 as the effect of ‘Pz’ is considered merged into ‘Cz’ as they are located in the same zone with no electrode between them.

The SPM object is created with less number of electrodes and is thus loaded into for inversion. Hence, at the first instant, MSP is applied followed by application of classical algorithms which includes LORETA, MNE and beamformer is applied. The comparison is made in terms of free energy and localization error.

4 Results and discussion

The results are presented in the form of figures and tables. For this, the results are produced for MSP, LORETA, MNE and beamformer in terms of glass brain images which show the activation in all lobes. Firstly, the actual source maps are shown for synthetic data in Fig. 1.

Hence, all the techniques as discussed earlier are applied for multiple trials (> 40) to prove the validity of the algorithm. However, the MSP is applied for different number of patches to prove the efficiency of algorithm at multiple numbers of patches which maximizes the free energy and minimizes the localization error. This will increase the localization precision overall for reduced channel source localization. Hence, the glass brain images are shown for all techniques in Fig. 2.

Fig. 4
figure 4

Source activity for various localization algorithms for real-time EEG data. a MSP (best case for 700 patches), b MSP, c LORETA d MNE, e beamformer

Hence, the free energy and localization error are computed for multiple trials which are shown in Table 1.

In the similar way, the mentioned techniques are applied for real-time EEG data. For this, the real-time ERP signal after preprocessing steps is shown below.

Hence, the inversion algorithms which are mentioned above are applied on real-time EEG data (Fig. 3). In a similar way as was done for synthetically generated EEG data, here glass brains are produced for best (MSP at 700 patches), medium (MSP) and worst case (LORETA, MNE) in Fig. 4. These results in terms of negative variational free energy and computational time are further tabulated and shown in Table 2.

It can be observed from the results for synthetic as well as real-time EEG data that the performance of localization in terms of free energy, localization error and computational time is less affected by reducing the number of sensors. The resultant glass brain activations shows the localized sources which are close to generated source activity as shown in figures above. The multiple-trial results show improved free energy and localization error with increased number of patches. Furthermore, from real-time EEG results, it can be seen that the computational time is effectively reduced due to usage of less number of sensors. Thus, the overall system ability is proved to be stable for optimized number of patches MSP algorithm which has highest free energy with least localization error for reduced number of sensors. It is thus suggested that reduced sensors with optimized patches for Bayesian-based MSP performs best in terms of free energy, localization error and computational time consumed. The glass brain images for both data validate this fact. The results suggests that source localization with low error and higher free energy can be carried out with reduced system cost by reduction of sensors and effective reduction in computational time as well. This work can be extended to multiple SNR levels < 10 dB or even negative SNR levels to validate the fact in a more effective way.

5 Conclusion

EEG-based brain source localization is used to localize the active brain sources which are responsible for electromagnetic activity inside the brain. These data assist to diagnose various brain disorders. Among them, MNE, LORETA, beamformer and MSP are the most common one. This research work implements these algorithms with reduced number of sensors to indicate the system ability to localize the sources in terms of less computational time, less system complexity and least localization error. Hence, the techniques were tested for real-time and synthetically generated EEG dataset at lower SNR level, i.e., 5 dB. It was shown through results that MSP with increased number of patches performed best even with only seven sensors. Thus, the reduced sensors provided better results in terms of free energy and localization error with increased number of patches, i.e., 300, 700 and 1100 for Bayesian framework-based MSP, respectively. The future work can be design of localization system using this strategy with BEM as forward modeling tool and MSP with optimized patches as inversion method.

Table 2 Free energy and computational time comparison for various techniques