Abstract:
We describe a method of processing an EEG and/or MEG signal to generate image data representing a 3D current distribution, J, within the brain, the method comprising: capturing a plurality of electric and/or magnetic measurements from the exterior of the head; solving an integral equation for a part of said current distribution to generate said image data representing said 3D current distribution, wherein said integral equation comprises an integral of a first function representing said part of said current distribution and of a second function (∇ τ v s  (r, τ)) representing the geometry and conductivity of the head independent of said current distribution; wherein said solving comprises: modelling the head as at least two regions separated by at least one internal boundary, and solving a set of partial differential equations, one for each said internal region, each partial differential equation comprising a geometry-conductivity function (w(r, τ)) representing the geometry and conductivity of the respective region, wherein said solving is subject to a boundary condition that either i) the gradients of the functions across the or each said internal boundary are smooth when conductivity is taken into account, or ii) a normal component of the electric field of said part of said current distribution is continuous across the or each said internal boundary, and wherein said geometry-conductivity function for an outermost said region of said head defines said second function (∇ T v s  (r, τ))

Description:
FIELD OF THE INVENTION 
       [0001]    This invention relates to methods, apparatus, and computer program code for generating image data from EEG (electroencephalography) and/or MEG (magnetoencephalography) signals. 
       BACKGROUND TO THE INVENTION 
       [0002]    Active neurons produce small currents whose basis is the change in the concentration of certain ions (ionic currents). The flow of current in the neural system produces a weak magnetic field. The measurement of this field outside the head and the estimation of the neuronal current which produced this field is called Magnetoencephalography (MEG). In spite of the fact that neuromagnetic signals are only of the order of 50-500 fT, it is still possible to measure them using the superconductivity quantum interference device. Electroencephalography (EEG) measures the electric potential on the scalp. Although EEG plays a significant role in clinical practice especially in epilepsy, it is not routinely used to produce images depicting the areas of the brain which are more active; such images are produced via MEG. In order to produce images of brain activation using either MEG or EEG it is necessary to solve certain mathematical inverse problems. The relevant inverse problems for MEG and EEG involve the calculation of the neuronal current from the knowledge of the magnetic field and of the electric potential, respectively. Currently there exist two main approaches for the solution of the above inverse problems: 1. Dipole Models. Here it is assumed that the neuronal current is localized only at a small number of points. At each of these points the current is expressed in terms of a dipole characterized by the location T j  and the moment Q j , j=1; 2; . . . N, where N is small, and the constants {Q j ,τ j } 1   N  are to be determined. The magnetic field and the electric potential are computed starting with the above current, and then the constants {Q j ,τ j } 1   N  are adjusted step by step minimizing a certain natural cost function. 2. Distributed Models. Here the continuous current is approximated again via a sum of dipoles, but now N is very large of the order of 1000 to 10,000. Then, the procedure is similar to the one described for dipole models. 
         [0003]    The first, dipole models approach described above is based on the assumption that a small number of dipoles is sufficient for modelling the neuronal current. The unknown parameters are the positions and orientations of these dipoles and these are adjusted to minimize the mismatch between the values of the electric potential in the case of EEG, and of the magnetic field in the case of MEG generated by the dipoles and the actual measurements. However these methods rely on local optimisation and suffer from getting trapped by local minima. Furthermore, they require the assumption that the number of dipoles is less than the number of sensors. The second, distributed source modelling approach divides the cerebrum into voxels each representing a possible of location of a current source (there is no a priori assumption regarding the number of dipoles), and the objective is to find a configuration of activity at these locations which is consistent with the measurements. However there exists an infinite number of distributions of current sources which can generate the same scalp electric potential and the same magnetic field outside the head and thus the inverse problem is highly ill-posed. This in turn necessitates the use of various assumptions which are often inappropriate; the technique also suffers from ‘cross-talk’ in that the activity at an arbitrary location is contaminated by activity from other brain regions. 
         [0004]    One of the inventors finally provided a solution to the non-uniqueness problem, which is fundamental to reconstructing a current distribution based on MEG/EEG: although it is not possible to uniquely reconstruct the current in a conductor from knowledge of the electric potential on its boundary, or of magnetic field outside the conductor it is possible to determine which part of the current can be reconstructed via MEG and/or EEG. This solution is described in “ Electro - magneto - encephalography for a Three - shell Model: Distributed Current in Arbitrary, Spherical and Ellipsoidal Geometries ”, A S Fokas,  J.R. Soc. Interface,  6:479-488, 2009. Further background prior art can be found in A S Fokas et al., “ Electro - magneto - encephalography for the Three - shell Model: numerical implementation via splines for distributed current in spherical geometries”, Inverse Problems,  28, 2012. General background can be found in Liang et al., “ Source reconstruction of brain electromagnetic fields ”, Neuroimage, 27:1301-1311, 2009; Huang et al., “ A novel integrated MEG and EEG analysis method for dipolar sources ”, Neuroimage, 37:731-748, 2007; EP1468647; and JP2005/287675A. 
         [0005]    The primary neuronal current distribution J P  (T) is specified by three components of the current. This can be modelled by a combination of a scalar function, ψ, and a vector function A (altogether) with the constraint that the divergence of A is zero (giving 3 independent components). The use of EEG provides information about ψ, more particular the electric potential on the scalp can be represented by a combination of ψ and a second function v s  (where s denotes the surface of the scalp). The use of MEG provides information about A; more particularly the MEG signal can be modelled by a combination of ψ and A, in combination with an auxiliary (vector) function H. Both H and v s  are independent of the current distribution and depend only on the geometry and conductivity of the head. 
         [0006]    The function H, is derivable from v s . In addition Fokas identified a set of partial differential equations whose solution defines v s  (equations 2.11-2.14 in the paper, ibid). These are adumbrated below (renumbered as 0.11 et seq): 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           u 
                           c 
                         
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         
                           ∂ 
                           
                               
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                        
                       
                         [ 
                         
                           
                             1 
                             
                                
                               
                                 r 
                                 - 
                                 τ 
                               
                                
                             
                           
                           + 
                           
                             
                               v 
                               c 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                     
                     = 
                     
                       
                         σ 
                         f 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               f 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     
                       r 
                       ∈ 
                       
                         ∂ 
                         
                           Ω 
                           c 
                         
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   0.11 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           v 
                           f 
                         
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       f 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         v 
                         f 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         1 
                         
                           σ 
                           c 
                         
                       
                        
                       
                         [ 
                         
                           
                             1 
                             
                                
                               
                                 r 
                                 - 
                                 τ 
                               
                                
                             
                           
                           + 
                           
                             
                               v 
                               c 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         c 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         σ 
                         f 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               f 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                     = 
                     
                       
                         σ 
                         b 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               b 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         f 
                       
                     
                   
                   , 
                   
                     
                       τ 
                       ∈ 
                       
                         Ω 
                         c 
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   0.12 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           v 
                           b 
                         
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       b 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         v 
                         b 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         v 
                         f 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         f 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         σ 
                         b 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               b 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                     = 
                     
                       
                         σ 
                         s 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               s 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         b 
                       
                     
                   
                   , 
                   
                     
                       τ 
                       ∈ 
                       
                         Ω 
                         c 
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   0.13 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           v 
                           s 
                         
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       s 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         v 
                         s 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         v 
                         b 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         b 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         ∂ 
                         
                           
                             v 
                             s 
                           
                            
                           
                             ( 
                             
                               r 
                               , 
                               τ 
                             
                             ) 
                           
                         
                       
                       
                         ∂ 
                         n 
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       
                         ∂ 
                         
                           Ω 
                           s 
                         
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   0.14 
                   ) 
                 
               
             
           
         
       
     
         [0007]    In the above equations Ω denotes a three-dimensional space occupied by a conducting medium and ∂Ω its boundary. The head is modelled as four regions, a central region Ω c  occupied by the cerebrum/brain (subscript c), around which are located three shells, Ω ƒ , Ω b , and Ω s , respectively, modelling the spaces occupied by the cerebrospinal fluid (subscript f), the skull (subscript b), and the skin/scalp (subscript s). The region external to the head is denoted Ω e . In the equations ∂Ω c , ∂Ω ƒ , ∂Ω b , and ∂Ω s  denote the smooth boundaries of the domains Ω c , Ω ƒ , Ω b , and Ω s , respectively. Each region has a respective electrical conductivity Υ c , σ ƒ , σ b , σ s ; the magnetic permeability is μ. The r vector (rεR 3 ) denotes position; later the (primary) neuronal current, the magnetic field, and the electric potential are denoted J P  (r), B(r) and u(r) respectively. Similarly τ denotes a position vector within Ω c  (where the primary current, J P  (r), is defined). The derivative 
         [0000]    
       
         
           
             
               ∂ 
               
                   
               
             
             
               ∂ 
               n 
             
           
         
       
     
         [0000]    denotes differentiation along the direction of {circumflex over (n)} where the hat denotes a unit vector and {circumflex over (n)} denotes the unit vector outward normal to the surface ∂Ω. As stated above, equations (0.11)-(0.14) are independent of the current J P (τ) and depend only on the geometry and on the conductivities σ c , σ b , σ ƒ and σ s . 
         [0008]    The skilled person will appreciate that to solve a set of partial differential equations the information needed comprises the equations, the respective domains of the equations, and the boundary conditions, as given above. Solving the above equations would lead to a value for v s , which could then be used to solve the inverse problem for EEG and/or MEG. However there is a problem in that the above equations cannot readily be solved. 
       SUMMARY OF THE INVENTION 
       [0009]    According to an aspect of the present invention there is therefore provided a method of processing an EEG and/or MEG signal to generate image data representing a 3D current distribution, J, within the brain, the method comprising: capturing a plurality of electric and/or magnetic measurements from the exterior of the head; solving an integral equation for a part of said current distribution to generate said image data representing said 3D current distribution, wherein said integral equation comprises an integral of a first function representing said part of said current distribution and of a second function (∇ τ v s (r,τ)) representing the geometry and conductivity of the head independent of said current distribution; wherein said solving comprises: modelling the head as at least two regions separated by at least one internal boundary, and solving a set of partial differential equations, one for each said internal region, each partial differential equation comprising a geometry-conductivity function (w(r, τ)) representing the geometry and conductivity of the respective region, wherein said solving is subject to a boundary condition that either i) the gradients of the functions across the or each said internal boundary are smooth when conductivity is taken into account, or ii) a normal component of the electric field of said part of said current distribution is continuous across the or each said internal boundary, and wherein said geometry-conductivity function for an outermost said region of said head defines said second function (∇ τ v s (r,τ)). 
         [0010]    Broadly speaking, the inventors have recognised that the previously described equations can be solved if they are recast into a different form, in particular one which avoids the problematical boundary condition of equation 0.11 above (in embodiments, the set of partial differential equations 15-18 given later). Thus in embodiments of the invention the equations are modified so that each is subject to a boundary condition that there is continuity of the normal component of the electric field across a region boundary, in other words that the gradients of the functions across the/or each internal boundary are smooth when conductivity is taken into account. This in turn changes the initial partial differential equation for the innermost region (equation 0.11 above) from a Laplace&#39;s equation to a Poisson&#39;s equation form, that is the right hand side of the equation is a function rather than zero. This, however, is a tractable form. Moreover when expressed in this way the set of partial differential equations effectively expresses the functions v defined in terms of the fields generated from a monopole source rather than fields generated by a dipole source (as is the case for equations 0.11-0.14). 
         [0011]    The geometry-conductivity function w is proportional to the gradient of the function v in equations 0.11-0.14, which is consistent with the observation that the potential of a dipole is the directional derivative of the potential of a monopole. More particularly, in embodiments the geometry-conductivity function for the outermost region of the head (w s ) is proportional to the second function referred to above (the second function being the gradient of the previously described function v). 
         [0012]    In embodiments the set of partial differential equations comprises a partial differential equation for an innermost said region in the Poisson equation form σ c  ∇ 2 w c ∝∇·Qδ(r−τ), where r is a position vector within said innermost region, τ is a dummy variable, Q is a charge, δ is the delta function, w c  is the geometry-conductivity function for the innermost region and σ c  is an electrical conductivity of the innermost region. The partial differential equations for subsequent successively more outer regions j then have the Laplace equation form ∇ 2 w j =0. In embodiments the boundary conditions define that 
         [0000]    
       
         
           
             
               
                 σ 
                 
                   j 
                   - 
                   1 
                 
               
                
               
                 
                   ∂ 
                   
                     w 
                     
                       j 
                       - 
                       1 
                     
                   
                 
                 
                   ∂ 
                   n 
                 
               
             
             = 
             
               
                 σ 
                 j 
               
                
               
                 
                   ∂ 
                   
                     w 
                     j 
                   
                 
                 
                   ∂ 
                   n 
                 
               
             
           
         
       
     
         [0000]    where j−1 denotes a region within region j, and where n denotes a unit vector outward normal to the surface of the boundary between regions j−1 and j. 
         [0013]    The integral equation(s) solved to determine a part of the current distribution depends upon whether EEG data and/or MEG data is being processed. In either case, however, once the relevant part or parts of the current distribution have been determined data representing this distribution may be used directly as the image data, representing the data in any convenient manner—for example overlaying the data on a 3D representation of a head/brain and/or on a 2D slice through a head/brain. 
         [0014]    The integral equation solved for an EEG signal is: 
         [0000]    
       
         
           
             
               
                 
                   u 
                   s 
                 
                  
                 
                   ( 
                   r 
                   ) 
                 
               
               = 
               
                 
                   - 
                   
                     1 
                     
                       4 
                        
                       π 
                     
                   
                 
                  
                 
                   
                     ∫ 
                     
                       Ω 
                       c 
                     
                   
                    
                   
                     
                       ( 
                       
                         
                           ∇ 
                           2 
                         
                          
                         
                           Ψ 
                            
                           
                             ( 
                             τ 
                             ) 
                           
                         
                       
                       ) 
                     
                      
                     
                       
                         v 
                         s 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                      
                     
                        
                       
                         V 
                          
                         
                           ( 
                           τ 
                           ) 
                         
                       
                     
                   
                 
               
             
             , 
             
                 
             
              
             
               r 
               ∈ 
               
                 ∂ 
                 
                   Ω 
                   s 
                 
               
             
             , 
           
         
       
     
         [0000]    where u s  (r) defines measured electric potential on a boundary of the outermost region of the head (the scalp) at position r, Ω c  defines the innermost, cerebrum region, Ω s  defines a surface of the outermost, scalp region, v s (r,τ) is an integral of said second geometry-conductivity function ∇ τ v s  (r, τ) for the outermost, scalp region. Here ω is a scalar value representing an irrotational part of the 3D current distribution (ψ is determined by solving the inverse problem). 
         [0015]    The integral equation solved for an MEG signal is: 
         [0000]    
       
         
           
             
               
                 
                   
                     4 
                      
                     π 
                   
                   μ 
                 
                  
                 
                   
                     B 
                      
                     
                       ( 
                       r 
                       ) 
                     
                   
                   · 
                   r 
                 
               
               = 
               
                 
                   
                     - 
                     
                       
                         ∫ 
                         
                           Ω 
                           c 
                         
                       
                        
                       
                         
                           
                             ∇ 
                             2 
                           
                            
                           
                             ( 
                             
                               τ 
                               · 
                               
                                 A 
                                  
                                 
                                   ( 
                                   τ 
                                   ) 
                                 
                               
                             
                             ) 
                           
                         
                          
                         
                           
                              
                             
                               V 
                                
                               
                                 ( 
                                 τ 
                                 ) 
                               
                             
                           
                           
                              
                             
                               r 
                               - 
                               τ 
                             
                              
                           
                         
                       
                     
                   
                   + 
                   
                     
                       1 
                       
                         4 
                          
                         π 
                       
                     
                      
                     
                       
                         ∫ 
                         
                           Ω 
                           c 
                         
                       
                        
                       
                         
                           ( 
                           
                             
                               ∇ 
                               2 
                             
                              
                             
                               Ψ 
                                
                               
                                 ( 
                                 τ 
                                 ) 
                               
                             
                           
                           ) 
                         
                          
                         
                           r 
                           · 
                           
                             H 
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                          
                         
                            
                           
                             V 
                              
                             
                               ( 
                               τ 
                               ) 
                             
                           
                         
                          
                         
                             
                         
                          
                         r 
                       
                     
                   
                 
                 ∈ 
                 
                   Ω 
                   e 
                 
               
             
             , 
           
         
       
     
         [0000]    where B(r) defines a measured magnetic field at a sensor position r, Ω c  defines the innermost, cerebrum region of the head, and Ω e  defines the external region beyond the head. Here H(r,τ) is a vectorial geometry-conductivity function for the head, defined by the geometry-conductivity functions for the modelled regions of said head (w (r,τ)). This integral also uses the scalar value ψ (which may be determined from an EEG signal), and in addition depends onτ·A(τ), which defines a radial component of a solenoidal part of the 3D current distribution (here τ·A(τ) is determined by solving the inverse problem). 
         [0016]    The skilled person will recognise that, in solving an integral equation of the above type, the equation need not be solved in the form written above and may be re-arranged or rewritten, and equivalently solved in a different form. For example the EEG integral equation given above may be rewritten using Green&#39;s theorem as follows: 
         [0000]    
       
         
           
             
               
                 
                   u 
                   s 
                 
                  
                 
                   ( 
                   r 
                   ) 
                 
               
               = 
               
                 
                   1 
                   
                     4 
                      
                     π 
                   
                 
                  
                 
                   
                     ∫ 
                     
                       Ω 
                       c 
                     
                   
                    
                   
                     
                       
                         ∇ 
                         
                           Ψ 
                            
                           
                             ( 
                             τ 
                             ) 
                           
                         
                       
                       · 
                       
                         
                           ∇ 
                           τ 
                         
                          
                         
                           
                             v 
                             s 
                           
                            
                           
                             ( 
                             
                               r 
                               , 
                               τ 
                             
                             ) 
                           
                         
                       
                     
                      
                     
                        
                       
                         V 
                          
                         
                           ( 
                           τ 
                           ) 
                         
                       
                     
                   
                 
               
             
             , 
             
                 
             
              
             
               r 
               ∈ 
               
                 ∂ 
                 
                   Ω 
                   s 
                 
               
             
           
         
       
     
         [0017]    Similarly the MEG integral equation above may be rewritten using Green&#39;s theorem as: 
         [0000]    
       
         
           
             
               
                 
                   
                     4 
                      
                     π 
                   
                   μ 
                 
                  
                 
                   
                     B 
                      
                     
                       ( 
                       r 
                       ) 
                     
                   
                   · 
                   r 
                 
               
               = 
               
                 
                   - 
                   
                     
                       ∫ 
                       
                         Ω 
                         c 
                       
                     
                      
                     
                       
                         
                           ∇ 
                           2 
                         
                          
                         
                           ( 
                           
                             τ 
                             · 
                             
                               A 
                                
                               
                                 ( 
                                 τ 
                                 ) 
                               
                             
                           
                           ) 
                         
                       
                        
                       
                         
                            
                           
                             V 
                              
                             
                               ( 
                               τ 
                               ) 
                             
                           
                         
                         
                            
                           
                             r 
                             - 
                             τ 
                           
                            
                         
                       
                     
                   
                 
                 - 
                 
                   
                     1 
                     
                       4 
                        
                       π 
                     
                   
                    
                   
                     
                       ∑ 
                       
                         l 
                         ∈ 
                         
                           { 
                           
                             1 
                             , 
                             2 
                             , 
                             3 
                           
                           } 
                         
                       
                     
                      
                     
                       
                         ∫ 
                         
                           Ω 
                           c 
                         
                       
                        
                       
                         
                           
                             r 
                             l 
                           
                            
                           
                             [ 
                             
                               
                                 ∇ 
                                 
                                   Ψ 
                                    
                                   
                                     ( 
                                     τ 
                                     ) 
                                   
                                 
                               
                               · 
                               
                                 
                                   ∇ 
                                   τ 
                                 
                                  
                                 
                                   
                                     H 
                                     l 
                                   
                                    
                                   
                                     ( 
                                     
                                       r 
                                       , 
                                       τ 
                                     
                                     ) 
                                   
                                 
                               
                             
                             ] 
                           
                         
                          
                         
                            
                           
                             V 
                              
                             
                               ( 
                               τ 
                               ) 
                             
                           
                         
                       
                     
                   
                 
               
             
             , 
             
                 
             
              
             
               r 
               ∈ 
               
                 
                   Ω 
                   e 
                 
                 . 
               
             
           
         
       
     
         [0018]    To facilitate solving the inverse problem for MEG the inventors have recognised that the above integral equation may usefully be rewritten as follows: 
         [0000]    
       
         
           
             
               
                 ∫ 
                 
                   Ω 
                   c 
                 
               
                
               
                 
                   
                     ∇ 
                     2 
                   
                    
                   
                     ( 
                     
                       τ 
                       · 
                       
                         A 
                          
                         
                           ( 
                           τ 
                           ) 
                         
                       
                     
                     ) 
                   
                 
                  
                 
                   
                      
                     
                       V 
                        
                       
                         ( 
                         τ 
                         ) 
                       
                     
                   
                   
                      
                     
                       r 
                       - 
                       τ 
                     
                      
                   
                 
               
             
             = 
             
               
                 
                   - 
                   
                     1 
                     
                       4 
                        
                       π 
                     
                   
                 
                  
                 
                   
                     ∑ 
                     
                       l 
                       ∈ 
                       
                         { 
                         
                           1 
                           , 
                           2 
                           , 
                           3 
                         
                         } 
                       
                     
                   
                    
                   
                     
                       ∫ 
                       
                         Ω 
                         c 
                       
                     
                      
                     
                       
                         
                           r 
                           l 
                         
                          
                         
                           [ 
                           
                             
                               ∇ 
                               
                                 Ψ 
                                  
                                 
                                   ( 
                                   τ 
                                   ) 
                                 
                               
                             
                             · 
                             
                               
                                 ∇ 
                                 τ 
                               
                                
                               
                                 
                                   H 
                                   l 
                                 
                                  
                                 
                                   ( 
                                   
                                     r 
                                     , 
                                     τ 
                                   
                                   ) 
                                 
                               
                             
                           
                           ] 
                         
                       
                        
                       
                          
                         
                           V 
                            
                           
                             ( 
                             τ 
                             ) 
                           
                         
                       
                     
                   
                 
               
               - 
               
                 
                   
                     4 
                      
                     π 
                   
                   μ 
                 
                  
                 
                   
                     B 
                      
                     
                       ( 
                       r 
                       ) 
                     
                   
                   · 
                   r 
                 
               
             
           
         
       
     
         [0019]    In some preferred implementations of the technique the inverse problem is solved for EEG by determining the scalar value ψ representing an irrotational part of the 3D current distribution by writing ψ in terms of a set of basis functions having respective unknown coefficients λ   i   defined by a vector λ. In some preferred embodiments radial basis functions are employed, which is convenient, but the skilled person will appreciate that other basis functions may also be employed. Such an expansion enables the integral equation to be reformulated as a set of equations represented by a matrix equation: 
         [0000]    
       
      
       b=E·λ 
      
     
         [0000]    where b comprises a vector of the electric potential measurements on the scalp. This is straightforward to solve to determine an estimate of λ using a least squares approach. In the above matrix equation the matrix E has the substantial advantage that elements of the matrix depend only on the geometry and conductivity of the model of the head (and the basic functions). Thus although relatively computationally expensive to calculate, the elements of matrix E may be pre-computed and stored for use in solving the EEG inverse problem. Broadly speaking, determining an estimate for λ then reduces to a matrix inversion. The skilled person will appreciate that there are many different techniques which may be employed to solve the above matrix equation. 
         [0020]    It will be appreciated that, depending upon the accuracy of the desired results, the model of the head may be more or less complicated—that is although it incorporates a model of the cerebrum (brain) one or more of the subsequent shells may be omitted, albeit it is preferable to represent each of the cerebrospinal fluid (CSF), the bone of the skull, and the skin of the scalp. Interestingly, and counter-intuitively, the elements of matrix E may be pre-computed for one or more generic head models, thus avoiding the need to determine the particular geometry of the head of a patient under examination, for example by MRI (magnetic resonance imaging) scan or the like. Nonetheless it is preferable to have an exact model of the head geometry for accuracy; the conductivity values used for the different regions of the head are essentially standard. 
         [0021]    When modelling an MEG signal it is preferable to also capture EEG data and then use this to estimate the scalar component of the current distribution, ψ (from λ). In addition a second, related set of geometryconductivity functions H can be calculated from the set of geometry-conductivity functions v (or w). A similar matrix equation to that given above can then be written for the MEG data (for example from SQUID measurements), as follows. 
         [0022]    A radial component of the solenoidal part of the 3D current distribution, τ·A(τ), is expanded in terms of basis functions, again radial basis functions in preferred embodiments, these functions having coefficients defined by a vector β. Then 
         [0000]    
       
      
       Mβ=c  
      
     
         [0000]    where c comprises a vector representation of the magnetic field measurements, B(r i ), at sensor positions r i . For increased accuracy the vector c preferably also includes a term dependent on the scalar function iv, in particular in combination with the previously described (current distribution-independent) vectorial geometry-conductivity function H(r,τ) (determined from the geometry-conductivity functions for the modelled head regions, w(r,τ)). 
         [0023]    Like E, M need only be computed once for a particular head and then stored for subsequent use; or a generic M may be used for all heads or heads of a particular type, for example size and/or shape). As before, the skilled person will be aware of many techniques which may be employed to solve the matrix equation to estimate a value for β, including for example a least squares method, and hence to derive an estimate of the solenoidal part of the current distribution. 
         [0024]    The invention further provides processor control code to implement the above-described methods, for example on a general purpose computer system or on a digital signal processor (DSP). The code is provided on a non-transitory physical data carrier such as a disk, CD- or DVD-ROM, programmed memory such as non-volatile memory (eg Flash) or read-only memory (Firmware). Code (and/or data) to implement embodiments of the invention may comprise source, object or executable code in a conventional programming language (interpreted or compiled) such as C, or assembly code, or code for a hardware description language. As the skilled person will appreciate such code and/or data may be distributed between a pluralities of coupled components in communication with one another. 
         [0025]    In a related aspect the invention provides a system for processing an EEG and/or MEG signal to generate image data representing a 3D current distribution, J, within the brain, the system comprising: an input to receive a plurality of captured electric and/or magnetic measurements from the exterior of the head; and a processor coupled to said input, to an output, to working memory and to program memory storing processor control code, wherein the stored code comprises code to: solve an integral equation for a part of said current distribution to generate said image data representing said 3D current distribution, wherein said integral equation comprises an integral of a first function representing said part of said current distribution and of a second function (∇ τ v s (r,τ)) representing the geometry and conductivity of the head independent of said current distribution; wherein said solving comprises: modelling the head as at least two regions separated by at least one internal boundary, and solving a set of partial differential equations, one for each said internal region, each partial differential equation comprising a geometry-conductivity function (w(r,τ)) representing the geometry and conductivity of the respective region, wherein said solving is subject to a boundary condition that either i) the gradients of the functions across the or each said internal boundary are smooth when conductivity is taken into account, or ii) a normal component of the electric field of said part of said current distribution is continuous across the or each said internal boundary, and wherein said geometry-conductivity function for an outermost said region of said head defines said second function (∇ τ v s  (r,τ)); and output said image data, wherein said image data comprises data representing a part of said 3D current distribution. 
         [0026]    In embodiments the system is implemented on a general purpose computer system coupled to an EEG and/or MEG system to obtain the input data for processing. Alternatively the system may be built into an EEG and/or MEG system. Still further alternatively the system may be remote from an EEG and/or MEG system, for example on a computer network or in the ‘cloud’ to provide EEG and/or MEG signal processing as a service. Still further alternatively the system may be implemented in electronic circuitry or other hardware, for example using a digital signal processor and/or one or more ASICs (application specific integrated circuits). 
         [0027]    As previously described the output image data may simply comprise data representing the determined irrotational and/or solenoidal part of the current distribution J. The data may be output to a screen, printer, over the network, or in any other suitable manner. The data may be visualised, for example as an overlay on a 3D image of the head or brain and/or on a 2D section of a head/brain. 
         [0028]    In a further related aspect the invention provides a method of processing an EEG signal to generate image data representing a 3D current distribution, J, within the brain, the method comprising: capturing a plurality of measurements of electric potential on the scalp (b); and using a representation of a part of said current distribution as an expansion having a series of unknown coefficients, λ, of expansion basis functions, where b is dependent on a product of a matrix E and λ, and where E represents the geometry and conductivity of the head independent of said current distribution, wherein said geometry includes at least one internal boundary within the head, solving an equation combining b and E·λ to determine an estimate of λ, wherein λ defines said 3D current distribution; wherein E·λ represents 
         [0000]      ∫ Ω     c   (∇ 2 Ψ(τ)) v   s ( r ,τ) dV (τ)
 
         [0000]    where ψ is a scalar value representing J, where v s (r, τ) is a function representing the geometry and conductivity of the head independent of said current distribution, Ω c  denotes the region of the brain over which the current distribution is determined, r lies on the surface of the scalp on which EEG measurements are made, and r is a dummy variable; and wherein, in said matrix E, a value of an element of the matrix E is defined by an integral, over a region including said current distribution, of a gradient of a said expansion basis function and a function w s (r, τ) representing v s  (r, τ); where w s (r, τ) alternatively represents the geometry and conductivity of the head independent of said current distribution, wherein a function w(r, τ) is determined for each internal region of the head defined by said at least one internal boundary, wherein w s (r, τ) is the outermost said function w(r, τ), and wherein w s (r, τ) is determined subject to the constraint that, when conductivity is taken into account, the gradients of the functions w(r, τ) on either side of different regions of the head separated by a said internal boundary are smooth across each said internal boundary such that a normal component of electric field is continuous across each said internal boundary; and generating image data representing said 3D current distribution from said estimate of λ. 
         [0029]    Again, in embodiments the above described boundary conditions apply across each internal boundary of the head; using a set of partial differential equations with this set of boundary conditions makes the problem tractable. 
         [0030]    In a complementary aspect the invention provides a system for processing an EEG signal to generate image data representing a 3D current distribution, J, within the brain, the system comprising: an input to receive a plurality of measurements of electric potential on the scalp (b); and a processor coupled to said input, to an output, to working memory and to program memory storing processor control code, wherein the stored code comprises code to: use a representation of a part of said current distribution as an expansion having a series of unknown coefficients, λ, of expansion basis functions, where b is dependent on a product of a matrix E and λ, and where E represents the geometry and conductivity of the head independent of said current distribution, wherein said geometry includes at least one internal boundary within the head, to solve an equation combining b and E·λ to determine an estimate of λ, wherein λ defines said 3D current distribution; wherein E·λ represents 
         [0000]      ∫ Ω     c   (∇ 2 Ψ(τ)) v   s ( r ,τ) dV (τ)
 
         [0000]    where ψ is a scalar value representing J, where v s (r, τ) is a function representing the geometry and conductivity of the head independent of said current distribution, Ω c  denotes the region of the brain over which the current distribution is determined, r lies on the surface of the scalp on which EEG measurements are made, and T is a dummy variable; and wherein, in said matrix E, a value of an element of the matrix E is defined by an integral, over a region including said current distribution, of a gradient of a said expansion basis function and a function w s (r, τ) representing v s  (r, τ); where w s (r, τ) alternatively represents the geometry and conductivity of the head independent of said current distribution, wherein a function w(r, τ) is determined for each internal region of the head defined by said at least one internal boundary, wherein w s (r, τ) is the outermost said function w(r, τ), and wherein w s (r, τ) is determined subject to the constraint that, when conductivity is taken into account, the gradients of the functions w(r, τ) on either side of different regions of the head separated by a said internal boundary are smooth across each said internal boundary such that a normal component of electric field is continuous across each said internal boundary; and output image data representing said 3D current distribution determined from said estimate of λ. 
         [0031]    In a further related aspect the invention provides A method of processing an EEG and/or MEG signal to generate data representing an image of a 3D current distribution, J, within the brain, the method comprising: capturing a plurality of electric and/or magnetic measurements b from the exterior of the head; and determining a representation of a part of said 3D current distribution by determining an estimate of λ in b=E·λ, where λ comprises a vector of coefficients of basis functions in an expansion of a scalar value, ψ, representing said part of said 3D current distribution, wherein b comprises a vector representing said measurements, and E is a matrix with elements E(i, j) which represent the geometry and conductivity of a head independent of said 3D current distribution; and outputting data defining a representation of said part of said 3D current distribution, to provide data representing an image of said 3D current distribution. 
         [0032]    Again the matrix elements may be computed as previously described. Thus embodiments of the method may include precomputing and storing matrix E prior to capturing the measurements. Optionally the same precomputed and stored matrix E may be used for a plurality of different determinations of 3D current distributions for a plurality of different heads or versions of matrix E may be for a set of generic head types and/or sizes and/or shapes. 
         [0033]    In embodiments a value of an element E(i, j) of the matrix E is defined by an integral, over a region including the current distribution, of a gradient of a jth basis function and a function w s (r, τ), where w s (r, τ) represents the geometry and conductivity of an outermost said region of said head at position r i , independent of said current distribution. Preferably radial basis functions are employed. 
         [0034]    The functions w(r, τ) for each internal region of the head are preferably determined by solving a set of partial differential equations for a set of functions w j (r, τ), one for each region j. In preferred embodiments the partial differential equation each said region except the innermost comprises Laplace&#39;s equation for the respective function w j  (r, τ), and the partial differential equation for the innermost said region comprises Poisson&#39;s equation for the innermost region function w innermost (r, τ). In preferred embodiments the solving is subject to a boundary condition that across each internal boundary a normal component of the electric field is continuous. 
         [0035]    In preferred embodiments E·λ represents 
         [0000]      ∫ Ω     c   (∇ 2 Ψ(τ)) v   s ( r ,τ) dV (τ)
 
         [0000]    where ψ is a scalar value representing an irrotational part of J, where v s (r, τ) is a function, dependent on w s (r, τ), representing the geometry and conductivity of the head independent of the current distribution, Ω c  denotes the region of the brain over which the current distribution is determined, r lies on the surface of the scalp on which EEG measurements are made, and T is a dummy variable. Then the data representing an image of said 3D current distribution may comprise or consist of data representing of ψ. Preferably then b comprises a vector representation of said measurements of electric potential, b(r i ) at positions r i . 
         [0036]    The invention also provides a non-transitory medium such as a disk or memory storing processor control code to implement the method. Again code (and/or data) to implement embodiments of the invention may comprise source, object or executable code in a conventional programming language (interpreted or compiled) such as C, or assembly code, or code for a hardware description language. As the skilled person will appreciate such code and/or data may be distributed between a plurality of coupled components in communication with one another. 
         [0037]    In a complementary aspect the invention provides a system for processing an EEG and/or MEG signal to generate data representing an image of a 3D current distribution, J, within the brain, the system comprising: an input to receive a plurality of electric and/or magnetic measurements b from the exterior of the head; and a processor coupled to said input, to an output, to working memory and to program memory storing processor control code, wherein the stored code comprises code to: determine a representation of a part of said 3D current distribution by determining an estimate of λ in b=E·λ, where λ comprises a vector of coefficients of basis functions in an expansion of a scalar value, ψ, representing said part of said 3D current distribution, wherein b comprises a vector representing said measurements, and E is a matrix with elements E(i, j) which represent the geometry and conductivity of a head independent of said 3D current distribution; and output data defining a representation of said part of said 3D current distribution, to provide data representing an image of said 3D current distribution. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0038]    These and other aspects of the invention will now be further described, by way of example only, with reference to the accompanying figures in which: 
           [0039]      FIGS. 1 a  to 1 d    show, respectively, a flow diagram of a computer procedure for solving an inverse EEG problem according to an embodiment of the invention, a flow diagram of a computer procedure for solving an inverse MEG problem according to an embodiment of the invention, a flow diagram of a computer procedure for solving a set of partial differential equations to determine a matrix E and/or vectorial function H for use in numerically solving an inverse EEG/MEG problem according to embodiments of the invention, and a computer system programmed to implement the methods of  FIGS. 1 a    to  1   c;    
           [0040]      FIGS. 2 a  and 2 b    show a comparison of analytical solution and numerical solutions for u s  (r, τ) and for v s  (r, τ) respectively; 
           [0041]      FIG. 3  illustrates solutions of a boundary value problem for a multi-layer spherical geometry; 
           [0042]      FIG. 4  illustrates elements of a matrix ∇ τ H(r,τ) problem for a multi-layer spherical geometry; 
           [0043]      FIGS. 5 a  to 5 c    show, respectively, the cerebrum, Ω c , the skull, Ω b , and the head, Ω s  of a three layer realistic head model; 
           [0044]      FIG. 6  shows values of a synthetic function Ψ(τ) inside the cerebrum of the three layer head model of  FIG. 5 ; 
           [0045]      FIG. 7  shows exact and reconstructed functions Ψ(τ) for the three layer head model of  FIG. 5 ; 
           [0046]      FIG. 8  shows values of a synthetic function τA τ  (τ) inside the cerebrum of the three layer head model of  FIG. 5 ; and 
           [0047]      FIG. 9  shows exact and reconstructed functions τA τ  (τ) for the three layer head model of  FIG. 5 . 
       
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
     1. Framework 
       [0048]    In the following description we denote a domain and its conductivity by Ω⊂R 3  and σ respectively. Let the bounded domain Ω c  represent the cerebrum, which has conductivity σ c . A shell Ω ƒ with conductivity σ ƒ , representing the cerebrospinal fluid (CSF), surrounds the domain Ω c . The CSF is surrounded by the skull characterized by the domain Ω b  with conductivity σ b . Finally, the skull is surrounded by the scalp, which is modelled as a shell Ω s  with conductivity σ s . The domain exterior to the head is denoted by Ω e  which is not conductive. The permeability of all domains is equal to the permeability μ 0  of empty space. Let J P (τ), τεΩ c , denote the current which is supported within the cerebrum Ω c . For the above situation of arbitrary geometry and arbitrary current, it is shown in A S Fokas ( J.R. Soc. Interface,  6:479-488, 2009, ibid) that the irrotational part of the current, which is denoted by the scalar function Ψ(τ), contributes to both the electric potential on the scalp and to the magnetic field in Ω e , On the other hand, the solenoidal part of the current, which is denoted by the vectorial function A(τ), does not affect the electric potential and furthermore only the radial component of A(τ) affects the magnetic field in Ω e . 
         [0049]    Being more precise, an arbitrary vectorial function with support Ω c , can be expressed as 
         [0000]        J   P (τ)=∇Ψ(τ)+∇× A (τ),τεΩ c ,  (1)
 
         [0000]    where A(τ) satisfies the constraint ∇·A(τ)=0. This constraint implies that J P (τ) involves three arbitrary scalar functions, namely the scalar function Ψ(τ) and the two independent scalar functions characterizing A(τ). 
         [0050]    It is shown in A S Fokas ( J.R. Soc. Interface,  6:479-488, 2009, ibid) that the electric potential on the scalp is given by the expression 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         u 
                         s 
                       
                        
                       
                         ( 
                         r 
                         ) 
                       
                     
                     = 
                     
                       
                         - 
                         
                           1 
                           
                             4 
                              
                             π 
                           
                         
                       
                        
                       
                         
                           ∫ 
                           
                             Ω 
                             c 
                           
                         
                          
                         
                           
                             ( 
                             
                               
                                 ∇ 
                                 2 
                               
                                
                               
                                 Ψ 
                                  
                                 
                                   ( 
                                   τ 
                                   ) 
                                 
                               
                             
                             ) 
                           
                            
                           
                             
                               v 
                               s 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                            
                           
                              
                             
                               V 
                                
                               
                                 ( 
                                 τ 
                                 ) 
                               
                             
                           
                         
                       
                     
                   
                   , 
                   
                       
                   
                    
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         s 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where ∂Ω s  denotes the surface of the scalp, i.e the smooth boundary of the domain Ω s . Here, v s (r,τ) denotes a harmonic function which is independent of the current; it depends only on the geometry and on the conductivities. It is clear from equation (2) that the electric potential u s (r) depends only on the Laplacian of the irrotational part (Ψ(τ)) of the current. It was also shown in A S Fokas ( J.R. Soc. Interface,  6:479-488, 2009, ibid) that the measured magnetic field in Ω e  is given by the expression 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         
                           4 
                            
                           π 
                         
                         μ 
                       
                        
                       
                         
                           B 
                            
                           
                             ( 
                             r 
                             ) 
                           
                         
                         · 
                         r 
                       
                     
                     = 
                     
                       
                         
                           - 
                           
                             
                               ∫ 
                               
                                 Ω 
                                 c 
                               
                             
                              
                             
                               
                                 
                                   ∇ 
                                   2 
                                 
                                  
                                 
                                   ( 
                                   
                                     τ 
                                     · 
                                     
                                       A 
                                        
                                       
                                         ( 
                                         τ 
                                         ) 
                                       
                                     
                                   
                                   ) 
                                 
                               
                                
                               
                                 
                                    
                                   
                                     V 
                                      
                                     
                                       ( 
                                       τ 
                                       ) 
                                     
                                   
                                 
                                 
                                    
                                   
                                     r 
                                     - 
                                     τ 
                                   
                                    
                                 
                               
                             
                           
                         
                         + 
                         
                           
                             1 
                             
                               4 
                                
                               π 
                             
                           
                            
                           
                             
                               ∫ 
                               
                                 Ω 
                                 c 
                               
                             
                              
                             
                               
                                 ( 
                                 
                                   
                                     ∇ 
                                     2 
                                   
                                    
                                   
                                     Ψ 
                                      
                                     
                                       ( 
                                       τ 
                                       ) 
                                     
                                   
                                 
                                 ) 
                               
                                
                               
                                 r 
                                 · 
                                 
                                   H 
                                    
                                   
                                     ( 
                                     
                                       r 
                                       , 
                                       τ 
                                     
                                     ) 
                                   
                                 
                               
                                
                               
                                  
                                 
                                   V 
                                    
                                   
                                     ( 
                                     τ 
                                     ) 
                                   
                                 
                               
                                
                               
                                   
                               
                                
                               r 
                             
                           
                         
                       
                       ∈ 
                       
                         Ω 
                         e 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where H(r,τ) depends only on the geometry and on the conductivities; it is independent of the current. It is clear from equation (3) that in MEG the radial component of the magnetic field is affected by Ψ(τ) as well as by the radial component τ·A(τ) of the solenoidal part of the current. 
         [0051]    We can use Green&#39;s first identity to rewrite equations (2) and (3) in the form 
         [0000]    
       
         
           
             
               
                 
                   
                       
                   
                    
                   
                     
                       
                         
                           
                             u 
                             s 
                           
                            
                           
                             ( 
                             r 
                             ) 
                           
                         
                         = 
                         
                           
                             1 
                             
                               4 
                                
                               π 
                             
                           
                            
                           
                             
                               ∫ 
                               
                                 Ω 
                                 c 
                               
                             
                              
                             
                               
                                 
                                   ∇ 
                                   
                                     Ψ 
                                      
                                     
                                       ( 
                                       τ 
                                       ) 
                                     
                                   
                                 
                                 · 
                                 
                                   
                                     ∇ 
                                     τ 
                                   
                                    
                                   
                                     
                                       v 
                                       s 
                                     
                                      
                                     
                                       ( 
                                       
                                         r 
                                         , 
                                         τ 
                                       
                                       ) 
                                     
                                   
                                 
                               
                                
                               
                                  
                                 
                                   V 
                                    
                                   
                                     ( 
                                     τ 
                                     ) 
                                   
                                 
                               
                             
                           
                         
                       
                       , 
                       
                           
                       
                        
                       
                         r 
                         ∈ 
                         
                           ∂ 
                           
                             Ω 
                             s 
                           
                         
                       
                     
                      
                     
                       
 
                     
                      
                     
                         
                     
                      
                     and 
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           4 
                            
                           π 
                         
                         μ 
                       
                        
                       
                         
                           B 
                            
                           
                             ( 
                             r 
                             ) 
                           
                         
                         · 
                         r 
                       
                     
                     = 
                     
                       
                         - 
                         
                           
                             ∫ 
                             
                               Ω 
                               c 
                             
                           
                            
                           
                             
                               
                                 ∇ 
                                 2 
                               
                                
                               
                                 ( 
                                 
                                   τ 
                                   · 
                                   
                                     A 
                                      
                                     
                                       ( 
                                       τ 
                                       ) 
                                     
                                   
                                 
                                 ) 
                               
                             
                              
                             
                               
                                  
                                 
                                   V 
                                    
                                   
                                     ( 
                                     τ 
                                     ) 
                                   
                                 
                               
                               
                                  
                                 
                                   r 
                                   - 
                                   τ 
                                 
                                  
                               
                             
                           
                         
                       
                       - 
                       
                         
                           1 
                           
                             4 
                              
                             π 
                           
                         
                          
                         
                           
                             ∑ 
                             
                               l 
                               ∈ 
                               
                                 { 
                                 
                                   1 
                                   , 
                                   2 
                                   , 
                                   3 
                                 
                                 } 
                               
                             
                           
                            
                           
                             
                               ∫ 
                               
                                 Ω 
                                 c 
                               
                             
                              
                             
                               
                                 
                                   r 
                                   l 
                                 
                                  
                                 
                                   [ 
                                   
                                     
                                       ∇ 
                                       
                                         Ψ 
                                          
                                         
                                           ( 
                                           τ 
                                           ) 
                                         
                                       
                                     
                                     · 
                                     
                                       
                                         ∇ 
                                         τ 
                                       
                                        
                                       
                                         
                                           H 
                                           l 
                                         
                                          
                                         
                                           ( 
                                           
                                             r 
                                             , 
                                             τ 
                                           
                                           ) 
                                         
                                       
                                     
                                   
                                   ] 
                                 
                               
                                
                               
                                  
                                 
                                   V 
                                    
                                   
                                     ( 
                                     τ 
                                     ) 
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                   , 
                   
                       
                   
                    
                   
                     r 
                     ∈ 
                     
                       
                         Ω 
                         e 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
           
         
       
     
         [0052]    Equations (4) and (5) follow from equations (2) and (3) by employing the following identities 
         [0000]      ∫ Ω     c     [H   i ( r ,τ)∇ τ   2 Ψ(τ)+∇ τ   H   i ( r ,τ)·∇ τ Ψ(τ)] dV (τ)=         [∇ τ Ψ(τ)· {circumflex over (n)}]H   i ( r ,τ) dS (τ) iε{ 1,2,3},
 
         [0000]                  H   i ( r ,τ)[∇ τ Ψ(τ)· {circumflex over (n)}]dS (τ)=0, iε{ 1,2,3},
 
         [0000]                  v   s ( r ,τ)[∇ τ Ψ(τ)· {circumflex over (n)},]dS (τ)=0,  (6)
 
         [0053]    where {H 1 , H 2 , H 3 } denote the Cartesian coordinates of H(r,τ). 
         [0054]    We here present a general framework for obtaining the maximum possible information for the current, or more precisely for the part of the current that affects EEG and MEG, namely 
         [0000]      ∇Ψ(τ) and ∇ 2   [τ·A (τ)],τεΩ c ,  (7)
 
         [0000]    from the knowledge of the quantities measured in EEG and in MEG, namely the functions 
         [0000]        u   s ( r ) rε∂Ω   s , and  r·B ( r ) r εΩ   e ,  (8)
 
         [0000]    respectively. This framework is based on (a) equations (4) and (5), and (b) on the existence of fast and accurate codes for the numerical computation of the auxiliary functions v s (r,τ) and H(r,τ). Furthermore, we implement this general approach to a realistic three shell geometry. 
       2. Construction of v s (r,τ), and H(r,τ) 
       [0055]    In order to analyse the basic equations (4) and (5) we first construct the functions 
         [0000]        v   s ( r ,τ) r ε∂Ω   s ,τεΩ c , and  H ( r ,τ) rεΩ   e ,τεΩ c .  (9)
 
         [0056]    The function v s (r,τ) is a harmonic function which is obtained via the solution of the following system of equations: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           v 
                           c 
                         
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         
                           ∂ 
                           
                               
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                        
                       
                         [ 
                         
                           
                             1 
                             
                                
                               
                                 r 
                                 - 
                                 τ 
                               
                                
                             
                           
                           + 
                           
                             
                               v 
                               c 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                     
                     = 
                     
                       
                         σ 
                         f 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               f 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     
                       r 
                       ∈ 
                       
                         ∂ 
                         
                           Ω 
                           c 
                         
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   10 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           v 
                           f 
                         
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       f 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         v 
                         f 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         1 
                         
                           σ 
                           c 
                         
                       
                        
                       
                         [ 
                         
                           
                             1 
                             
                                
                               
                                 r 
                                 - 
                                 τ 
                               
                                
                             
                           
                           + 
                           
                             
                               v 
                               c 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         ] 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         c 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         σ 
                         f 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               f 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                     = 
                     
                       
                         σ 
                         b 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               b 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         f 
                       
                     
                   
                   , 
                   
                     
                       τ 
                       ∈ 
                       
                         Ω 
                         c 
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   11 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           v 
                           b 
                         
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       b 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         v 
                         b 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         v 
                         f 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         f 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         σ 
                         b 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               b 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                     = 
                     
                       
                         σ 
                         s 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               v 
                               s 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         b 
                       
                     
                   
                   , 
                   
                     
                       τ 
                       ∈ 
                       
                         Ω 
                         c 
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   12 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           v 
                           s 
                         
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       s 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         v 
                         s 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         v 
                         b 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         b 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         ∂ 
                         
                           
                             v 
                             s 
                           
                            
                           
                             ( 
                             
                               r 
                               , 
                               τ 
                             
                             ) 
                           
                         
                       
                       
                         ∂ 
                         n 
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       
                         ∂ 
                         
                           Ω 
                           s 
                         
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   13 
                   ) 
                 
               
             
           
         
       
     
         [0057]    In the above equations, ∂Ω c , ∂Ω b , ∂Ω ƒ and ∂Ω s  denote the smooth boundaries of the domains Ω c , Ω b , Ω ƒ and Ω s , respectively. 
         [0058]    As stated earlier, equations (10)-(13) are independent of the current J P (τ) and depend only on the geometry and on the conductivities σ c , σ b , σ ƒ and σ s . However, it turns out that it is convenient to construct the functions v(r,τ) via first constructing certain functions u j (r,τ) which are defined in terms of a monopole source. Here the functions u j  (r, τ) represent the geometry-conductivity functions denoted w(r, τ) in the summary of the invention section and the claims (here jε{c, ƒ, b, s} denoting the cerebrum, cerebrospinal fluid, bone and scalp respectively). The function u s  (r,τ) should not be confused with the EEG measurements as a function of position, u s  (r i ). 
         [0059]    The boundary condition of equation (10) makes the set of partial differential equations extremely difficult to solve. However in the functions below this boundary condition has been simplified by changing, and although this means that the partial differential equation for the cerebrum no longer has a Laplacian form, overall the problem becomes tractable: Let the functions 
         [0000]        u   j ( r ,τ), rεΩ   j ,τεΩ c   ,jε{c,ƒ,b,s},   (14)
 
         [0000]    satisfy the following equations: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         σ 
                         c 
                       
                        
                       
                         
                           ∇ 
                           2 
                         
                          
                         
                           
                             u 
                             c 
                           
                            
                           
                             ( 
                             r 
                             ) 
                           
                         
                       
                     
                     = 
                     
                       
                         ∇ 
                         
                           · 
                           Q 
                         
                       
                        
                       
                           
                       
                        
                       
                         δ 
                          
                         
                           ( 
                           
                             r 
                             - 
                             τ 
                           
                           ) 
                         
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       c 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         σ 
                         c 
                       
                        
                       
                         
                           ∂ 
                           
                             u 
                             c 
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                     = 
                     
                       
                         σ 
                         f 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               u 
                               f 
                             
                              
                             
                               ( 
                               r 
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     
                       r 
                       ∈ 
                       
                         ∂ 
                         
                           Ω 
                           c 
                         
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   15 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           u 
                           f 
                         
                          
                         
                           ( 
                           r 
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       f 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         u 
                         f 
                       
                        
                       
                         ( 
                         r 
                         ) 
                       
                     
                     = 
                     
                       
                         u 
                         c 
                       
                        
                       
                         ( 
                         r 
                         ) 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         c 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         σ 
                         f 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               u 
                               f 
                             
                              
                             
                               ( 
                               r 
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                     = 
                     
                       
                         σ 
                         b 
                       
                        
                       
                         
                           ∂ 
                           
                             u 
                             b 
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     
                       r 
                       ∈ 
                       
                         ∂ 
                         
                           Ω 
                           f 
                         
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   16 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           u 
                           b 
                         
                          
                         
                           ( 
                           r 
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       b 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         u 
                         b 
                       
                        
                       
                         ( 
                         r 
                         ) 
                       
                     
                     = 
                     
                       
                         u 
                         f 
                       
                        
                       
                         ( 
                         r 
                         ) 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         f 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         σ 
                         b 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               u 
                               b 
                             
                              
                             
                               ( 
                               r 
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                     = 
                     
                       
                         σ 
                         s 
                       
                        
                       
                         
                           ∂ 
                           
                             
                               u 
                               b 
                             
                              
                             
                               ( 
                               r 
                               ) 
                             
                           
                         
                         
                           ∂ 
                           n 
                         
                       
                     
                   
                   , 
                   
                     
                       r 
                       ∈ 
                       
                         ∂ 
                         
                           Ω 
                           b 
                         
                       
                     
                     ; 
                   
                 
               
               
                 
                   ( 
                   17 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         ∇ 
                         2 
                       
                        
                       
                         
                           u 
                           s 
                         
                          
                         
                           ( 
                           r 
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       s 
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         u 
                         s 
                       
                        
                       
                         ( 
                         r 
                         ) 
                       
                     
                     = 
                     
                       
                         u 
                         b 
                       
                        
                       
                         ( 
                         r 
                         ) 
                       
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       ∂ 
                       
                         Ω 
                         b 
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       
                         ∂ 
                         
                           
                             u 
                             s 
                           
                            
                           
                             ( 
                             r 
                             ) 
                           
                         
                       
                       
                         ∂ 
                         n 
                       
                     
                     = 
                     0 
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       
                         ∂ 
                         
                           Ω 
                           s 
                         
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   18 
                   ) 
                 
               
             
           
         
       
     
         [0060]    Then u j  and v j  are related by the equation 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         u 
                         j 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         1 
                         
                           4 
                            
                           π 
                         
                       
                        
                       
                         
                           Q 
                            
                           
                             ( 
                             τ 
                             ) 
                           
                         
                         · 
                         
                           
                             ∇ 
                             τ 
                           
                            
                           
                             
                               v 
                               j 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     j 
                     ∈ 
                     
                       { 
                       
                         f 
                         , 
                         b 
                         , 
                         s 
                       
                       } 
                     
                   
                   , 
                   
                     r 
                     ∈ 
                     
                       Ω 
                       j 
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       
                         Ω 
                         c 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   19 
                   ) 
                 
               
             
           
         
       
     
         [0061]    Equation (19) above is consistent with the fact that the potential of a dipole is the directional derivative of the potential of a monopole. 
       2.1 Spherical Geometry 
       [0062]    The advantage of constructing the function v s (r,τ) via u s (r,τ) becomes clear by considering the particular case of spherical geometry. In this case, a closed form expression for v s (r,τ) can be derived, which involves the inversion of a 7×7 matrix. It was observed in Fokas et al.,  Inverse Problems,  28, 2012 (ibid) that this matrix is ill conditioned and requires regularization. On the hand, for the case of N spherical layers, with N arbitrary, a closed form expression for u s (r,τ) can be obtained. This approach is straightforward and does not require matrix inversion. Indeed, let r 1 &lt;r 2 &lt; . . . &lt;r N-1 &lt;r N , and let σ 1 , . . . ,σ N  denote the radii and the corresponding conductivities of the domains Ω 1 , . . . , Ω N . We consider a single dipole source characterized by (Q,τ). The position vector of the observation point is denoted by r. Let us introduce the following notations: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       τ 
                       ^ 
                     
                     = 
                     
                       τ 
                       
                          
                         τ 
                          
                       
                     
                   
                   , 
                   
                     
                       r 
                       ^ 
                     
                     = 
                     
                       r 
                       
                          
                         r 
                          
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   
                     
                       cos 
                        
                       
                         ( 
                         α 
                         ) 
                       
                     
                     = 
                     
                       
                         τ 
                         ^ 
                       
                       · 
                       
                         Q 
                         ^ 
                       
                     
                   
                   , 
                   
                     
                       cos 
                        
                       
                         ( 
                         γ 
                         ) 
                       
                     
                     = 
                     
                       
                         τ 
                         ^ 
                       
                       · 
                       
                         r 
                         ^ 
                       
                     
                   
                   , 
                   
                     
                       cos 
                        
                       
                         ( 
                         β 
                         ) 
                       
                     
                     = 
                     
                       
                         ( 
                         
                           
                             τ 
                             ^ 
                           
                           × 
                           
                             Q 
                             ^ 
                           
                         
                         ) 
                       
                       · 
                       
                         
                           ( 
                           
                             
                               τ 
                               ^ 
                             
                             × 
                             
                               r 
                               ^ 
                             
                           
                           ) 
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   20 
                   ) 
                 
               
             
           
         
       
     
         [0063]    The observed potential at r is given by the following expression: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         u 
                         s 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         
                            
                           Q 
                            
                         
                         
                           4 
                            
                           π 
                            
                           
                               
                           
                            
                           
                             σ 
                             N 
                           
                            
                           
                             r 
                             2 
                           
                         
                       
                        
                       
                         
                           ∑ 
                           
                             n 
                             = 
                             1 
                           
                           ∞ 
                         
                          
                         
                           
                             
                               
                                 ( 
                                 
                                   τ 
                                   r 
                                 
                                 ) 
                               
                               
                                 n 
                                 - 
                                 1 
                               
                             
                              
                             
                               [ 
                               
                                 
                                   
                                     2 
                                      
                                     n 
                                   
                                   + 
                                   1 
                                 
                                 
                                   
                                     nM 
                                     
                                       2 
                                       , 
                                       2 
                                     
                                   
                                   + 
                                   
                                     
                                       ( 
                                       
                                         1 
                                         + 
                                         n 
                                       
                                       ) 
                                     
                                      
                                     
                                       M 
                                       
                                         2 
                                         , 
                                         1 
                                       
                                     
                                   
                                 
                               
                               ] 
                             
                           
                           × 
                           
                             [ 
                             
                               
                                 n 
                                  
                                 
                                     
                                 
                                  
                                 
                                   cos 
                                    
                                   
                                     ( 
                                     α 
                                     ) 
                                   
                                 
                                  
                                 
                                   
                                     P 
                                     n 
                                   
                                    
                                   
                                     [ 
                                     
                                       cos 
                                        
                                       
                                         ( 
                                         γ 
                                         ) 
                                       
                                     
                                     ] 
                                   
                                 
                               
                               + 
                               
                                 
                                   cos 
                                    
                                   
                                     ( 
                                     β 
                                     ) 
                                   
                                 
                                  
                                 
                                   sin 
                                    
                                   
                                     ( 
                                     α 
                                     ) 
                                   
                                 
                                  
                                 
                                   
                                     P 
                                     n 
                                     1 
                                   
                                    
                                   
                                     [ 
                                     
                                       cos 
                                        
                                       
                                         ( 
                                         γ 
                                         ) 
                                       
                                     
                                     ] 
                                   
                                 
                               
                             
                             ] 
                           
                         
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   21 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where the 2×2 matrix M is given by 
         [0000]    
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             M 
                             
                               1 
                               , 
                               1 
                             
                           
                         
                         
                           
                             M 
                             
                               1 
                               , 
                               2 
                             
                           
                         
                       
                       
                         
                           
                             M 
                             
                               2 
                               , 
                               1 
                             
                           
                         
                         
                           
                             M 
                             
                               2 
                               , 
                               2 
                             
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         1 
                         
                           
                             ( 
                             
                               
                                 2 
                                  
                                 n 
                               
                               + 
                               1 
                             
                             ) 
                           
                           
                             N 
                             - 
                             1 
                           
                         
                       
                       ] 
                     
                      
                     
                       
                         ∏ 
                         
                           k 
                           = 
                           1 
                         
                         
                           N 
                           - 
                           1 
                         
                       
                        
                       
                           
                       
                        
                       
                         
                           [ 
                           
                             
                               
                                 
                                   n 
                                   + 
                                   
                                     
                                       ( 
                                       
                                         n 
                                         + 
                                         1 
                                       
                                       ) 
                                     
                                      
                                     
                                       
                                         σ 
                                         k 
                                       
                                       
                                         σ 
                                         
                                           k 
                                           + 
                                           10 
                                         
                                       
                                     
                                   
                                 
                               
                               
                                 
                                   
                                     ( 
                                     
                                       n 
                                       + 
                                       1 
                                     
                                     ) 
                                   
                                    
                                   
                                     ( 
                                     
                                       
                                         
                                           σ 
                                           k 
                                         
                                         
                                           σ 
                                           
                                             k 
                                             + 
                                             1 
                                           
                                         
                                       
                                       - 
                                       1 
                                     
                                     ) 
                                   
                                    
                                   
                                     
                                       ( 
                                       
                                         r 
                                         
                                           r 
                                           k 
                                         
                                       
                                       ) 
                                     
                                     
                                       
                                         2 
                                          
                                         n 
                                       
                                       + 
                                       1 
                                     
                                   
                                 
                               
                             
                             
                               
                                 
                                   
                                     n 
                                      
                                     
                                       ( 
                                       
                                         
                                           
                                             σ 
                                             k 
                                           
                                           
                                             σ 
                                             
                                               k 
                                               + 
                                               1 
                                             
                                           
                                         
                                         - 
                                         1 
                                       
                                       ) 
                                     
                                   
                                    
                                   
                                     
                                       ( 
                                       
                                         
                                           r 
                                           k 
                                         
                                         r 
                                       
                                       ) 
                                     
                                     
                                       
                                         2 
                                          
                                         n 
                                       
                                       + 
                                       1 
                                     
                                   
                                 
                               
                               
                                 
                                   n 
                                   + 
                                   1 
                                   + 
                                   
                                     
                                       n 
                                        
                                       
                                           
                                       
                                        
                                       
                                         σ 
                                         k 
                                       
                                     
                                     
                                       σ 
                                       
                                         k 
                                         + 
                                         1 
                                       
                                     
                                   
                                 
                               
                             
                           
                           ] 
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   22 
                   ) 
                 
               
             
           
         
       
     
         [0064]    Noting that v s (r,τ) can be expressed in the form below (A S Fokas,  J.R. Soc. Interface,  6:479-488, 2009, ibid) 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         v 
                         s 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         ∑ 
                         
                           n 
                           = 
                           1 
                         
                         ∞ 
                       
                        
                       
                         
                           H 
                           n 
                         
                          
                         
                           
                             
                               2 
                                
                               n 
                             
                             + 
                             1 
                           
                           
                             4 
                              
                             π 
                           
                         
                          
                         
                           
                             τ 
                             n 
                           
                           
                             r 
                             
                               n 
                               + 
                               1 
                             
                           
                         
                          
                         
                           
                             P 
                             n 
                           
                            
                           
                             ( 
                             
                               
                                 τ 
                                 ^ 
                               
                               · 
                               
                                 r 
                                 ^ 
                               
                             
                             ) 
                           
                         
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   23 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where the unknown coefficients H n  can be computed by inverting the 7×7 matrix mentioned earlier. By using equations (19) and (23) we bypass this inversion and can directly obtain v s (r,τ) in closed form: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       v 
                       s 
                     
                      
                     
                       ( 
                       
                         r 
                         , 
                         τ 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       ∑ 
                       
                         n 
                         = 
                         1 
                       
                       ∞ 
                     
                      
                     
                       
                         [ 
                         
                           
                             
                               2 
                                
                               n 
                             
                             + 
                             1 
                           
                           
                             
                               nM 
                               
                                 2 
                                 , 
                                 2 
                               
                             
                             + 
                             
                               
                                 ( 
                                 
                                   1 
                                   + 
                                   n 
                                 
                                 ) 
                               
                                
                               
                                 M 
                                 
                                   2 
                                   , 
                                   1 
                                 
                               
                             
                           
                         
                         ] 
                       
                        
                       
                         1 
                         
                           σ 
                           N 
                         
                       
                        
                       
                         
                           τ 
                           n 
                         
                         
                           r 
                           
                             n 
                             + 
                             1 
                           
                         
                       
                        
                       
                         
                           
                             P 
                             n 
                           
                            
                           
                             ( 
                             
                               
                                 τ 
                                 ^ 
                               
                               · 
                               
                                 r 
                                 ^ 
                               
                             
                             ) 
                           
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   24 
                   ) 
                 
               
             
           
         
       
     
       2.2 Arbitrary Geometry 
       [0065]    In the case of arbitrary geometry, there exists (open source) code suitable for the numerical solution of equations (15)-(18), for example Zeynep Akalm-Acar and Scott Makeig, “Neuroelectromagnetic forward head modeling toolbox”,  J Neurosci Methods,  190(2):258-270, 2010. The numerical construction of v s (r,τ) involves the following steps:
       1. Fix a source point τ:=[τ 1 , τ 2 , τ 3 ]εΩ c  and an observation point rε∂Ω s . Consider three dipoles positioned at the source τεΩ c , with the following orthogonal moments:       
 
         [0000]      2.  Q   1 =[1,0,0], Q   2 =[0,1,0], Q   3 =[0,0,1].  (25)
       3. For each of the above three dipoles, solve the boundary value problem described by equations (15)-(18). We denote the solution for the potential due to the dipole oriented in the direction Q i  by u s (r,τ;Q i ). We define the vector       
 
         [0000]      4.  u   s ( r ,τ):[ u   s ( r,τ;Q   1 ) u   s ( r,τ;Q   2 ) u   s ( r,τ;Q   3 )]  (26)
       5. We obtain the gradient of v s (r,τ) from equation       
 
         [0000]      ∇ τ   v   s ( r ,τ)=4π u   s ( r ,τ).  (27)
       6. Then, by using the gradient theorem, we can compute v s (r,τ) from the equation       
 
         [0000]        v   s ( r ,τ)− v   s ( r, 0)=∫ [0,τ] ∇ τ   v   s ( r,l )· dl.   (28)
       7. We can approximate the solution of the above equation by the expression       
 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         v 
                         s 
                       
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                     ≈ 
                     
                       4 
                        
                       π 
                        
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             1 
                           
                           N 
                         
                          
                         
                           
                             l 
                             i 
                           
                            
                           
                             
                               u 
                                
                               
                                 ( 
                                 
                                   r 
                                   , 
                                   
                                     τ 
                                     i 
                                   
                                 
                                 ) 
                               
                             
                             · 
                             
                               τ 
                               ^ 
                             
                           
                         
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   29 
                   ) 
                 
               
             
           
         
       
       
         
           
             8. where τ=(l 1 + . . . +l N ){circumflex over (τ)}. 
             9. We repeat the above steps ∀τ≡Ω c ,rε∂Ω s . It should be noted that for a given dipole characterized by (Q,τ), most existing numerical solvers provide the solution for all discrete points rε∂Ω s  in a single run. 
           
         
       
     
       2.3 Construction of H(r,τ) 
       [0073]    The vectorial function H(r,τ) is uniquely defined in terms of the scalar functions v j (r,τ): 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       H 
                        
                       
                         ( 
                         
                           r 
                           ; 
                           τ 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         
                           
                             ∫ 
                             
                               ∂ 
                               
                                 Ω 
                                 c 
                               
                             
                           
                            
                           
                             
                               
                                 [ 
                                 
                                   
                                     1 
                                     
                                        
                                       
                                         
                                           r 
                                           ′ 
                                         
                                         - 
                                         τ 
                                       
                                        
                                     
                                   
                                   + 
                                   
                                     
                                       v 
                                       c 
                                     
                                      
                                     
                                       ( 
                                       
                                         
                                           r 
                                           ′ 
                                         
                                         , 
                                         τ 
                                       
                                       ) 
                                     
                                   
                                   - 
                                   
                                     
                                       σ 
                                       f 
                                     
                                      
                                     
                                       
                                         v 
                                         f 
                                       
                                        
                                       
                                         ( 
                                         
                                           
                                             r 
                                             ′ 
                                           
                                           , 
                                           τ 
                                         
                                         ) 
                                       
                                     
                                   
                                 
                                 ] 
                               
                                
                               
                                 [ 
                                 
                                   
                                     
                                       n 
                                       ^ 
                                     
                                      
                                     
                                       ( 
                                       
                                         r 
                                         ′ 
                                       
                                       ) 
                                     
                                   
                                   × 
                                   
                                     
                                       ∇ 
                                       
                                         r 
                                         ′ 
                                       
                                     
                                      
                                     
                                       1 
                                       
                                          
                                         
                                           r 
                                           - 
                                           
                                             r 
                                             ′ 
                                           
                                         
                                          
                                       
                                     
                                   
                                 
                                 ] 
                               
                             
                              
                             
                                
                               
                                 S 
                                  
                                 
                                   ( 
                                   
                                     r 
                                     ′ 
                                   
                                   ) 
                                 
                               
                             
                           
                         
                         + 
                         
                           
                             ∫ 
                             
                               ∂ 
                               
                                 Ω 
                                 f 
                               
                             
                           
                            
                           
                             
                               
                                 ( 
                                 
                                   
                                     
                                       σ 
                                       f 
                                     
                                      
                                     
                                       
                                         v 
                                         f 
                                       
                                        
                                       
                                         ( 
                                         
                                           
                                             r 
                                             ′ 
                                           
                                           , 
                                           τ 
                                         
                                         ) 
                                       
                                     
                                   
                                   - 
                                   
                                     
                                       σ 
                                       b 
                                     
                                      
                                     
                                       
                                         v 
                                         b 
                                       
                                        
                                       
                                         ( 
                                         
                                           
                                             r 
                                             ′ 
                                           
                                           , 
                                           τ 
                                         
                                         ) 
                                       
                                     
                                   
                                 
                                 ) 
                               
                                
                               
                                 [ 
                                 
                                   
                                     
                                       n 
                                       ^ 
                                     
                                      
                                     
                                       ( 
                                       
                                         r 
                                         ′ 
                                       
                                       ) 
                                     
                                   
                                   × 
                                   
                                     
                                       ∇ 
                                       
                                         r 
                                         ′ 
                                       
                                     
                                      
                                     
                                       1 
                                       
                                          
                                         
                                           r 
                                           - 
                                           
                                             r 
                                             ′ 
                                           
                                         
                                          
                                       
                                     
                                   
                                 
                                 ] 
                               
                             
                              
                             
                                
                               
                                 S 
                                  
                                 
                                   ( 
                                   
                                     r 
                                     ′ 
                                   
                                   ) 
                                 
                               
                             
                           
                         
                         + 
                         
                           
                             ∫ 
                             
                               ∂ 
                               
                                 Ω 
                                 b 
                               
                             
                           
                            
                           
                             
                               
                                 ( 
                                 
                                   
                                     
                                       σ 
                                       b 
                                     
                                      
                                     
                                       
                                         v 
                                         b 
                                       
                                        
                                       
                                         ( 
                                         
                                           
                                             r 
                                             ′ 
                                           
                                           , 
                                           τ 
                                         
                                         ) 
                                       
                                     
                                   
                                   - 
                                   
                                     
                                       σ 
                                       s 
                                     
                                      
                                     
                                       
                                         v 
                                         s 
                                       
                                        
                                       
                                         ( 
                                         
                                           
                                             r 
                                             ′ 
                                           
                                           , 
                                           τ 
                                         
                                         ) 
                                       
                                     
                                   
                                 
                                 ) 
                               
                                
                               
                                 [ 
                                 
                                   
                                     
                                       n 
                                       ^ 
                                     
                                      
                                     
                                       ( 
                                       
                                         r 
                                         ′ 
                                       
                                       ) 
                                     
                                   
                                   × 
                                   
                                     
                                       ∇ 
                                       
                                         r 
                                         ′ 
                                       
                                     
                                      
                                     
                                       1 
                                       
                                          
                                         
                                           r 
                                           - 
                                           
                                             r 
                                             ′ 
                                           
                                         
                                          
                                       
                                     
                                   
                                 
                                 ] 
                               
                             
                              
                             
                                
                               
                                 S 
                                  
                                 
                                   ( 
                                   
                                     r 
                                     ′ 
                                   
                                   ) 
                                 
                               
                             
                           
                         
                         + 
                         
                           
                             σ 
                             s 
                           
                            
                           
                             
                               ∫ 
                               
                                 ∂ 
                                 
                                   Ω 
                                   s 
                                 
                               
                             
                              
                             
                               
                                 
                                   
                                     v 
                                     s 
                                   
                                    
                                   
                                     ( 
                                     
                                       
                                         r 
                                         ′ 
                                       
                                       , 
                                       τ 
                                     
                                     ) 
                                   
                                 
                                  
                                 
                                   [ 
                                   
                                     
                                       
                                         n 
                                         ^ 
                                       
                                        
                                       
                                         ( 
                                         
                                           r 
                                           ′ 
                                         
                                         ) 
                                       
                                     
                                     × 
                                     
                                       
                                         ∇ 
                                         
                                           r 
                                           ′ 
                                         
                                       
                                        
                                       
                                         1 
                                         
                                            
                                           
                                             r 
                                             - 
                                             
                                               r 
                                               ′ 
                                             
                                           
                                            
                                         
                                       
                                     
                                   
                                   ] 
                                 
                               
                                
                               
                                  
                                 
                                   S 
                                    
                                   
                                     ( 
                                     
                                       r 
                                       ′ 
                                     
                                     ) 
                                   
                                 
                               
                                
                               
                                   
                               
                                
                               r 
                             
                           
                         
                       
                       ∈ 
                       
                         Ω 
                         e 
                       
                     
                   
                   , 
                   
                     τ 
                     ∈ 
                     
                       
                         Ω 
                         c 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   30 
                   ) 
                 
               
             
           
         
       
     
       2.3.1 Construction of ∇ τ H(r,τ) in Spherical Geometry 
       [0074]    In the particular case of the multi-layer spherical geometry, an analytical expression for the magnetic field due to a dipole characterized by (Q,τ) is as follows: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       B 
                        
                       
                         ( 
                         
                           r 
                           , 
                           
                             τ 
                             ; 
                             Q 
                           
                         
                         ) 
                       
                     
                     = 
                     
                       
                         
                           μ 
                           0 
                         
                         
                           4 
                            
                           π 
                            
                           
                               
                           
                            
                           
                             
                               F 
                               2 
                             
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 τ 
                               
                               ) 
                             
                           
                         
                       
                        
                       
                         ( 
                         
                           
                             
                               F 
                                
                               
                                 ( 
                                 
                                   r 
                                   , 
                                   τ 
                                 
                                 ) 
                               
                             
                              
                             Q 
                             × 
                             τ 
                           
                           - 
                           
                             
                               ( 
                               
                                 Q 
                                 × 
                                 τ 
                               
                               ) 
                             
                             · 
                             
                               [ 
                               
                                 r 
                                  
                                 
                                   
                                     ∇ 
                                     r 
                                   
                                    
                                   
                                     F 
                                      
                                     
                                       ( 
                                       
                                         r 
                                         , 
                                         τ 
                                       
                                       ) 
                                     
                                   
                                 
                               
                               ] 
                             
                           
                         
                         ) 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   31 
                   ) 
                 
               
             
           
         
       
     
         [0075]    where F(r,τ) and ∇ r F(r,τ) are given by 
         [0000]    
       
         
           
             
               
                 
                   
                       
                   
                    
                   
                     
                       
                         F 
                          
                         
                           ( 
                           
                             r 
                             , 
                             τ 
                           
                           ) 
                         
                       
                       = 
                       
                         d 
                          
                         
                           ( 
                           
                             
                               r 
                                
                               
                                   
                               
                                
                               d 
                             
                             + 
                             
                               r 
                               2 
                             
                             - 
                             
                               ( 
                               
                                 τ 
                                 · 
                                 r 
                               
                               ) 
                             
                           
                           ) 
                         
                       
                     
                     , 
                     
                       
 
                     
                      
                     
                       
                         
                           ∇ 
                           r 
                         
                          
                         
                           F 
                            
                           
                             ( 
                             
                               r 
                               , 
                               τ 
                             
                             ) 
                           
                         
                       
                       = 
                       
                         
                           
                             ( 
                             
                               
                                 
                                   d 
                                   2 
                                 
                                 r 
                               
                               + 
                               
                                 
                                   
                                     ( 
                                     
                                       r 
                                       - 
                                       τ 
                                     
                                     ) 
                                   
                                   · 
                                   r 
                                 
                                 d 
                               
                               + 
                               
                                 2 
                                  
                                 d 
                               
                               + 
                               
                                 2 
                                  
                                 r 
                               
                             
                             ) 
                           
                            
                           r 
                         
                         - 
                         
                           
                             ( 
                             
                               d 
                               + 
                               
                                 2 
                                  
                                 r 
                               
                               + 
                               
                                 
                                   
                                     ( 
                                     
                                       r 
                                       - 
                                       τ 
                                     
                                     ) 
                                   
                                   · 
                                   r 
                                 
                                 d 
                               
                             
                             ) 
                           
                            
                           τ 
                         
                       
                     
                     , 
                     
                       
 
                     
                      
                     
                         
                     
                      
                     
                       d 
                       := 
                       
                          
                         
                           r 
                           - 
                           τ 
                         
                          
                       
                     
                     , 
                     
                       r 
                       = 
                       
                         
                            
                           r 
                            
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   32 
                   ) 
                 
               
             
           
         
       
     
         [0076]    For arbitrary geometry, an expression for the magnetic field due to a dipole characterized by (Q(τ),τ) was derived in A S Fokas  J.R. Soc. Interface,  6:479-488, 2009, ibid: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         
                           4 
                            
                           π 
                         
                         µ 
                       
                        
                       
                         B 
                          
                         
                           ( 
                           
                             r 
                             , 
                             
                               τ 
                               ; 
                               Q 
                             
                           
                           ) 
                         
                       
                     
                     = 
                     
                       
                         
                           Q 
                            
                           
                             ( 
                             τ 
                             ) 
                           
                         
                         × 
                         
                           
                             ∇ 
                             r 
                           
                            
                           
                             1 
                             
                                
                               
                                 r 
                                 - 
                                 τ 
                               
                                
                             
                           
                         
                       
                       - 
                       
                         
                           1 
                           
                             4 
                              
                             π 
                           
                         
                          
                         
                           
                             Q 
                              
                             
                               ( 
                               τ 
                               ) 
                             
                           
                           · 
                           
                             
                               ∇ 
                               τ 
                             
                              
                             
                               H 
                                
                               
                                 ( 
                                 
                                   r 
                                   , 
                                   τ 
                                 
                                 ) 
                               
                             
                           
                         
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   33 
                   ) 
                 
               
             
           
         
       
     
         [0077]    where H(r,τ) is the vectorial function defined in equation (30). The gradient ∇ τ H(r,τ) is the following 3×3 matrix: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ∇ 
                       τ 
                     
                      
                     
                       H 
                        
                       
                         ( 
                         
                           r 
                           , 
                           τ 
                         
                         ) 
                       
                     
                   
                   = 
                   
                     
                       ( 
                       
                         
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   1 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   1 
                                 
                               
                             
                           
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   2 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   1 
                                 
                               
                             
                           
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   3 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   1 
                                 
                               
                             
                           
                         
                         
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   1 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   2 
                                 
                               
                             
                           
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   2 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   2 
                                 
                               
                             
                           
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   3 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   2 
                                 
                               
                             
                           
                         
                         
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   1 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   3 
                                 
                               
                             
                           
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   2 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   3 
                                 
                               
                             
                           
                           
                             
                               
                                 ∂ 
                                 
                                   H 
                                   3 
                                 
                               
                               
                                 ∂ 
                                 
                                   τ 
                                   3 
                                 
                               
                             
                           
                         
                       
                       ) 
                     
                     . 
                   
                 
               
               
                 
                   ( 
                   34 
                   ) 
                 
               
             
           
         
       
     
         [0078]    Using equations (31) and (33), it is straightforward to show that 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         ∂ 
                         
                           H 
                           j 
                         
                       
                       
                         ∂ 
                         
                           τ 
                           i 
                         
                       
                     
                     = 
                     
                       
                         4 
                          
                         
                           
                             π 
                              
                             
                               [ 
                               
                                 
                                   Q 
                                   i 
                                 
                                 × 
                                 
                                   
                                     ∇ 
                                     τ 
                                   
                                    
                                   
                                     1 
                                     
                                        
                                       
                                         r 
                                         - 
                                         τ 
                                       
                                        
                                     
                                   
                                 
                               
                               ] 
                             
                           
                           · 
                           
                             Q 
                             j 
                           
                         
                       
                       - 
                       
                         
                           
                             
                               ( 
                               
                                 4 
                                  
                                 π 
                               
                               ) 
                             
                             2 
                           
                           μ 
                         
                          
                         
                           
                             B 
                              
                             
                               ( 
                               
                                 r 
                                 , 
                                 
                                   τ 
                                   ; 
                                   
                                     Q 
                                     i 
                                   
                                 
                               
                               ) 
                             
                           
                           · 
                           
                             Q 
                             j 
                           
                         
                       
                     
                   
                   , 
                   
                     
 
                   
                    
                   i 
                   , 
                   
                     j 
                     ∈ 
                     
                       
                         { 
                         
                           1 
                           , 
                           2 
                           , 
                           3 
                         
                         } 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   35 
                   ) 
                 
               
             
           
         
       
     
       2.3.2 Numerical Construction of H(r,τ) 
       [0079]    There exists several numerical solvers for computing the magnetic field problem due to a dipole or a collection of dipoles, for example Zeynep Akalm-Scott et al., ibid. In what follows, we outline a strategy to compute H(τ,r) using an existing solver. We denote by B(r,τ;Q) the solution of the magnetic field due to a dipole characterized by (τ,Q).
       1. Fix a source point τ:=[τ 1 , τ 2 , τ 3 ]εΩ c  and an observation point rεΩ e . Consider three dipoles positioned at the source τεΩ c  with the following orthogonal moments:       
 
         [0000]      2.  Q   1 =[1,0,0], Q   2 =[0,1,0], Q   3 =[0,0,1].  (36)
       3. For each of the above three dipoles, solve the magnetic field problem. We denote by B(r,τ;Q i ) the solution of the magnetic field associated with the dipole oriented in the direction Q i .   4. We can now compute the elements of the matrix ∇ τ H(τ,r) using the expression (16).   5. Repeat the above steps for ∀τΣΩ c , and for all sensors positions r i  εΩ e , where i denotes the ith sensor. The existing numerical solvers (ibid) compute the magnetic field at all sensors positions in a single run.   6. The gradient theorem,       
 
         [0000]        H   j (τ, r )− H   j (0, r )=∫ [0,τ]   ∇H   j ( l,r )· dl jε{ 1,2,3},  (37)
       7. can be employed to compute the components of the vectorial function H(r,τ).       
 
       2.4 Radial Basis Functions 
       [0086]    Consider the Beppo-Levi space of distributions with square integrable second derivatives. This space is equipped with a rotation invariant semi norm: If sεBL (2) (R 3 ) then this norm is defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     
                        
                       s 
                        
                     
                     2 
                   
                   = 
                   
                     
                       
                         ∫ 
                         
                           R 
                           3 
                         
                       
                        
                       
                         
                           [ 
                           
                             
                               
                                 ( 
                                 
                                   
                                     
                                       ∂ 
                                       2 
                                     
                                      
                                     
                                       s 
                                        
                                       
                                         ( 
                                         x 
                                         ) 
                                       
                                     
                                   
                                   
                                     ∂ 
                                     
                                       x 
                                       2 
                                     
                                   
                                 
                                 ) 
                               
                               2 
                             
                             + 
                             
                               
                                 ( 
                                 
                                   
                                     
                                       ∂ 
                                       2 
                                     
                                      
                                     
                                       s 
                                        
                                       
                                         ( 
                                         x 
                                         ) 
                                       
                                     
                                   
                                   
                                     ∂ 
                                     
                                       y 
                                       2 
                                     
                                   
                                 
                                 ) 
                               
                               2 
                             
                             + 
                             
                               
                                 ( 
                                 
                                   
                                     
                                       ∂ 
                                       2 
                                     
                                      
                                     
                                       s 
                                        
                                       
                                         ( 
                                         x 
                                         ) 
                                       
                                     
                                   
                                   
                                     ∂ 
                                     
                                       z 
                                       2 
                                     
                                   
                                 
                                 ) 
                               
                               2 
                             
                           
                           ] 
                         
                          
                         
                            
                           x 
                         
                          
                         
                            
                           y 
                         
                          
                         
                            
                           z 
                         
                       
                     
                     + 
                     
                       
                         ∫ 
                         
                           R 
                           3 
                         
                       
                        
                       
                         
                           [ 
                           
                             
                               2 
                                
                               
                                 
                                   ( 
                                   
                                     
                                       
                                         ∂ 
                                         2 
                                       
                                        
                                       
                                         s 
                                          
                                         
                                           ( 
                                           x 
                                           ) 
                                         
                                       
                                     
                                     
                                       
                                         ∂ 
                                         x 
                                       
                                        
                                       
                                         ∂ 
                                         y 
                                       
                                     
                                   
                                   ) 
                                 
                                 2 
                               
                             
                             + 
                             
                               2 
                                
                               
                                 
                                   ( 
                                   
                                     
                                       
                                         ∂ 
                                         2 
                                       
                                        
                                       
                                         s 
                                          
                                         
                                           ( 
                                           x 
                                           ) 
                                         
                                       
                                     
                                     
                                       
                                         ∂ 
                                         x 
                                       
                                        
                                       
                                         ∂ 
                                         z 
                                       
                                     
                                   
                                   ) 
                                 
                                 2 
                               
                             
                             + 
                             
                               2 
                                
                               
                                 
                                   ( 
                                   
                                     
                                       
                                         ∂ 
                                         2 
                                       
                                        
                                       
                                         s 
                                          
                                         
                                           ( 
                                           x 
                                           ) 
                                         
                                       
                                     
                                     
                                       
                                         ∂ 
                                         y 
                                       
                                        
                                       
                                         ∂ 
                                         z 
                                       
                                     
                                   
                                   ) 
                                 
                                 2 
                               
                             
                           
                           ] 
                         
                          
                         
                            
                           x 
                         
                          
                         
                            
                           y 
                         
                          
                         
                           
                              
                             z 
                           
                           . 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   38 
                   ) 
                 
               
             
           
         
       
     
         [0087]    Consider the following interpolation problem: Given a set of distinct nodes X={x i } i=1   N , and function values {ƒ i } i=1   N , we construct an interpolation function s(x) such that 
         [0000]        s ( x   i )=ƒ i   ,i= 1, . . . , N.   (39)
 
         [0088]    By employing radial basis functions (RBF), an interpolation function can be expressed in the form 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       s 
                        
                       
                         ( 
                         x 
                         ) 
                       
                     
                     = 
                     
                       
                         p 
                          
                         
                           ( 
                           x 
                           ) 
                         
                       
                       + 
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             1 
                           
                           N 
                         
                          
                         
                           
                             λ 
                             i 
                           
                            
                           
                             ϕ 
                              
                             
                               ( 
                               
                                  
                                 
                                   x 
                                   - 
                                   
                                     x 
                                     i 
                                   
                                 
                                  
                               
                               ) 
                             
                           
                         
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   40 
                   ) 
                 
               
             
           
         
       
     
         [0089]    where p(x) is the polynomial 
         [0000]        p ( x )= c   1   +c   2   x+c   3   y+c   4   z.   (41)
 
         [0090]    In this setting, {λ i :1≦i≦N} and {c 1 , . . . , c 4 }, are coefficients to be determined, whereas φ(r): R→[0,∞). Particular choices for the functions φ(r) include φ(r)=r, φ(r)=e −ar     2   , φ(r)=(r 2 +c 2 ) 1/2 , and φ(r)=r 2  log(r). The smoothest interpolant is given by 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       s 
                       * 
                     
                      
                     
                       ( 
                       x 
                       ) 
                     
                   
                   = 
                   
                     
                       p 
                        
                       
                         ( 
                         x 
                         ) 
                       
                     
                     + 
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           1 
                         
                         N 
                       
                        
                       
                         
                           λ 
                           i 
                         
                          
                         
                           
                              
                             
                               x 
                               - 
                               
                                 x 
                                 i 
                               
                             
                              
                           
                           . 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   42 
                   ) 
                 
               
             
           
         
       
     
         [0091]    In certain problems, the following constraint is also imposed 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ∑ 
                       
                         i 
                         = 
                         1 
                       
                       N 
                     
                      
                     
                       
                         λ 
                         i 
                       
                        
                       
                         p 
                          
                         
                           ( 
                           
                             x 
                             i 
                           
                           ) 
                         
                       
                     
                   
                   = 
                   0. 
                 
               
               
                 
                   ( 
                   43 
                   ) 
                 
               
             
           
         
       
     
         [0092]    For EEG, ƒ=ψ(τ), and for MEG, ƒ=τA τ  (τ). The unknown coefficients λ 1 , . . . λ N , c 1 , . . . , c 4 , are linearly related to the function ƒ(x), thus the interpolation problem reduces to the following least squares problem: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         [ 
                         
                           
                             
                               A 
                             
                             
                               P 
                             
                           
                           
                             
                               
                                 P 
                                 T 
                               
                             
                             
                               0 
                             
                           
                         
                         ] 
                       
                        
                       
                         [ 
                         
                           
                             
                               λ 
                             
                           
                           
                             
                               c 
                             
                           
                         
                         ] 
                       
                     
                     = 
                     
                       [ 
                       
                         
                           
                             f 
                           
                         
                         
                           
                             0 
                           
                         
                       
                       ] 
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   44 
                   ) 
                 
               
             
           
         
       
     
         [0093]    where the matrix AεR N×N , is defined by 
         [0000]        A   i,j =φ(∥ x   i   −x   j ∥)  (45)
 
         [0094]    and every row of the matrix PεR N×4  is defined as 
         [0000]        P ( i ,.)=[1 x   i   y   i   z   i ]1≦ i≦N.   (46)
 
       3. The Inverse Problem for EEG 
       [0095]    We analyse equation (4). A radial basis function approximation of Ψ(τ) can be written in the form 
         [0000]    
       
         
           
             
               
                 
                   
                     Ψ 
                      
                     
                       ( 
                       τ 
                       ) 
                     
                   
                   = 
                   
                     
                       ∑ 
                       
                         j 
                         = 
                         1 
                       
                       N 
                     
                      
                     
                       
                         λ 
                         j 
                       
                        
                       
                         ϕ 
                         ( 
                         
                           
                             
                                
                               
                                 τ 
                                 - 
                                 
                                   τ 
                                   j 
                                 
                               
                                
                             
                              
                             
                                
                               ) 
                             
                           
                           , 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   47 
                   ) 
                 
               
             
           
         
       
     
         [0096]    where φ(∥τ−τ j ∥|)=(∥τ−τ j ∥ 2 +c 2 ) 1/2 . Here, {λ j :1≦i≦N} are the coefficients to be estimated, and c&gt;0 is a constant. 
         [0097]    By substituting equation (47) into equation (4) we can formulate the following least squares problem: 
         [0000]        b=Eλ,   (48)
 
         [0000]      where 
         [0000]        E ( i,j )=∫ Ω     c   [∇ τ φ(∥τ−τ j ∥|)· u   s ( r   1 ,τ)] dV (τ), b ( i )= u   s ( r   i )  (49)
 
         [0098]    and i denotes the ith sensor index. We can compute the volume integral of equation (49) numerically. The parametrization of the problem acts as an implicit regularization. We assume that the measurements are corrupted by additive noise. In this setting, the maximum likelihood estimate (MLE) yields 
         [0000]      {circumflex over (λ)}=( E   T   C   w   −1   E ) −1   E   T   C   w   −1   b,   (50)
 
         [0099]    where C w  is the covariance matrix of the measurement noise or the sample covariance matrix. The volume integrals of equation (49) are computationally expensive. However, this computation can be parallelized. More precisely, for every matrix entry (i, j), the process of solving the volume integral is independent from every other matrix entry. Furthermore, for a given geometry, the matrix E in equation (49) needs to be computed only once. 
         [0100]    Optionally, since head geometries are similar, an approximate result may be obtained using a common head geometry for a group of patients, for example all adult patients. 
       4. Inverse Problem for MEG 
       [0101]    In embodiments in order to solve the MEG inverse problem we first solve the EEG inverse problem. We assume that the magnetic sensors are oriented radially (though the skilled person will appreciate that this is merely a convenience—for example a radial component of the field may be derived from a sensor at any orientation). We can rewrite equation (5) in the form 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ∫ 
                       
                         Ω 
                         c 
                       
                     
                      
                     
                       
                         
                           ∇ 
                           2 
                         
                          
                         
                           ( 
                           
                             τ 
                             · 
                             
                               A 
                                
                               
                                 ( 
                                 τ 
                                 ) 
                               
                             
                           
                           ) 
                         
                       
                        
                       
                         
                            
                           
                             V 
                              
                             
                               ( 
                               τ 
                               ) 
                             
                           
                         
                         
                            
                           
                             r 
                             - 
                             τ 
                           
                            
                         
                       
                     
                   
                   = 
                   
                     
                       
                         - 
                         
                           1 
                           
                             4 
                              
                             π 
                           
                         
                       
                        
                       
                         
                           ∑ 
                           
                             l 
                             ∈ 
                             
                               { 
                               
                                 1 
                                 , 
                                 2 
                                 , 
                                 3 
                               
                               } 
                             
                           
                         
                          
                         
                           
                             ∫ 
                             
                               Ω 
                               c 
                             
                           
                            
                           
                             
                               
                                 r 
                                 l 
                               
                                
                               
                                 [ 
                                 
                                   
                                     ∇ 
                                     
                                       Ψ 
                                        
                                       
                                         ( 
                                         τ 
                                         ) 
                                       
                                     
                                   
                                   · 
                                   
                                     
                                       ∇ 
                                       τ 
                                     
                                      
                                     
                                       
                                         H 
                                         l 
                                       
                                        
                                       
                                         ( 
                                         
                                           r 
                                           , 
                                           τ 
                                         
                                         ) 
                                       
                                     
                                   
                                 
                                 ] 
                               
                             
                              
                             
                                
                               
                                 V 
                                  
                                 
                                   ( 
                                   τ 
                                   ) 
                                 
                               
                             
                           
                         
                       
                     
                     - 
                     
                       
                         
                           4 
                            
                           π 
                         
                         µ 
                       
                        
                       
                         
                           B 
                            
                           
                             ( 
                             r 
                             ) 
                           
                         
                         · 
                         
                           r 
                           . 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   51 
                   ) 
                 
               
             
           
         
       
     
         [0102]    We assume that an estimate of the function {circumflex over (Ψ)}(τ) has been computed from EEG data, thus all quantities on the right hand side of equation (51) are known. We denote the radial component of the vectorial function A(τ) by A τ  (τ):={circumflex over (τ)}·A(τ). A radial basis function expansion of the unknown function τA τ  (τ) takes the form 
         [0000]    
       
         
           
             
               
                 
                   
                     τ 
                      
                     
                         
                     
                      
                     
                       
                         A 
                         τ 
                       
                        
                       
                         ( 
                         τ 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       ∑ 
                       
                         j 
                         = 
                         1 
                       
                       N 
                     
                      
                     
                       
                         β 
                         j 
                       
                        
                       
                         ϕ 
                         ( 
                         
                           
                              
                             
                               τ 
                               - 
                               
                                 τ 
                                 j 
                               
                             
                              
                           
                            
                           
                             
                                
                               ) 
                             
                             . 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   52 
                   ) 
                 
               
             
           
         
       
     
         [0103]    In order to formulate a least squares problem, we introduce the following notations: 
         [0000]    
       
         
           
             
               
                 
                   
                       
                   
                    
                   
                     
                       M 
                        
                       
                         ( 
                         
                           i 
                           , 
                           j 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         ∫ 
                         
                           Ω 
                           c 
                         
                       
                        
                       
                         
                           ∇ 
                           τ 
                           2 
                         
                          
                         
                           ϕ 
                           ( 
                           
                             
                               
                                 
                                    
                                   
                                     τ 
                                     - 
                                     
                                       τ 
                                       j 
                                     
                                   
                                    
                                 
                                  
                                 
                                    
                                   ) 
                                 
                                  
                                 
                                   
                                      
                                     
                                       V 
                                        
                                       
                                         ( 
                                         τ 
                                         ) 
                                       
                                     
                                   
                                   
                                      
                                     
                                       
                                         r 
                                         i 
                                       
                                       - 
                                       τ 
                                     
                                      
                                   
                                 
                               
                               ; 
                               
                                 
                                   r 
                                   i 
                                 
                                 ∈ 
                                 
                                   Ω 
                                   e 
                                 
                               
                             
                             , 
                             
                               
 
                             
                              
                             
                               
                                 c 
                                  
                                 
                                   ( 
                                   i 
                                   ) 
                                 
                               
                               = 
                               
                                 
                                   
                                     - 
                                     
                                       1 
                                       
                                         4 
                                          
                                         π 
                                       
                                     
                                   
                                    
                                   
                                     
                                       ∑ 
                                       
                                         l 
                                         ∈ 
                                         
                                           { 
                                           
                                             1 
                                             , 
                                             2 
                                             , 
                                             3 
                                           
                                           } 
                                         
                                       
                                     
                                      
                                     
                                       
                                         ∫ 
                                         
                                           Ω 
                                           c 
                                         
                                       
                                        
                                       
                                         
                                           
                                             r 
                                             
                                               ( 
                                               
                                                 i 
                                                 , 
                                                 l 
                                               
                                               ) 
                                             
                                           
                                            
                                           
                                             [ 
                                             
                                               
                                                 ∇ 
                                                 
                                                   Ψ 
                                                    
                                                   
                                                     ( 
                                                     τ 
                                                     ) 
                                                   
                                                 
                                               
                                               · 
                                               
                                                 
                                                   ∇ 
                                                   τ 
                                                 
                                                  
                                                 
                                                   
                                                     H 
                                                     l 
                                                   
                                                    
                                                   
                                                     ( 
                                                     
                                                       
                                                         r 
                                                         i 
                                                       
                                                       , 
                                                       τ 
                                                     
                                                     ) 
                                                   
                                                 
                                               
                                             
                                             ] 
                                           
                                         
                                          
                                         
                                            
                                           
                                             V 
                                              
                                             
                                               ( 
                                               τ 
                                               ) 
                                             
                                           
                                         
                                       
                                     
                                   
                                 
                                 - 
                                 
                                   
                                     
                                       4 
                                        
                                       π 
                                     
                                     μ 
                                   
                                    
                                   
                                     
                                       B 
                                        
                                       
                                         ( 
                                         
                                           r 
                                           i 
                                         
                                         ) 
                                       
                                     
                                     · 
                                     
                                       
                                         r 
                                         i 
                                       
                                       . 
                                     
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   53 
                   ) 
                 
               
             
           
         
       
     
         [0104]    where i denotes the ith sensor index. Then equation (51) yields 
         [0000]        Mβ=c.   (54)
 
         [0105]    As in the case of EEG, the employed parametrization acts as an implicit regularization. The MLE estimates yields 
         [0000]      {circumflex over (β)}=( M   T   C   w   −1   M ) −1   M   T   C   w′   −1   c,   (55)
 
         [0106]    where C w′  is the covariance matrix of the noise associated with the magnetic field measurement system. The volume integrals of equation (53) are computationally expensive. However, these computations can be parallelized. More precisely, for an arbitrary matrix entry (i, j), the process of solving the volume integral is independent from every other matrix entry. Moreover, for a given geometry, the matrix M defined in equation (53) needs to be computed only once. 
         [0107]    Note that in the above care should be taken to distinguish between cε           +  (a radial basis function parameter) and cε           N  (processed MEG data, where N denotes the number of magnetometers). 
       Computer Implementation 
       [0108]    Referring now to  FIG. 1 a   , this shows a flow diagram of a procedure to numerically implement the solution of the inverse problem for EEG on a computing system. The computing system may either be a general purpose computing system, or a digital signal processor, and/or may comprise dedicated hardware. 
         [0109]    At step S 100  the procedure inputs the EEG data, represented as a vector b (using the notation of Section 3 above), and at step S 102  calculates an estimate of the vector λ by solving b=Eλ by any of many numerical methods which will be well known to those skilled in the art. Once an estimate of λ has been found this can be used to determine an estimate for ψ, from the radial basis functions, which in turn represents the current distribution J. In principle output data from the procedure may be provided in the form of data representing either λ, ψ or J, and/or the current distribution data may be converted into a 3D representation of the EEG data, for example mapped onto a 3D representation of the head and/or brain (cerebrum)—step S 114 . The skilled person will appreciate that there are many techniques which may be employed to provide a 3D representation of the EEG data, including representing the data as one or more 2D slices. 
         [0110]    The procedure of  FIG. 1 a    employs data from the matrix E as previously described, and this may either be calculated or retrieved from storage, as shown in step S 101 . A procedure for calculating E is described below with reference to  FIG. 1   c.    
         [0111]      FIG. 1 b    shows a flow diagram of a procedure which may be used to image a current distribution in the brain derived from MEG data. The procedure of  FIG. 1 b    reflects the description in section 4 above. Thus at step S 106  the procedure inputs magnetic field data B and, at step S 110 , determines an estimate of vector β from the equation Mβ=c, again using any one of many techniques which will be well known to those skilled in the art. The matrix M may again either be calculated or retrieved from memory (step S 111 ). In embodiments the procedure calculates the parameter vector c, for example using the head (cerebrum) geometry, the previously calculated approximation for iv, and the previously described vectorial function H. Again H is dependent only on the geometry (internal and external), and conductivity, of the head, and may again be either calculated or retrieved from memory (step S 109 ). Then an estimate of vector β can be determined from Mβ=c. 
         [0112]    The procedure then outputs (S 112 ) data representing the vectorial function A, in particular the radial component of this function. This may be determined from a combination of vector β and the radial basis functions (although in principle the output data may comprise β rather than data directly representing A). Then, again, the procedure may generate a 3D representation of the solenoidal part of the current distribution determined from the measured magnetic field B. 
         [0113]      FIG. 1 c    shows a flow diagram of a procedure for calculating the elements of matrix E and the elements of vectorial function H, by determining current-independent harmonic functions u j  as previously described in Section 2 above. Thus at step S 120  the procedure inputs geometry and conductivity data for the head, in particular defining boundaries of the cerebrum, cerebrospinal fluid, bone and scalp, and their respective electrical conductivities. Standard values may be used for the electrical conductivities. The relevant geometry data may be derived, for example, from a magnetic resonance imaging scan of the patient and/or a more generic model may be employed. 
         [0114]    At step S 122  the procedure solves a set of partial differential equations, as outlined in Section 2 above, to determine the set of current-independent harmonic functions u j  for each of the cerebrum, CSF, bone and scalp. From these the related functions v j  may then be determined (although this step is not essential). The procedure then computes the elements of matrix E (S 124 ), as described in Section 3 above and/or may compute the elements of the vectorial function H as described in Section 4 above. One or both of matrix E and vector function H may then be stored for later use. 
         [0115]      FIG. 1 d    shows an embodiment of a computer system  200  programmed to implement the methods of  FIGS. 1 a  to 1 c   . Thus in the illustrated embodiment the computer system comprises a processor  204  coupled to working memory  206  and to non-volatile memory  208  storing processor control code to control the process of  204  to implement the previously described procedures. A graphical use interface  212  is provided for displaying a 3D representation of the determined current distribution(s) to the user, although the skilled person will appreciate that additionally or alternatively other forms of storage/output may be employed. The computer system  200  has an input  202  from EEG and/or MEG apparatus; this may, for example, comprise a connection over a computer network. In a similar manner the computer system  200  has access to a data store  210 , again optionally over a computer network. The optional but preferable data store  210  may be employed to store one, some or all of the parameters described with reference to  FIG. 1 c    for use in solving the inverse problem for EEG and/or MEG, in particular brain geometry/conductivity data. Optionally a pre-computed inverse matrix for EEG and/or MEG may be stored or, for example, a pre-computed inverse matrix for each of a number of topologies may be provided as a library, for example indexed by user. 
         [0116]    Although an example embodiment has been described which employs a general purpose computing system, the skilled person will appreciate from the foregoing discussion that the final ‘imaging’ step reduces to a matrix by vector multiplication (the matrix inverse may be pre-computed). Thus it will be appreciated that once the procedure of  FIG. 1 c    has been run, the remaining processing load is small and may be run in, say, a dedicated application specific integrated circuit (ASIC) and/or on a mobile device such as a tablet computer or smart phone. A data store storing the pre-computed inverse matrix may be at a remote location accessible (with suitable security) via a wired or wireless network. 
       5. A Numerical Estimate of v s (r,τ), and ∇ τ H(r,τ) 
       [0117]    The preceding approach was validated by performing a forward calculation and checking that the solution to the inverse problem agreed with the initial data. In this section we compare the analytic expression for v s (r,τ) obtained from equation (24) with a numerical estimate obtained via the approach outlined in section 2.2. We take the following values for the radii, and the conductivities: 
         [0000]    
       
         
               
               
               
               
               
             
           
               
                   
                   
               
             
             
               
                   
                 r c  = 0.071m 
                 r f  = 0.074m 
                 r b  = 0.079m 
                 r s  = 0.085m 
               
               
                   
                 σ c  = 0.33 
                 σ f  = 1 
                 σ b  = 0.0125 
                 σ s  = 0.33 
               
               
                   
                   
               
             
          
         
       
     
         [0118]    For the source, we let τ=[0.0226, 0.0068, 0.0258]m,Q=[1,1,1]/√{square root over (3)}. We use a numerical implementation based on a boundary element method as outlined in Z. Akalin-Akar ibid. We compute u s (r,τ) at  1026  discrete points on the outer surface r=0.085 m. The results for a 256 point subset of arbitrary discrete points on the outer surface are presented in  FIG. 2 a   . The circles show the analytic solution, and the solid line with dots is the solution from the boundary element method. The small discrepancy between the numerical and the analytic solution varies between numerical solvers, and it depends on several factors including the mesh, element types, the numerical integration, and specific assumptions used in the implementation. The comparison of the analytical solution for v s (r,τ) for a 256 point subset on the outer surface is shown in  FIG. 2 b   . The circles show the analytical solution given by equation (24); the solid line with dots is the numerical solution outlined in section 2.2 above. 
         [0119]    The inverse MEG formulation relies on the complete solution of the boundary value problem described by equations (10)-(13). We consider the multi-layer spherical geometry described below: 
         [0000]    
       
         
               
               
               
               
               
             
           
               
                   
                   
               
             
             
               
                   
                 r c  = 0.071m 
                 r f  = 0.074m 
                 r b  = 0.079m 
                 r s  = 0.085m 
               
               
                   
                 σ c  = 0.33 
                 σ f  = 1 
                 σ b  = 0.0125 
                 σ s  = 0.33 
               
               
                   
                   
               
             
          
         
       
     
         [0120]    We present a solution for a finite set of observation points, and an arbitrary source point. We introduce the following notation: 
         [0000]      ∂Ω i   ± :=∂Ω i   ±γ{circumflex over (n)}   i   iεc,ƒ,b  
 
         [0121]    where {circumflex over (n)} is a unit vector normal to the surface ∂Ω i . In our numerical tests we set γ=10 −3 . This corresponds to a small movement towards inside (−γ) and outside (+γ) of the domain Ω i . We solve v c (r,τ) on the surface ∂Ω c   − , and v ƒ (r,τ) on the surface ∂Ω c   + . For the surface ∂Ω ƒ , we solve v ƒ (r,τ) on the surface ∂Ω ƒ   − , and v b (r,τ) on the surface ∂Ω ƒ   + . For the surface ∂Ω b , we solve v b (r,τ) on the surface ∂Ω b   − , and v s (r,τ) on the surface ∂Ω b   + . For the surface ∂Ω s , we present the analytical and numerical solution of the function v s (r,τ) in  FIG. 3 . We consider an arbitrary source point τ=[0.0226, 0.0068, 0.0258]m and 140 arbitrary discrete observation points r on each surface. It is clear that the solution at the observation points on surfaces closer to the source point τεΩ c , namely ∂Ω i   − , have a slightly larger amplitude than the solution on surfaces ∂Ω i   + . The solutions converge as γ→0. 
         [0122]      FIG. 2 a    shows a comparison of the analytical solution and of a numerical solution of u s (r,τ) which is described by equations (15)-(18). The radii are [0.071, 0.074, 0.079, 0.085]m, and the corresponding conductivities are [0.33, 1, 0.0125, 0.33]. A dipole described by τ=[0.0226, 0.0068, 0.0258]m, Q=[1,1,1]/√{square root over (3)} is used as a source. The line with circles is the analytical solution and the solid dot line is a numerical solution. 
         [0123]      FIG. 2 b    shows a comparison of the analytical solution and of a numerical solution of v s (r,τ) which is described by equations (10)-(13). The line with circles is the analytical solution, equation (24), and the solid line with dots is the solution using the approach outlined in section 2.2 above. The radii are [0.071, 0.074, 0.079, 0.085]m, and the corresponding conductivities are [0.33, 1, 0.0125, 0.33]. A source position has been fixed at τ=[0.0226, 0.0068, 0.0258]m. A total of 256 arbitrary points have been selected on the outer surface. 
         [0124]      FIG. 3  shows the solution of the boundary value problem described by equations (10)-(13) for every surface of the multi-layer spherical geometry. The radii are [0.071, 0.074, 0.079, 0.085]m, and the corresponding conductivities are [0.33, 1, 0.0125, 0.33]. A source position has been fixed at τ=[0.0226, 0.0068, 0.0258]m. For every surface, 140 arbitrary points have been selected.  FIG. 3 a    shows v c (r,τ) and v ƒ (r,τ) on the surface ∂Ω c .  FIG. 3 b    shows v ƒ (r,τ) and v b (r,τ) on the surface ∂Ω ƒ .  FIG. 3 c    shows v b (r,τ) and v b (r,τ) on the surface ∂Ω b .  FIG. 3 d    shows the analytical and numerical solution of v b (r,τ) on the surface ∂Ω s . 
         [0125]      FIG. 4  shows the elements of the matrix ∇ τ H (r, τ) given by equation (39) for the multi-layer spherical geometry. The radii are [0.071, 0.074, 0.079, 0.085]m, and the corresponding conductivities are [0.33, 1, 0.0.125, 0.33]. A source position has been fixed at τ=[−0.0397, −0.0284, 0.0057]m. On the subfigures, the x-axis values are sensor indexes and the y axis shows the functions 
         [0000]    
       
         
           
             
               
                 ∂ 
                 
                   H 
                   j 
                 
               
               
                 ∂ 
                 
                   τ 
                   i 
                 
               
             
             . 
           
         
       
     
         [0000]    The solid line with circles is the analytical solution and the solid line with dots is the numerical solution. Each of the nine functions is identified by a numerical header. They are as follows: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         1 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         1 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         1 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         2 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         1 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         3 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         2 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         1 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         2 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         2 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         2 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         3 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   6 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         3 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         1 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   7 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         3 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         2 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   8 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       ∂ 
                       
                         H 
                         3 
                       
                     
                     
                       ∂ 
                       
                         τ 
                         3 
                       
                     
                   
                   . 
                 
               
               
                 
                   
                     ( 
                     9 
                     ) 
                   
                    
                    
                 
               
             
           
         
       
     
         [0000]    The results of  FIGS. 2-4  demonstrate that the previously described approach provides an accurate numerical solution to the inverse problem. 
       6. Numerical Result: Three Layer Head Model 
       [0126]    In the case of the three layer realistic head model, we have 86 electrodes. We consider a radial basis function expansion with 75 coefficients. The head geometry is shown in  FIG. 5 . Thus  FIG. 5  shows the three layer realistic head model used for the results described herein. In more detail,  FIGS. 5 a  to 5 c    show, respectively, the cerebrum, Ω c , the skull, Ω b  and the head, Ω s . The BEM (boundary element method) discretization involves a total of 2476 vertices and 4940 triangles. 
       6.1 Numerical Estimate of the Current Via EEG 
       [0127]    We consider the synthetic function Ψ(τ) defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     Ψ 
                      
                     
                       ( 
                       τ 
                       ) 
                     
                   
                   = 
                   
                     
                       ∑ 
                       
                         l 
                         = 
                         1 
                       
                       L 
                     
                      
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           1 
                         
                         2 
                       
                        
                       
                         
                           k 
                           i 
                         
                          
                         
                           
                             h 
                             i 
                             l 
                           
                            
                           
                             ( 
                             
                               
                                 1 
                                 l 
                               
                               - 
                               
                                 ln 
                                  
                                 
                                   [ 
                                   
                                     τ 
                                     
                                       c 
                                       1 
                                     
                                   
                                   ] 
                                 
                               
                             
                             ) 
                           
                         
                          
                         
                           c 
                           1 
                           
                             
                               2 
                                
                               l 
                             
                             + 
                             1 
                           
                         
                          
                         
                           
                             
                               ( 
                               
                                 
                                   2 
                                    
                                   l 
                                 
                                 + 
                                 1 
                               
                               ) 
                             
                             2 
                           
                           
                             4 
                              
                             π 
                           
                         
                          
                         
                           
                             P 
                             l 
                           
                            
                           
                             ( 
                             
                               
                                 η 
                                 i 
                               
                               · 
                               
                                 τ 
                                 ^ 
                               
                             
                             ) 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   56 
                   ) 
                 
               
             
           
         
       
     
         [0128]    We set L=50 and use the following values: 
         [0000]    
       
         
           
             
               
                 h 
                 1 
               
               = 
               0.3 
             
             , 
             
               
                 η 
                 1 
               
               = 
               
                 [ 
                 
                   
                     1 
                     
                       3 
                     
                   
                   , 
                   
                     1 
                     
                       3 
                     
                   
                   , 
                   
                     1 
                     
                       3 
                     
                   
                 
                 ] 
               
             
             , 
             
               
                 k 
                 1 
               
               = 
               0.029 
             
             , 
             
               
 
             
              
             
               
                 h 
                 2 
               
               = 
               0.4 
             
             , 
             
               
                 η 
                 2 
               
               = 
               
                 [ 
                 
                   
                     1 
                     
                       2 
                     
                   
                   , 
                   0 
                   , 
                   
                     - 
                     
                       1 
                       
                         2 
                       
                     
                   
                 
                 ] 
               
             
             , 
             
               
                 k 
                 2 
               
               = 
               
                 0.015 
                 . 
               
             
           
         
       
     
         [0129]    We consider a radial basis function (RBF) expansion of the function Ψ(τ). All information about the function Ψ(τ) is encoded into the parametrization {(λ j , τ j ):1≦j≦N,φ(r)=(r 2 +c 2 ) 1/2 }. The parameters of interest are the components of the vector λ. In order to avoid the “inverse crime”, we choose a different discretization of equation (4) to generate the synthetic data than the one used to perform the reconstruction. The RBF expansion of the function (56) is shown in  FIG. 6 . We have used 75 equally spaced points in the cerebrum, i.e N=75 in equation (47). It is clear from  FIG. 6  that this expansion is sufficiently accurate to represent the synthetic function Ψ(τ). We assume a signal to noise ratio (SNR) of 20 dB, and model the noise as white Gaussian noise i.e w˜N(0,σ 2 I). The reconstructions are shown in  FIG. 7 . 
         [0130]    Thus  FIG. 6  shows the RBF (radial basis function) expansion of the function ( 6 . 1 ), showing the synthetic function Ψ(τ) and the corresponding radial basis function interpolation of Ψ(τ) inside the domain Ω c  of the three layer head model. We used 75 coefficients and sampled the function on a Cartesian grid inside the domain Ω c . The top figure shows the function Ψ(τ) defined by equation (56) as well as the corresponding radial basis function interpolation. The bottom figure shows the absolute error between the exact Ψ(τ) and the corresponding interpolation. 
         [0131]      FIG. 7  shows the exact and reconstructed functions Ψ(τ) for the three Layer head model. We have used 75 coefficients and 86 electrodes. The signal to noise ratio (SNR) is 20 dB. In  FIG. 7 a   , the solid line with circles shows the exact λ, equation (47), whereas the solid line with dots is the reconstructed {circumflex over (λ)}, equation (50). In  FIG. 7 b   , the solid line with circles is Ψ(τ) as given by equation (56), whereas the solid line with dots is the reconstructed current computed using the estimated {circumflex over (λ)}.  FIG. 7 c    shows the error e(τ):=|Ψ(τ)−{circumflex over (Ψ)}(τ) of the functions shown in  FIG. 7   b.    
       6.2 Numerical Estimate of the Current Via MEG 
       [0132]    We consider the synthetic function used in Fokas,  Inverse Problems , ibid, to represent τA τ (τ), but with different numerical values. The function τA τ (τ) is given by 
         [0000]    
       
         
           
             
               
                 
                   
                     τ 
                      
                     
                         
                     
                      
                     
                       
                         A 
                         τ 
                       
                        
                       
                         ( 
                         τ 
                         ) 
                       
                     
                   
                   = 
                   
                     
                       ∑ 
                       
                         i 
                         = 
                         1 
                       
                       2 
                     
                      
                     
                       
                         
                           k 
                           i 
                         
                          
                         
                           [ 
                           
                             
                               
                                 1 
                                 
                                   4 
                                    
                                   π 
                                 
                               
                                
                               
                                 
                                   1 
                                   - 
                                   
                                     h 
                                     i 
                                     2 
                                   
                                 
                                 
                                   
                                     ( 
                                     
                                       1 
                                       + 
                                       
                                         h 
                                         i 
                                         2 
                                       
                                       - 
                                       
                                         2 
                                          
                                         
                                           
                                             h 
                                             i 
                                           
                                            
                                           
                                             ( 
                                             
                                               
                                                 η 
                                                 i 
                                               
                                               · 
                                               
                                                 τ 
                                                 ^ 
                                               
                                             
                                             ) 
                                           
                                         
                                       
                                     
                                     ) 
                                   
                                   1.5 
                                 
                               
                             
                             - 
                             
                               1 
                               
                                 4 
                                  
                                 π 
                               
                             
                           
                           ] 
                         
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   57 
                   ) 
                 
               
             
           
         
       
     
         [0133]    We use the following values: 
         [0000]    
       
         
           
             
               
                 h 
                 1 
               
               = 
               0.3 
             
             , 
             
               
                 η 
                 1 
               
               = 
               
                 [ 
                 
                   
                     1 
                     
                       3 
                     
                   
                   , 
                   
                     1 
                     
                       3 
                     
                   
                   , 
                   
                     1 
                     
                       3 
                     
                   
                 
                 ] 
               
             
             , 
             
               
                 k 
                 1 
               
               = 
               0.029 
             
             , 
             
               
 
             
              
             
               
                 h 
                 2 
               
               = 
               0.4 
             
             , 
             
               
                 η 
                 2 
               
               = 
               
                 [ 
                 
                   
                     1 
                     
                       2 
                     
                   
                   , 
                   0 
                   , 
                   
                     - 
                     
                       1 
                       
                         2 
                       
                     
                   
                 
                 ] 
               
             
             , 
             
               
                 k 
                 2 
               
               = 
               
                 0.0047 
                 . 
               
             
           
         
       
     
         [0134]    As in the case with EEG, we employ a RBF expansion for the function τA τ (τ). All information about the function τAτ(τ) is encoded into the parametrization {(β j , τ j ): 1≦j≦N, φ(r)=(r 2 +c 2 ) 1/2 }. The parameters of interest are the components of the vector β. In order to avoid the “inverse crime” we choose a different discretization of equation (5) to generate the synthetic data than the one used to perform the reconstruction. The RBF expansion of the function (57) is shown in  FIG. 8 . We used 75 equally spaced points in the cerebrum, i.e N=75 in equation (52). It is clear from  FIG. 8  that this expansion is sufficiently accurate to represent the synthetic function τA τ (τ). We assume a signal to noise ratio (SNR) of 20 dB and model the noise as white Gaussian noise i.e w′˜N(0,σ 2 I). We have 102 real sensor positions to obtain the measurements. The reconstructions are shown in  FIG. 9 . 
         [0135]    Thus  FIG. 8  shows the synthetic function τA τ (τ) and the corresponding radial basis function interpolation of τA τ (τ) inside the domain Ω c  of the three layer head model. We used 75 coefficients and sampled the function on a Cartesian grid inside the domain Ω c . The top figure shows the function τA 96  (τ) as given by equation (57), as well as the corresponding radial basis function interpolation. The bottom figure shows the absolute error between the exact τA τ (τ) and the corresponding interpolation. 
         [0136]      FIG. 9  shows the exact and reconstructed τA τ (τ) and the three layer head model. We used 75 coefficients and 102 real sensor positions. The signal to noise ratio (SNR) is 20 dB. In  FIG. 9 a   , the solid line with circles shows the exact β, equation (52), whereas the solid line with dots is the reconstructed {circumflex over (β)} as given by equation (57). In  FIG. 9 b   , the solid line with circles is τA τ (τ) as given by equation (57), whereas the solid line with dots is the reconstructed current computed using the estimated {circumflex over (β)}.  FIG. 9 c    shows the error e(τ):=|τA τ (τ)−τÂ τ  (τ)| of the functions shown in  FIG. 9   b.    
       7. Conclusion 
       [0137]    We have introduced an algorithmic approach for extracting the maximum possible information about the neuronal current J P (τ), τεΩ c , from the measurement of the electric potential u s (r), rε∂Ω s , on the scalp, and from the measurement of the radial part of the magnetic field r·B(r) rεΩ e  in the exterior of the head, relying on a numerical approach for computing the auxiliary functions ∇ τ v s (r,τ) and ∇ τ H(r,τ). In section 2.1 we derived analytic expressions for v s (r,τ) and ∇ τ H(r,τ) for the particular case of the spherical geometry. This allowed us to verify the effectiveness of the above numerical codes; the agreement with the analytical expressions is excellent. In section 6 we implemented our general approach to a realistic three shell geometry. The above algorithm yields accurate reconstructions both for the component Ψ(τ) of the current from the data set {u s  (r i ):1≦i≦N e }, as well as for the radial component of the vectorial function A(τ) (denoted by τA τ  (τ)) from the data set {r k ·B (r k ):1≦i≦N s , r k  εΩ e } and the estimated function Ψ(τ). Indeed, starting with the particular function Ψ(τ) given by equation (56), we generate a set of synthetic data for the electric potential on the scalp; using this set we show that we can reconstruct the function Ψ(τ) even in the presence of noise. Similarly, starting with the functions Ψ(τ) and τA τ (τ) given by equations (56) and (57) respectively, we generate a set of synthetic data for the radial part of the magnetic field outside the head; then, using this set as well as the reconstructed function Ψ(τ), we show that we can reconstruct the radial part of A(τ) even in the presence of noise. The assumed noise model in both the EEG and MEG is additive white Gaussian with a signal to noise ratio of 20 dB. 
         [0138]    It can thus be seen that embodiments of the above described algorithm are well-suited to address the distributed source problem, in particular in real time, and can handle reasonable noise levels in the measurements. 
         [0139]    EEG can yield as much information about the neuronal current as MEG, but at a fraction of the cost since EEG devices are inexpensive and widely available. A further advantage of EEG (and MEG) by comparison with other techniques such as fMRI, PET and the like is the fast time resolution—EEG and MEG can make 10s or 100s of measurements per millisecond. Furthermore, it is straightforward to reconstruct images of the current distributions from EEG data and MRI data (for the head geometry). 
         [0140]    Thus a further aspect of the invention contemplates an upgrade for a patient imaging machine, such as a magnetic resonance imaging machine, provided by combining the machine with EEG (and/or MEG) signal measurement apparatus and EEG (and/or MEG) signal processing software or hardware as described above. Such an upgrade may be of substantial benefit in diagnosis and treatment of many neurological diseases including, for example, epilepsy. In another application such an approach may be employed to differentiate ‘mild cognitive impairment’ (a transitional stage between normal aging and Alzheimer&#39;s disease) from Alzheimer&#39;s disease proper. 
         [0141]    EEG technology is also finding its way into the consumer market—for example low cost EEG headsets are becoming available for games. Thus a further application of the embodiments of the invention uses processing as described above to provide data for performing an action and/or controlling a consumer electronic device, for example for controlling a computer game or the like. More generally, embodiments of the techniques we describe may be employed to detect a user&#39;s thoughts and/or feelings and/or expressions in real time. 
         [0142]    The skilled person will appreciate that numerous variations of the above described techniques are possible. For example, although we have described the use of radial basis functions for expanding the neuronal current other basis functions may also be used. Either or both of the inverse EEG and inverse MEG algorithms may be partially, or substantially wholly, parallelised. 
         [0143]    Optionally Bayesian filtering and/or dynamic parameter estimation or other time series analysis may be applied to either or both of the raw data and processed data. The skilled person will appreciate that the EEG and/or MEG signals used may be pre-processed in many different ways, for example by filtering to attenuate noise, using any of a range of techniques. Similarly there are many different ways in which a graphical user interface may be provided to operators of the system, for example to facilitate a user in conducting a real-time experiment. Against the skilled person will appreciate that there are many ways in which data from the procedures we have described may be post-processed. 
         [0144]    No doubt many other effective alternatives will occur to the skilled person. It will be understood that the invention is not limited to the described embodiments and encompasses modifications apparent to those skilled in the art lying within the spirit and scope of the claims appended hereto.