Ran Zhang,Linfeng Sui,Jinming Gong,Jianting Cao
EEG-based real-time diagnostic system with developed dynamic 2TEMD and dynamic ApEn algorithms 10.3389/fphys.2023.1165450
EEG data analysis,dynamic,2TEMD,ApEn,real time,diagnostic system
In real-time electroencephalography (EEG) analysis, the problem of observing dynamic changes and the problem of binary classification is a promising direction. EEG energy and complexity are important evaluation metrics in brain death determination in the field of EEG analysis. We developed two algorithms, dynamic turning tangent empirical mode decomposition to compute EEG energy and dynamic approximate entropy to compute EEG complexity for brain death determination. The developed algorithm is applied to analyze 50 EEG data of coma patients and 50 EEG data of brain death patients. The validity of the dynamic analysis is confirmed by the accuracy rate derived from the comparison with turning tangent empirical mode decomposition and approximate entropy algorithms. We evaluated the EEG data of three patients using the built diagnostic system. The experimental results visually showed that the EEG energy ratio was higher in a coma state than that in brain death, while the complexity was lower than that in brain death.
EEG-based real-time diagnostic system with developed dynamic 2TEMD and dynamic ApEn algorithms 10.3389/fphys.2023.1165450

In real-time electroencephalography (EEG) analysis, the problem of observing dynamic changes and the problem of binary classification is a promising direction. EEG energy and complexity are important evaluation metrics in brain death determination in the field of EEG analysis. We developed two algorithms, dynamic turning tangent empirical mode decomposition to compute EEG energy and dynamic approximate entropy to compute EEG complexity for brain death determination. The developed algorithm is applied to analyze 50 EEG data of coma patients and 50 EEG data of brain death patients. The validity of the dynamic analysis is confirmed by the accuracy rate derived from the comparison with turning tangent empirical mode decomposition and approximate entropy algorithms. We evaluated the EEG data of three patients using the built diagnostic system. The experimental results visually showed that the EEG energy ratio was higher in a coma state than that in brain death, while the complexity was lower than that in brain death.

Brain death is strictly defined as the complete, irreversible, and permanent loss of brain and brainstem function (Beecher, 1969). Previous research on the determination of brain death has focused on the field of clinical medicine. However, the clinical practice of brain death determination requires specialized physicians to perform a large number of rigorous compliance tests, including tests related to apnea tests that require the removal of the ventilator; there are certain risks in it and even cases of death have occurred (Marks and Zisfein, 1990). Therefore, it is crucial to use advanced signal-processing methods for electroencephalography (EEG) to provide reliable and objective scientific criteria that can support the clinical judgment in brain death determination. Among the methods used to determine brain death from EEG signals, energy and complexity metrics are effective for EEG characterization and have shown excellent results in EEG signal classification, such as brain death determination (Shi et al., 2011) (Cao and Chen, 2008) and epilepsy detection (Sharma et al., 2018). To address these issues, empirical mode decomposition (EMD) (Huang et al., 1998), multivariate empirical mode decomposition (MEMD) (Rehman and Mandic, 2010) (Zahra et al., 2017), and turning tangent empirical mode decomposition (2TEMD) (Fleureau et al., 2010) of the intrinsic mode function (IMF) have been shown to be useful for extracting statistical features of EEG (Djemili et al., 2016). Some methods for analyzing complex signals have also been proposed for EEG analysis, complex empirical mode decomposition (CEMD) (Tanaka and Mandic, 2007), and improved eigenvalue decomposition of Hankel matrix–Hilbert transform (IEVDHM-HT) (Sharma and Pachori, 2018). 2TEMD shows the best overall performance among EMD, MEMD, and 2TEMD in processing EEG (Miao and Cao, 2017) and was more suitable for brain death determination. Complexity is a measure of the stochasticity of a time series. A higher complexity indicates greater randomness in the sequence. Approximate entropy (ApEn) (Pincus, 1991) is a stochastic complexity measure that describes the self-similarity of a time series in terms of patterns. It has been applied to EEG analyses, such as the analysis of sleep EEG data (Pincus, 1991). However, 2TEMD and ApEn cannot observe the changing process of EEG analysis. To address this limitation, dynamic 2TEMD and ApEn concepts are proposed (Miao and Cao, 2018). In this paper, we have developed two algorithms, namely, D-2TEMD and D-ApEn, for the dynamic analysis of EEG signals. Comparing these algorithms with 2TEMD and ApEn algorithms, we have identified three key advantages: 1) Dynamic analysis can reduce noise and other effects, thereby improving the accuracy and reliability of the results. 2) Dynamic EEG analysis can help doctors observe changes in brain activity and assess and predict patients’ vital signs. 3) Real-time diagnosis systems based on dynamic algorithms can perform calculations while collecting EEG data, thereby saving time and reducing risk in patients. Based on D-2TEMD and D-ApEn algorithms, we have developed a real-time diagnostic aid system. We have demonstrated the efficacy of our system by performing binary classification of patients’ EEG as coma or brain death. Our analysis of EEG signals of a single patient involved analyzing the complexity and energy principles of EEG. We then applied the proposed system to analyze the EEG data of three patients obtained from the hospital. The patients comprised two typical cases in coma and brain death states and one special case from coma to brain death. Experimental results show that the overall trend in the distribution of EEG energy and complexity is evident in all three patients; although noise and other disturbances are present at a certain time point, it validated the effectiveness of the system and algorithm. Future studies can further validate the effectiveness of our system on a larger sample size. Additionally, there is a possibility of applying the system to other medical conditions.

The 2TEMD algorithm is a signal decomposition method that improves upon EMD. It extracts intrinsic mode functions by redefining the average trend of the signal and calculating the average envelope through interpolation between local extremal points. The IMF is then extracted using tangent line iteration. This specific process is shown in Figure 1. The signal s is decomposed into a finite set of IMFs and a residual term, where IMFs represent local oscillatory components of the signal, and the residual term r(t) represents the signal’s long-term trend and high-frequency noise. We developed the D-2TEMD algorithm, which is the extended form of 2TEMD by introducing a time window, Δt, which serves as a computation step in 2TEMD. For each Δt, we computed IMFs and empirically removed the first four high-frequency residual signals (Miao et al., 2017). The remaining IMFs were then used to analyze the EEG data and obtain a dynamic distribution of EEG energy. EEG energy was defined as the product of the power specification value in the frequency band and the corresponding recording time. For a multivariate signal with n components from T1 to T2, the D-2TEMD process is as follows: 1) Constructing an auxiliary function: We initialize the number of iterations j = 1, the number of IMFs i = 1, and the number of time steps k = 0.  2) Identifying local extrema: We compute the barycenter of random consecutive oscillation extrema and in a period of (k ⋅Δt).  3) Calculation of the mean envelope: The average signal trend is obtained by interpolating between the centers of oscillation of .  4) Extracting IMFs: We subtract from the given signal and define . We obtain the following:  Otherwise, the iteration steps from (2) to (4)are repeated. 5) Iterating to extract IMFs: We define . If the result signal is monotonous, we can get the decomposition results of signals during k ⋅Δt.  Otherwise, we repeat the iteration steps from (2) to (5). 6) We determine whether the elapsed time k ⋅Δt exceeds the end time T 2; if it does, then the process moves toward the end, and the final decomposition result is as follows:  If it does not, we move the time window and repeat the steps from step 2 to step 6.

Complexity measures based on approximate entropy have shown good performance in the statistical characterization of EEG signals. High intensity and the absence of spontaneous brain activity from quasi-brain-death EEG can be obtained by power spectral pattern analysis. It appears to have potential applications in a wide variety of physiological and clinical time series data. ApEn is a measure of the regularity or predictability of a time series. The ApEn statistics of a time series measure the logarithmic probability that runs on patterns of length m that are close to each other and will also remain close in the next incremental comparison m + 1 (Pincus and Goldberger, 1994). A higher probability of remaining close (with high regularity) results in a lower ApEn value and vice versa. Approximate entropy analysis is only carried out for a segment of the data and does not reflect the approximate entropy change process for the entire measurement time. We consider a sequence A(1,2 … ,N), for computing the ApEn (A, m, and r) (A: N-m+1, m: length of the vector series, and r: tolerance parameter) of that sequence, and let D (i, j) denote the distance between two vectors v(i) and v(j) (i and j ≤ N-m+1), which is defined as the maximum difference in scalar components of v(i) and v(j). We define C m,r (i), which is the probability of finding a vector that differs from v(i) by less than distance r. Also, ϕ m,r , the natural logarithmic average over all the vectors of the C m,r (i) probability is as follows: For m + 1, we repeat the aforementioned steps and compute ϕ m+1,r . The ApEn statistics is given by the following: ApEn is only evaluated for a specific segment of the signal and does not reflect the process of approximate entropy change. ApEn is susceptible to high-frequency electron interference present in real recorded EEG signals. Therefore, to ensure the accuracy and reliability of ApEn in full-frequency EEG signals, the D-ApEn algorithm is used, which is an extension of the existing ApEn algorithm by introducing a time variable Δt, which extends the existing ApEn analysis method on the time axis to obtain the dynamic approximate entropy algorithm (Shi et al., 2010). It can reflect the dynamic complexity changes throughout the recording time and avoid the loss of detailed information. This specific algorithm is as follows: For a time series A(Δt) of time length T, (Δt = 1, - - -, N) unit in seconds, in order to compute ApEn(A(Δt), m, and ɛ), For this sequence, a vector sequence of length m, v Δt (i) and v Δt (j), is first constructed from the signal sample A (Δt). We let denote the distance between two vectors v Δt (i) and v Δt (j) (i and j ≤ N − m + 1), which is defined as the maximum difference between the scalar components of v Δt (i) and v Δt (j). For a given threshold ɛ and vector v Δt (i), when j ≤ N − m + 1, the number of vectors v Δt (i) whose distance from v Δt (j) is less than ɛ is calculated, and then, denotes the probability that the distance from v Δt (i) is less than ɛ for all vectors v Δt (j) when j ≤ N − m + 1, denoted by the following: Repeating the aforementioned steps for m + 1 and computing ϕ m+1 (ɛ, Δt), D-ApEn is given as follows:

The D-2TEMD algorithm introduces a time window of length Δt, where Δt is a controllable parameter, shown in Figure 2. In this experiment, Δt is 1 s (i.e., 1000 sampling rate). For this time, we have designed a loop where one EEG with one Δt step is processed and stored. Also, as the time window and time step were sliding, EEG data were analyzed by applying D-2TEMD and D-ApEn algorithms to obtain the dynamic EEG energy distribution and dynamic complexity distribution in the time domain. We compared brain death determination algorithms based on EEG energy and complexity. In the comparison, we randomly selected 140 EEG datasets from 36 cases to ensure data uniformity. These included 70 coma patients and 70 brain death patients, as diagnosed by medical professionals. We randomly selected 20 EEG datasets as a standard and used the remaining 100 EEG datasets to calculate energy and complexity using 2TEMD, ApEn, D-2TEMD, and D-ApEn methods to derive accuracy measures. The EEG data were collected at a hospital in Shanghai, China, between June 2004 and March 2006, with the permission of the patients’ families. A portable EEG system (NeuroScan ESI) was used and a total of nine electrodes were selected for the examination, six exploratory electrodes (Fp1, Fp2, F3, F4, F7, and F8) were placed on the forehead, and two electrodes (A1 and A2) were placed on the earlobes as a reference, as shown in Figure 3. The EEG sampling rate was 1000 Hz, and the electrode resistance was set to less than 8 kΩ. The EEG data were supervised by a neurologist and performed by medical personnel. The 2TEMD algorithm calculates the average energy per second. m and r of the ApEn algorithm are 1000 and 1, respectively. Δt for the dynamic analysis is 1 s. We analyzed the EEG data of 20 coma patients and found the EEG energy per second ranging from 1.8 × 104 ∼ 1.8 × 105, with a complexity of about 0.3. We also analyzed the EEG data of 20 patients in a quasi-brain-dead state and found the EEG energy per second ranging from 6.2 × 103 ∼ 8 × 103, with a complexity of about 1.1. We calculated the accuracy of the remaining 100 data points using the following criteria, as shown in Table 1. Energy calculation using the 2TEMD algorithm, due to its reliance on a significant number of matrix operations, exhibits computational inefficiencies when processing longer time series data. Specifically, the processing time required to analyze 120 s of EEG data using the 2TEMD algorithm that exceeds 800 s, while the D-2TEMD algorithm requires a comparatively shorter processing time of approximately 500 s.

The system we designed consists of an EEG data acquisition device and a laptop computer. The system connections are shown in Figure 4. For the determination of brain death, the accuracy of EEG extraction is of utmost importance and the accuracy of EEG extraction is of paramount importance. Therefore, we use g.Nautilus as the experimental device. It has international standard electrode caps, more channels for us to choose from, and relatively higher measurement accuracy. Data acquisition and processing are performed in a laptop computer connected to the g.Nautilus electrode cap through the g.Nautilus unlimited-communication device.

The GUI we designed for this diagnostic system is shown in Figure 5; the top right corner can define the subject’s name and time of this acquisition, the “Recording” button is used to open the system framework and start the acquisition of EEG, and we click the “Analysis” button to start the analysis and display of the EEG data. The upper axial plot shows the raw EEG signal for each channel. The middle plot dynamically displays the average energy of all channels based on the results of D-2TEMD calculations. Each point represents the average energy per unit time Δt. The energy baselines for coma and brain death are set based on reference values calculated separately from the EEG data of 20 coma patients and 20 brain death ones, each obtained from the hospital. Finally, the axial plot at the bottom shows the average complexity of all channels, with each point representing the average complexity of Δt.

The EEG data used to calculate the criteria for coma and brain death groups, with 20 patients each, showed an average energy analysis of 1.8 × 104 and 4.96 × 103 per second, respectively, for six channels, represented as two straight lines through the GUI window. The patients were divided into coma, brain death, and from coma to brain death groups. Each point of energy and complexity in the GUI represents the average energy and complexity of the EEG data for the six channels in 1 s. We considered the average energy converging to 1.8 × 104 and the average complexity converging to 0.3 in the coma group, and the average energy converges to 4.96 × 103 and the average complexity converges to 1.1 in the brain death group. The results of the three sets of experiments are as follows. The results of EEG analysis calculated by the diagnostic system are shown in Figure 6. GUI shows the original EEG data, the calculated EEG energy after D-2TEMD, and the distribution of EEG complexity calculated by D-ApEn, which shows the characteristics of EEG from all aspects and determines the EEG state. The top coordinate system is the original six-channel EEG signal, and the other two coordinate systems are the six-channel average energy and six-channel average complexity after classification by the binary classification method. The results of the analysis showed that the dynamic energy range of EEG of coma patients was 1.8 × 104 ∼ 3 × 104 and the complexity ranged from 0 to 0.5. This is consistent with our rules for determining the characteristics of the coma state. Figure 7 shows the results of the EEG analysis of a brain death patient. This result shows that the overall dynamic EEG energy in the brain death state is close to 4.96 × 103, and the complexity distribution is between 1 and 1.5. This is consistent with our rules for determining the characteristics of the brain death state. Figure 8 shows the results of a particular EEG analysis. A few days earlier, the dynamic energy range of EEG of coma patients was 1.8 × 104 ∼ 3 × 104 and the complexity distribution was between 0 and 0.5. A few days later, the overall dynamic EEG energy in the brain death state is close to 4.96 × 103 and the complexity distribution was between 1 and 1.5. This is consistent with the rules we used to determine the characteristics of the coma and brain death state. It is worth noting that the results of the analysis during brain death occasionally fluctuated based on finding cases where it was known that drug resuscitation was used at that time. Experimental results show that the more pronounced the brain activity, the higher the EEG energy. Also, the lower the complexity, the lower the probability that the sequence will generate new patterns and it has a certain regularity and predictability. Therefore, it can be inferred that there was brain activity in the coma group, while there was almost no brain activity in the brain death group because the dynamic EEG energy distribution was significantly higher in the coma group than that in the brain death group. Furthermore, it can be inferred that brain activity rhythms were present in the EEG of the coma group, while almost disordered noise was present in the EEG of the brain death group because the complexity distribution was lower in the coma group than that in the brain death group. In addition, dynamic distribution can provide more accurate and reliable results compared to 2TEMD and ApEn. The dynamic analysis of the diagnostic system also provides a reference point for physicians by showing the process of changes in a patient’s physical characteristics. The diagnostic system may be less friendly to physicians who are not specialized in EEG signal processing, and we hope to generate a clearer and more understandable index to help physicians determine brain death in future studies.

In this paper, we develop new algorithms, D-2TEMD and D-ApEn, for the real-time EEG analysis, which can achieve EEG dynamic analyses by introducing time windows. Using the accuracy metric, they are shown to have a high degree of validity and robustness in calculating the energy and complexity changes of EEG. Our results show that D-2TEMD can easily discriminate coma and brain death patients based on the significant differences in EEG energy values. D-ApEn has an extremely high regularity and predictability, with a strong periodicity of intracerebral activity in coma patients and a complexity close to 0, a weak intracerebral activity in coma patients, mainly due to noise superposition, and a complexity close to 1 in brain-dead EEG. Our experiments further validate the effectiveness of D-2TEMD and D-ApEn algorithms, even if the results are affected by noise, etc., but the overall trend is clear. The system also includes the ability to classify other EEG signals, such as healthy subjects, sleep, and anesthesia, when sufficient sample data are available. The metrics of this system may be more complex for physicians who are not familiar with the EEG analysis. In the future, we will provide a simpler and more understandable index to assist physicians in determining brain death.