**6. Metrics and information technologies for the analysis of magnetocardiographic data based on two-dimensional visualization of the solution of the inverse problem of magnetostatics**

The direct result of pre-processing of the data is 36 magnetocardiographic curves located at observation points—nodes of intersection of a rectangular grid, which is linked to the anatomical landmarks of the chest (**Figure 7**).

A detailed analysis of the morphology of MCG in healthy people was carried out. It was established that MCGs are similar to ECGs, recorded at the same points. The areas in which these or those elements of the MCG cardiac complex have the greatest amplitude have been analyzed. So, the wave P has the largest amplitude in the central zone of the upper half of the measuring grid corresponding to the V1 lead of ECG. The largest R—peak is recorded in the center of the measuring grid near the angle of the sternum, the deepest S-wave is in the left upper quadrant of the grid The deepest q is recorded in the upper left corner of the grid. In this area, the ventricle complex has the form qRs or qR. The complex Rs prevails in the right part of the grid. The ST segment is located close to the isoline at all registration points. The highest positive tooth T is

**Figure 7.** *36 MCG curves of healthy volonteer.*

recorded in the same area as the largest R-peak, the deepest negative to this in the same area where the deepest S-wave is. The U-wave is always positive and best expressed in the left upper quadrant. The constitutional features of the normal MCG as well as features related to gender and age are also analyzed. It was found that men have significant differences in the magnitude of the QRS complex, depending on their age (up to 50 years the magnitude is higher), and growth (the higher growth, the greater the magnitude). In women, such differences are revealed in connection with weight—the more weight, the greater the magnitude. Totally for all categories, the coefficient of variation of the magnitude in healthy individuals is very high (0.48). This gives reason to doubt the advisability of applying criteria based on absolute values.

At the initial stage of development of magnetocardiography, the methods of its analysis copied the methods of analysis of electrocardiograms, the nomenclature of names of teeth, segments, and intervals developed for ECG analysis was used without changes. However, the analysis of individual MCG curves does not allow us to see the main advantage of magnetocardiography—high sensitivity to changes in the spatial distribution of the magnetic field at the points of the measurement plane and the associated density of ionic currents in the heart. This goal can be obtained after solving the inverse problem of magnetostatics.

This expression stands for the redesigning of the electrical activity in the heart using the recordings obtained above the surface of the human body. Since the measured magnetic field in MCG is found outside the very surface of the body and just over it, it is detected in a measurement surface from a short distance to the skin enclosing the chest cage.

Therefore, the next step in the analysis and interpretation of MCG data were methods closely related to the creation of modern information technologies.

For spatial fixation of data during MCG record the observation points are used. – These are nodes of intersection of a square grid. The magnetic signal is recorded at a frequency of 1 kHz. So the signal curve consists of individual "pieces" corresponding to individual "moments" of time. In other words, for each moment of time in 1 millisecond in points of a grid of measurements (6х6 points with a step of 40 mm on mutually perpendicular axes), it is possible to allocate simultaneously 36 values of a magnetic signal. If these signals are interpolated within the measurement area to a

#### *Unshielded Magnetocardiography in Clinical Practice: Detection of Myocardial Damage… DOI: http://dx.doi.org/10.5772/intechopen.104924*

more "frequent (with smaller distances between nodes)" grid, it is possible to construct a spatial distribution of the measured magnetic signal in the form of a magnetic field map. Thus, on the basis of 36 synchronous averaged MCG curves, twodimensional (within 1 millisecond of time) magnetic field distribution maps are constructed using two-dimensional interpolation algorithms. Further, with the help of algorithms for solving the "inverse problem", equiinduction maps of the magnetic field distribution can be "converted" into the corresponding instantaneous maps of the distribution of current density vectors (CDV maps). A fundamental novelty of the proposed analysis of MCG data is the use of a new methodological approach—to assess the dynamics of changes in current density during the cardio cycle using maps sequentially arranged in time (dynamic mapping). This approach has identified a number of new MCG indicators, which, on the one hand, have a clear electrophysiological meaning, and on the other—to exclude the impact on research results of technical and design features of the MCG system used due to the analysis of relative values.

In the next stage, the analysis of the dynamics of the selected parameters of CDV maps in the selected time intervals of the cardio cycle (QRS, ST-T, Ta-e) with an arbitrary or specified time step (4–10 ms).

CDV instant maps and sets of such maps during cardio cycle intervals are the main diagnostic image and object of analysis in magnetocardiography. Each individual map, and even more so a set of cards during a certain phase of the cardio cycle, contains multifaceted information. Therefore, to take full advantage of the method for analysis, it is necessary to use not a single indicator, but their combination.

The following concepts define the classification of the CDV maps.

The electrical generator while being repolarized can be considered as an extended current origin placed at the borderline zone splitting excited and unexcited areas of myocardium. Having normal ventricular repolarization, this wave-front of excitation which is also integrated into a homogeneous conductivity medium has to be moved left-downwards within a 10°–80° sector. This model considers a couple of current types: the first one is known as "impressed current", since it is originated from "impressed" currents which are the transmembrane potential gradient and passive volume currents. On the other hand, put into homogeneous conductivity these volume currents contribute to two vortices, which are symmetrical and equivalent. The processed mapping has a dipolar layout closer to ideal (**Figure 8**) containing only one location with relatively larger vectors pointing left and downwards.

Green arrows display the "impressed currents", concentric-oriented curves represent current lines of the "volume" currents.

The appearance of inhomogeneity of conductivity due to some pathophysiological processes in the myocardium results in asymmetry and deformation of the vortexes (**Figure 9**), hence smaller portion of current vectors will be directed left-downwards.

Green arrows display the "impressed currents", concentric-oriented curves represent current lines of the "volume" currents.

Following the greater raise in abnormality, likewise, for ischemia issues, we monitor the appearance of the supplementary excitation wavefronts. These wave-fronts are pathological and definitely will represent the layout of maps with a non-dipolar structure (**Figure 10**). Thus, we encounter so-called supplementary locations (clusters) of current vectors. Usually, their directions are not pointed left and downwards, leading to the state where the amount of normally pointed vectors continuously drops. However, we do not neglect situations where the areas with supplementary vectors are pointed left and downwards. Anyways, these kinds of layouts should be named

*Model of current distribution in the case of inhomogeneous conductivity (two zones with a ratio of conductivities ©2/©1=1/3).*

abnormal as well have given the decrease in homogeneity, i.e., the detection of supplementary areas (clusters).

Green arrows display the "impressed currents", concentric-oriented ´curves represent current lines of the "volume" currents.

Hence, the basic method of analysis of the spatial structure of the current distribution map is based on the concept of "proper" direction [9]. For each current *Unshielded Magnetocardiography in Clinical Practice: Detection of Myocardial Damage… DOI: http://dx.doi.org/10.5772/intechopen.104924*

**Figure 10.**

*The concept of current distribution with strong inhomogeneity (inhomogeneous conductivity (two excitation wavefronts of equal strength).*

density vector, the normal direction is known, i.e., the sector within the pie chart from 0° to 180° and from 180° to 0°, which is used in the ECG, in which direction this vector is considered normal, i.e., "appropriate". In this case, the "proper" direction has a clear link to the interval of the cardio cycle to which this map belongs. Thus, during ventricular repolarization (from point J to the end of the T wave) the direction in the sector of 10°80° is "appropriate". It is known that during ventricular depolarization, the excitation sequentially covers the interventricular septum, anterior-apical area, sidewall, and posterior-inferior region of the left ventricle. Each of these phases of depolarization has its own "proper" direction of current density vectors (**Figure 11a**–**e**).

The quantitative parameter of this type of analysis is a normalized 100% anomaly index (Abnormality Index—AI), i.e., the ratio of the sum of the lengths of vectors directed in the correct, "proper" for each time directly to the sum of lengths of vectors having different from the "proper" direction. From the electrophysiological point of view, this indicator reflects the ratio of ion fluxes flowing in the "proper" direction and in a direction different from the "proper" one. The next stage of the analysis is the assessment of the processes of de- and repolarization of the ventricles in general. The average AI values during the QRS complex—AIQRS total as well as during the ST-T interval—AISTT total is calculated.

Another group of indicators is designed to assess the homogeneity of the repolarization process—the similarity of the spatial structure of the maps and the smoothness of the curve of the total current (i.e., the curve consisting of arithmetic sums of values of all current density vectors for each instantaneous map during the studied interval).

To quantify the homogeneity of the spatial structure of maps over time, the correlation coefficient (similarity) score between all maps during the ST-T interval was proposed. To estimate the smoothness of the curve of changes in the total current, the shape of this curve is analyzed. The duration (in% to the total duration of the ST-T

#### **Figure 11.**

*Distribution maps of CDV of a healthy volunteer (left) and pie charts (right) of depolarization: a) interventricular septum (phase 1), b) anterior wall and apex of the left ventricle (phase 2), c)lateral wall of the left ventricle (phase 3), d) basal myocardium (phase 4), e) ventricular repolarization (ST-T).*

interval) of the section of this curve from its beginning to the inflection point, i.e., to the moment of the beginning of its monotonic growth (ADur) is determined. The higher the Scor value and the lower the Adur value, the more similar the CDV maps are within the ST-T interval and the higher the homogeneity of the repolarization process as a whole. Decreases in similarity score values and increases in Adur almost always occur due to the changes at the initial part of the ST segment. The duration of one initial site corresponds to the time during which some areas of the myocardium are in a later phase of the transmembrane action potential compared to neighboring areas. In other words, the duration of this section reflects the degree of regional heterogeneity of repolarization.

Finally, the time dependence curve of the correlation coefficient of the current map with the map at the apex of the R wave during the ORS complex is investigated. *Unshielded Magnetocardiography in Clinical Practice: Detection of Myocardial Damage… DOI: http://dx.doi.org/10.5772/intechopen.104924*

**Figure 12.**

*Influence curves of the correlation coefficient of the current map with a map on the top of the tooth R: in healthy volunteer; b) in patients with a large MI.*

In other words, the degree of similarity of each current map with the map at the top of the tooth R, i.e., with the map in which the value of the total current is greatest. The correlation coefficient between all maps during the QRS—CcorQRS complex is calculated. The shape of the correlation curve of the current map with the map at the top of the R wave is also analyzed. Normally, this curve has 3 characteristic inflection points (**Figure 12a**)—between the first phases of depolarization, the 2nd and 3rd phases, and 3th and 4th phases. In pathology, these points, especially 1 and 3 are smoothed or completely absent (**Figure 12b**).

The calculation of the above set of temporal and spatial features is based on a key electrophysiological concept—the increase of electrical heterogeneity (heterogeneity) of the myocardium in the occurrence of pathological processes, such as ischemia.

In our opinion, one of the main ways to increase the functional efficiency of magnetocardiography is to build systems for automatic classification of magnetocardiograms based on the ideas and methods of machine learning and pattern recognition.

We have developed a method for analyzing CDV maps during ST-T intervals based on pattern recognition.

Correlation analysis was used to classify each current density map. The main idea of the method of current density distribution map classification based on correlation analysis is to find and compare the correlation coefficients of the map under analysis with each of the maps in the reference set. Reference sets consist of pre-classified by the doctor current density distribution maps, each of which belongs to one of the groups corresponding to a certain state of the cardiovascular system. For each of the classified maps, the correlation coefficients of the vector of values and the vector of directions with the corresponding vectors of each of the maps from the reference set are calculated as follows [10]:

$$\begin{aligned} \mathbf{r} &= \sum \mathbf{ni} = \mathbf{1}(\mathbf{xi} - \mathbf{x}^{\frown})(\mathbf{yi} - \mathbf{y}^{\frown})\sum \mathbf{ni} = \mathbf{1}(\mathbf{xi} - \mathbf{x}^{\frown})2\sqrt{\sum \mathbf{ni}} \\ &= \mathbf{1}(\mathbf{yi} - \mathbf{y}^{\frown})2\sqrt{(\mathbf{1})\mathbf{r}} = \sum \mathbf{i} = \mathbf{1}\mathbf{n}(\mathbf{xi} - \mathbf{x}^{\star})(\mathbf{yi} - \mathbf{y}^{\star})\sum \mathbf{i} \\ &= \mathbf{1}\mathbf{n}(\mathbf{xi} - \mathbf{x}^{\star})2\sum \mathbf{i} = \mathbf{1}\mathbf{n}(\mathbf{yi} - \mathbf{y}^{\star})2 \end{aligned} \tag{1}$$

Where *n* is the dimension of the vectors, for our case *n* = 100,

*xi*, and *yi* are values of vectors for which the correlation coefficient is calculated and x—x– , and y—y– are the mean values of the vectors, calculated as follows:

$$\mathbf{x}^{--} = \mathbf{1} \mathbf{n} \sum \mathbf{i} = \mathbf{1} \mathbf{n} \mathbf{x} (2) \mathbf{x}^{-} = \mathbf{1} \mathbf{n} \sum \mathbf{i} = \mathbf{1} \mathbf{n} \mathbf{x} \mathbf{i} \tag{2}$$

*Clinical Use of Electrocardiogram*

$$\mathbf{y}^{\leftarrow} = \mathbf{1} \mathbf{n} \sum \mathbf{i} = \mathbf{1} \mathbf{n} \mathbf{y} \mathbf{i} (3) \mathbf{y}^{\leftarrow} = \mathbf{1} \mathbf{n} \sum \mathbf{i} = \mathbf{1} \mathbf{n} \mathbf{y} \mathbf{i} \tag{3}$$

After that, the values of the obtained correlation coefficients for two vectors are multiplied; thus, the resulting correlation coefficient is obtained, which takes into account both the modulus correlation and the direction of the current density vectors. As a result, a set of the resulting correlation coefficients with the maps of each group of the reference set is obtained for each map. After that, an array of *m* maximum values of the resulting correlation coefficient is formed for each group, and their average value is found. Thus, for each CDDM we obtain a set of key-value pairs with the groups corresponding to the state of the cardiovascular system as keys, and the above described average values of the maximum correlation coefficients as corresponding values. The maximum of these values indicates the group to which the map of the distribution of the current density to be classified should be assigned. The best result was obtained for *m* in the range of 1–5, and the accuracy of classification in these cases is highest and does not significantly depend on the number of maximum values; therefore, in this study, we use *m* = 3.

One of the methods for pattern classification is the k-nearest neighbor (k-NN) rule. It classifies each unlabeled object according to the majority label of its k-nearest neighbors in the training set. Despite its simplicity, the k-NN rule often yields competitive results and in certain domains, when cleverly combined with prior knowledge, it can help to solve even quite difficult classification tasks.

The result of k-NN classification depends significantly on the metric used to compute distances among different feature vectors. In [11], it was shown that using different distances for k-NN classification gives an opportunity to decrease the error rates for different classification problems, such as face recognition, spoken letter recognition, and text categorization. It was also demonstrated that a k-NN classifier with a correctly chosen distance metric shows better results, even when compared to SVM used for same classification tasks.

In this study, the three most commonly used metrics, which are special cases of Minkowski distance, Eucledian, Cityblock, and Chebychev, were examined. Let us consider X as a 1-�-32 feature vector of a classified CDDM and Y as a feature vector of each CDDM in the training set. In our study, binary classifiers with three different distance metrics were developed. A classifier with an Eucledian metric distance between two points Xs and Yt, whose coordinates are values of X and Y, respectively, is defined as follows:

$$\text{d2st} = \left(\text{xs} - \text{yt}\right)\left(\text{xs} - \text{yt}\right)\left(\text{4}\right)\text{dst2} = \left(\text{xs} - \text{yt}\right)\left(\text{xs} - \text{yt}\right) \tag{4}$$

For Cityblock (also known as Manhattan) metric:

$$\text{dst} = \sum \mathbf{j} = \mathbf{1} \mathbf{n} \mathbf{x} \mathbf{s} \mathbf{j} - \mathbf{y} \mathbf{t} \mathbf{j} (\mathbf{5}) \text{dst} = \sum \mathbf{j} = \mathbf{1} \mathbf{n} |\mathbf{x} \mathbf{s} \mathbf{j} - \mathbf{y} \mathbf{t} \mathbf{j}| \tag{5}$$

where n is the size of vectors X and Y, and in our case *n* = 32–number of features. For Chebychev metric:

$$\text{dst} = \{\text{xsj} - \text{ytj}\} \tag{6}$$

2142 current density distribution maps were analyzed, which were assigned to 6 different groups depending on the verified diagnosis of the patient. These maps amounted to 6 basic databases of reference images. Each of these databases includes maps that are most specific to a particular disease.

*Unshielded Magnetocardiography in Clinical Practice: Detection of Myocardial Damage… DOI: http://dx.doi.org/10.5772/intechopen.104924*


#### **Figure 13.**

*Correlation coefficients for the consecutive CDV maps relative to the reference base of maps for each of the 14 categories.*

These groups are as follows: normal, left ventricular hypertrophy (LVH), noncoronary heart disease, microvascular disease, myocardial infarction, and coronary heart disease (coronary heart disease) other than MI. In turn, the norm group is divided into 2 subgroups, the LVH group—into 3 subgroups, and the coronary heart disease group—into 6 subgroups. Thus, in the end, we have 14 categories. Correlation coefficients were calculated for the current map relative to the reference base of maps for each of the 14 subcategories.

Next, the results of the classification of individual consecutive maps on the ST-T interval were averaged for the entire ST-T interval. As a result, we obtain the probabilities of belonging to a particular magnetocardiographic examination in each of the 14 categories for each MCG examination (**Figure 13**).

In this case, the highest probability of belonging to the category of coronary heart disease, subcategory 1
