## Forward Problem: Boundary Element Method

The boundary element method (BEM) is a numerical computational technique for solving partial differential equations. In electro-magnetic source imaging (EMSI) of brain activity, it is used to solve the forward problem using realistic head models. When using BEM in head modeling, the head is assumed to be composed of uniform conductivity regions (i.e., scalp, skull, brain etc.) and the tissue boundaries are represented by triangular surface elements. The details of the BEM implementation used in this toolbox may be found in [2] and [3]. This section describes the BEM Toolbox.

• Press ‘Forward Model Generation’ on main menu.
• Load a mesh from file. It is also possible to load a model or a session if you have created them previously.
• Enter model name and conductivity values and press on ‘Create Model’ button.
• When the model is created, enter session name and load sensors. Sensors may be loaded from a list of nodes (.dat file) or from mesh coordinates (.sens file).
• Press on ‘Generate Transfer Matrix’.
• Load source space from .dip file. It should be a number of dipoles by 6 matrix, giving the location and orientation of the dipoles.
• Press on ‘Compute Lead Field Matrix’.
• You may plot potential distribution for the nth dipole.

The potentials are save under ‘session_name’_LFM as a Matlab .mat file. The user interface is shown in Figure 12.

![Figure 12: Interface for Forward Model Generation.](NFT_forward_ui.png "wikilink")

A forward problem solution using BEM consists of the following steps:

1. Compute the BEM matrices for a given head model.
2. Compute the transfer matrix for a given set of electrodes.
3. Compute the source vector for a given set of dipoles.
4. Obtain the electrode potentials due to the dipole activity.

The BEM solver that is interfaced from MATLAB to compute the BEM matrices is described below. Then, the data structures and functions used by the BEM toolbox are described.

## The BEM Solver

The BEM solver is written in C++ and is an executable program that is started from MATLAB with correct parameters to compute and save BEM matrices. The solver is called transparently from the MATLAB and need not be called explicitly by the user of the toolbox. However a familiarity with basic options and the program outputs would be useful.

\$ bem_matrix

Generate BEM coefficient matrices, including inner matrices for IPA

Usage: bem_matrix [-f matname] [-m magsens] [-o mod] meshname [s=sig …]

-f: save matrices to matname.[cdi]mat (default meshname)

-m: magnetic sensor file name

-o: interface to use with modified equations

(1: outer, 0: to disable)

s=sig: s:region (1: outer), sig: conductivity

(default conductivity: 0.2 for all regions)

As can be seen from the usage text, the bem_matrix application can generate and save BEM matrices for computing potential and magnetic fields. It can use the isolated problem approach (IPA) to compansate for the loss of accuracy due to the low conductivity of the skull.

## BEM Matrices

When IPA is not used, only the BEM Coefficient matrix is generated for EEG. It’s saved with the extension .cmt. If IPA is applied, two more matrices are generated and saved: .dmt and .imt.

In addition to the matrices created by the BEM solver, an additional matrix is the inverse of the Inner Coefficient Matrix. This matrix is the inverse of the imt matrix. It is inverted using the builtin MATLAB function inv() and saved on disk using the extension .iinv.

## The Transfer Matrix

The transfer matrix makes it possible to have very fast forward problem solutions. It is computed by inverting the selected columns of the coefficient matrix. In the toolbox, the inversion is done in MATLAB using the GMRES iterative solver. The resulting matrix is saved to the disk using the filename extension .tmte.

Since the matrix generation can take a long time for large meshes, an on disk copy is always present so that future computations can be made without generating the matrices from scratch. This is true for all the BEM and transfer matrices generated by the solver and by MATLAB. The matrices are loaded into MATLAB as needed, and can be cleared by the user as necessary to save memory. An additional advantage of this approach is that the matrices can be created externally (manually, at an other computer, etc.) and used by the toolbox.

## Structures

The BEM toolbox functions are implemented on three main data structures which represent information available at different stages of the forward problem solution procedure. The structures correspond to the BEM Mesh, the Head Model which is a combination of the mesh, conductivities and solver parameters, and a Session which specifies the sensor (electrode) positions used to acquire the data. The structures are described below:

### The Mesh Structure

Mesh structure contains coordinates and connectivity and boundary information from the mesh file.

### The Model Structure

The model structure includes the mesh structure and conductivity values for the mesh tissue classes and the index of the modified boundary, for use with IPA. If the index is set for smaller than 1, then IPA is not applied. If, for example, it’s set for 3 and there are 4 tissue classes, then 3rd and the 4th layers are the inner layers and the RHS vector is modified.

Furthermore, as the model matrices (.cmt, .dmt, .imt and .iinv) are loaded, they are stored inside the model structure as fields of the same name. The name of the model is used as the base filename when loading the model matrices.

### The Session Structure

The session structure represents a ‘recording session’. It includes the model structure and a matrix relating the positions of the sensors on the scalp to the nodes of the mesh (Smatrix). Each electrode is a weighted sum of the nodes of the element. The weights are determined by the element shape functions. The format of the Smatrix is as follows: [electrode_index node_index weight]. The rows of the matrix must be sorted by electrode_index and there can be more than one row with a given electrode index.

When the transfer matrix (.tmte) is loaded, it is stored inside the session structure. The name of the session is used as the base filename when saving and loading the transfer matrix.

References:

[2] Z. Akalin Acar, N.G. Gencer, An advanced BEM implementation for the forward problem of Electro-magnetic source imaging, Physics in Med. and Biol., vol. 49(5), 2004, pp 5011-28.

[3] N.G. Gencer, Z. Akalin Acar, Use of the isolated problem approach for multi-compartment BEM models of electro-magnetic source imaging, Physics in Med. and Biol., vol. 50, 2005, pp 3007-22.