A Method for Normal Direction Judge Applied in Electrocardiographic Problem

Boundary Element Method (BEM) is widely used in electrocardiographic (ECG) problem. Formulations of these problems based on mathematical and numerical approximations of the known source in heart and the volume conductor that can transfer voltages on the surface of the body. To analyze the electric potentials on body surface or epicardial surface, a set of discrete equations derived from a boundary integral equations need to be solved. Solving these equations means to get the potential distribution eventually. In the process of solving, transfer matrix of discrete equations has received considerable attention, how to get an appropriate transfer matrix is an important issue. This paper found that the direction of normal vector could affect the results when calculating the transfer matrix and presents a method analogous to Mesh Current Method to deal with this direction problem. Several simulations have been carried out to verify the accurate results with the correct direction of normal vector using new method within a torso model given simultaneous epicardial and body surface potential recordings.


Introduction
Electrocardiographic problem, namely given the potential distribution at epicardial surface to calculate the distribution at body surface (Forward Problem), or vice versa (Inverse Problem), draws lots of attentions in biomedical area these years, as electrocardiography can be a powerful tool for diagnosis in clinic [1] [2] [3].The potential distribution at epicardial surface and body surface are linked by a transfer matrix determined by the shape of heart and torso.Thus, both forward and inverse problem need to calculate the transfer matrix elements deter-Journal of Biosciences and Medicines mined by the geometry properties.
The boundary element method (BEM) is often an appropriate way to compute the transfer matrix, despite the different inner physical properties of the conductor medium when the medium is isotropic [4].Barr et al. gives an overall theory of dealing with forward problem and inverse problem based on BEM [5].
Horácek et al. calculate transfer coefficients based on triangle-to-triangle discretization [6] [7], rather than node-to-node discretization used by Barr et al. to construct appropriate matrices, these matrices are consisted of coefficients that relate to the potentials and their gradients on the epicardial surface of the conductor and the potential on the body surface [8] [9].The corresponding boundary integral equation should be solved through discretizing the surface into triangle elements [10] [11].Munck et al. uses analytically integrated elements to discretize the boundary integral equation linearly [12] [13].
The transfer matrix plays an important role in both forward problem and inverse problem.In the calculation of the matrix, the direction of normal vector of the triangle segments should be paid attention to carefully.Some methods are designed to deal with this issue by the commercial programs.Take one method as an example, first, it finds a point that is definitely outside the mesh, and calculates the centers of the triangles.Then, it computes the distances between the centers of the triangles and the outer point which was found previously.After that, it finds the triangle closest to the point that is for sure outside the mesh based on the distances that have been calculated before.Next, the normal vector n of this triangle is computed out based on right hand's rule according to index sequence of the three vertexes, and also the vector from the center of the nearest triangle to the outer point out P .If out P n ⋅ is negative, the order of the vertex index of each triangle would be adjusted to invert n .However, this approach lets mistakes occur sometimes, it can't make all the directions turn into right in some cases, which results in incorrect potential distribution eventually.
Therefore, this paper presents a new method to figure out the correct triangle normal direction to get the accurate potential distribution on surface.

Derivation of Transfer Matrix
First, deriving the integral equations.The potential o φ at point O can be expressed as Equation (1) using Green's second law, and the point O is assumed as an observation point which inside the volume but very close to surface, where B S is the body surface, H S is the epicardial surface.r is the distance that extends from the observer to elements of integration dS.B φ is the potential distribution on body surface, H φ is the potential distribution on epicardial sur- face.r is an unit vector in the direction of r. n is an outward pointing vector of unit magnitude normal to surface element dS.
So, two equations can be obtained from Equation ( 1) for observation positions located on body and epicardial surface, respectively, To solve the Equation (2) and Equation ( 3) numerically, these equations should convert to simultaneous linear equations.Therefore, the surface S, consist of B S and H S , need to subdivide in small triangles, which means the inte- gration area will be partitioned into triangle elements.And Equations (2) and Equation ( 3) can be simplified by the element of solid angle i ef dΩ which is subtended at an observation point of the i-th location on surface e by an area element on surface f: As it can be seen here, if the direction of n is wrong, the sign of r n ⋅ wouldn't be correct, therefore, it will have influence on the solid angle, which means the result of potential distribution may not be right.
Substituting Equation (4) in Equation ( 2) and Equation ( 3), and calculating the surface solid angle integration approximately by discretized triangle solid angle summation as the way shown in Equation (5).The coefficients of the components of gradients term are noted in Equation (6).
The different rows of matrices XY P and XY G corresponds to different loca- tions of the observer on surface X.As the theory showing, each of the P's and G's is a matrix of coefficients depending entirely on the geometry.In all cases the number of columns corresponds to the number of locations on the surface Y of integration [1].Based on the derivation above, the equation about the potential distributions on epicardial surface and body surface can be derived as , where BH Z is the transfer matrix described in Equation ( 7).

Normal Direction Judge Methods
As it has been shown in the theory, the direction of n is very important, the method of Barnard et al. requires the additional computation of the normal to the plane triangle to establish the correct sign.So the direction of n must be confirmed before any further calculation.
A new method is proposed to ensure the direction of n of each triangle ele- ment to be outward.The basic idea of this method comes from the application of Kirchhoff's laws.There are two applications of Kirchhoff's laws and Ohm's law, the Branch Current method and the Mesh Current method.The Mesh Current method can solve a circuit with less variables and less equations by simply determine unknown currents of each mesh in a network.Like its name, mesh current, means a current that loops around the essential mesh.It encompasses all the component of the mesh.First, there are some loops need to be identified within the circuit.As can be seen in Figure 1(a), one loop formed by DC V , 1 R and 2 R while the other loop formed by 2 R , 3 R .These current meshes are connected with each other by loops. 1 I and 2 I is the current of each mesh re- spectively.The direction of each current is chosen arbitrarily, and the intersecting component will be "went through" by two currents based on the assumption of the method.Second, get all the voltage drops though each resistor according to the direction of mesh currents.Then use the Kirchhoff's Voltage laws, get equations state as . Solve a set of equations can get respective mesh current.
In the theory of Mesh Current method, if all mesh currents are chosen in a same direction, either clockwise or counterclockwise, the direction of two mesh currents that go through the intersecting side of two meshes must be opposite.
So, that kind of law can be used in determining the direction of n in turn.In other words, if applying the theory of Mesh Current method to determine the direction of n , some principles should be followed: the direction of n gives the direction of rotation according to the right-hand rule, the direction of rotation of each triangle element shows a direction of each side of the triangle.If two triangles have contrary direction on their common side, it means the directions of n of them are at the same side.This can be seen in Figure 1(b).
In that case, if the direction of n of a triangle could be determined, the di- rection of n of the neighborhood of this triangle also could be determined.Therefore, in this new method, it needs to figure out a reference normal vector (RNV) at first, then determine the others' direction according to the direction of the RNV.The triangle element of which n is ensured correct and is referred as reference triangle (RT).Check the n of triangle elements in the neighborhood, which share one of RT's sides, and then check the neighborhood of these three triangles, and so on.Eventually, we can finish examination on all triangle elements of the model.

Simulation Results
The result of simulation can be carried out when using the one auto-solid angle approximation [3].Data of epicardial surface potential distributions include a number of different sequences of cardiac excitation and repolarization, along with the geometric location (x, y, z coordinates) of each body and heart electrode.For the purpose of contrast, this paper introduces the result of node-tonode discretization as a reference distribution.
The simple model this paper chooses to simulate has 602 epicardial points and 771 body surface points, with a cylinder-shaped heart, which is shown in Figure 2(a) and Figure 2(c).The surface B S of this model is represented as 1538 tri- angle elements.The surface H S of this model is represented as 1200 triangle elements.The comparatively complex model we apply our method for has 337 epicardial points and 771 body surface points, with a relatively real-shaped heart, which is shown in Figure 2

Simple Model
The simulation on simple model shows in Figure 3.As it can be seen in Figure 3(a), the potential on heart surface is set to increase from the bottom to the top monotonously.Consequently, Figure 3

Comparatively Complex Model
To verify the feasibility of the new method, a more genuine heart model is used for compares.The simulation results on comparatively complex model are shown in Figure 4. Figure 4(a) gives the potential distribution on epicardial surface which has been set as a known distribution.The results shown in Figure 4 are analogous to the results in Figure 3.The potential on heart surface also increases from the bottom to the top monotonously.

Conclusion
The direction of the normal vector of discretized triangle element is quite important for transfer matrix calculation in the electrocardiographic problem.It could be wrong sometimes if we do not deal with it appropriately.This paper presents a method analogous to mesh current method to judge the normal direction of triangles.Principle and process of this method are analyzed and explained in detail.The new method shows its accuracy in a simple and a more realistic heart shape model in the electrocardiographic problem.This method also has an inconvenient part, namely, an initial n of a triangle element needs to be determined first.Sometimes it should be checked manually if needed.
What's more, though the method does not require that either surface has any particular shape such as that of a sphere, it can't work correctly when geometry is extremely complex.However, the new method this paper presented can deal with most situations with high accuracy.

Figure 1 .
Figure 1.(a) A circuit for Mesh Current method; (b) Geometry for two adjacent triangle elements.It contains two triangles with four nodes.Triangle t1 with n1, n2 and n3, triangle t2 with n2, n3 and n4.If the order of t1's nodes is n1, n2, n3 and the order of t2's nodes is n3, n2, n4, the direction of normal vector of these two triangles are the same.
(b) and Figure 2(c).The surface B S of this model is represented as 1538 triangle elements.The surface H S of this model is represented as 976 triangle elements.

Figure 3 (
a) gives the potential distribution on epicardial surface which has been set as a known distribution.Figure 3(b) shows the potential distribution on body surface, which is a reference result here.And the potential distribution on body surface calculated by a commercial program and the program with new method is shown in Figure 3(c) and Figure 3(d), respectively.
(b) and Figure 3(d) show a reasonable monotonous potential distribution on the body surface.However, the bottom part of Figure 3(c) have significant differences with Figure 3(b) and Figure 3(d), it shows an unreasonable reverse below the middle area, which means it is inaccurate.

4
(b)  and Figure4(d) still keep this property.But Figure4(c) appears some abnormal distribution on the shoulder area, which exhibits its inaccuracy.

Figure 4 .
Figure 4. (a) Potential distribution on epicardial surface; (b) Reference potential distribution on body surface; (c) Potential distribution on body surface calculated by a commercial program; (d) Potential distribution on body surface calculated by the method this paper presented.