This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
A detailed explanation of the proposed algorithm, which includes FECG signal extraction and FHR and MHR detection, are presented in this chapter. In order to validate the algorithm, the implementation using Matlab (script) and Simulink (block) are also described.
Algorithm for off line processing
A new algorithm has been developed for this work in order to process multiple-lead or two-lead with the possibility to process single-lead abdominal signal. The FECG signal extraction consists of four stages. The First stage is preprocessing which involves removal of the DC signal and base line wander using zero mean and bandpass filter. The second stage is the maternal peak detection, together with the formatting of the MQRSW. The third stage is to extract the fetal signal using ANC technique. In the fourth stage, the postprocessing technique is scaled down the MQRS complexes in the extracted signal by applying the window signal created in the second stage.
The FHR and MHR detection techniques, which are threshold-free, can be performed in two steps. First step is to design the moving interval according to the minimum and maximum RR intervals of the normal FHR and sampling frequency. In the second step the first fetal peak is detected, at the same time the moving interval is updated in order to detect the next fetal peaks. Finally, criteria about amplitude and backward search are settled to correct false detections (overlapped peaks) using window signals. The developed algorithm is illustrated in Figure 4.1 and discussed in detail in the following subsections.
Figure 4. 1 Stages and steps of the proposed algorithm
The preprocessing stage consists of the removal of the DC signal, baseline wander and the power line interference. The observation signals X1, X2 and X3 in the preprocessing stage are acquired from the maternal abdomen.
Where Xn is the observation signal. In order to remove the DC of the signal, each observation signal is made zero mean by applying
Baseline wander is caused by the patient's breathing or movements during recording. The frequency of the baseline wander due to breathing is in the range of 1 Hz and the EMG noise (artifacts of muscular contractions) is characterized by relatively high frequency noise. Hence the recorded signals (data) were passed through FIR hamming bandpass filter with the cutoffs at 40 Hz and 4 Hz which is the bandwidth of interest for FECG monitoring. The frequency response of this band pass filter is shown in Figure 4.2.
Figure 4. 2 Frequency response of the bandpass filter
The evaluation of the preprocessing stage can be performed by comparing the input signal with the filtered signal. Figure 4.3 clearly present the ability of this stage to remove or suppress the unwanted frequencies. The input signal (AECG) is shown at the (a) and the same signal after pre-processing is shown at the (b) of the Figure 4.3.
Figure 4. 3 (a) AECG signal and (b) preprocessed signal
Maternal Peak Detection
The MQRS peaks are used to create the MQRSW and calculate the MHR. For this purpose a new amplitude threshold-free detection algorithm is developed. In order to create the MQRSW the filtered Y2 (illustrated in Figure 3.4) signal is used to detect its MQRS peaks. The MQRS peaks detection algorithm depends on the maternal RR intervals of the normal MHR and sampling frequency as shown in Figure 4.4.
Normal heart beat
Max. & min. RR Intervals
Moving interval edges
First peak detection
Updating moving interval
Detecting the next peaks
Figure 4. 4 Block diagram of the MHR detection algorithm
Figure 4.5 shows an example of the maternal RR moving interval and its relation with the MHR which should be calculated earlier. In addition to the normal MHR, the implementation of this algorithm depends also on the sampling frequency. The maximum normal MHR is around 100 beats per minute (BPM) and the minimum is around 60 BPM. The sampling frequency is chosen to be 256 Hz in this work. The RR interval and its double can be calculated as follows:
Therefore, the maximum normal RR interval is about 250 samples (its double is 500 samples) and the minimum is about 150 samples (its double is 300 samples).
Figure 4. 5 The Maternal RR moving interval
The RR intervals are ranged between 150 - 250 samples, and the range of double RR interval is 300 - 500 samples for a sampling frequency of 256 Hz. Hence in Figure. 4.5, the maximum RR interval is shown at the top, the minimum RR interval at the bottom and between them an example of medium RR interval.
Let all maximum, medium and minimum RR intervals start at the same starting peak MP (i), then the starting point of the moving interval (SMI) is chosen to be to account for the QRS complex after the detected peak by 17 samples. The end point of the moving interval (EMI) must be in a location that is greater than the location of the peak (A) of the maximum RR interval and smaller than double the minimum RR interval or before Peak (B). Thus the EMI is chosen to be equal to. Within these limits only one peak (A, C, or D) can be detected in every moving interval (MI) as shown in Figure. 4.5. Detecting the peak in the MI is executed by taking the maximum,
Once the peak is detected, the MI will be shifted forward after the detected peak by 17 samples for SMI and by 290 samples for EMI in order to detect the next peaks between the edges of every new moving interval. The principle of the peak detection is illustrated in Figure 4.6. This principle does not require any previous knowledge about the peak threshold making the detection of low computational complexity and robust.
Figure 4. 6 Maternal peak detection using MI.
The RR interval, i.e. the reciprocal of the heart rate of the kth cycle is defined as
and the MHR can be calculated as
where = 256 Hz is the sampling frequency.
At the same time the same method can be applied to detect the (negative) minimum maternal signal points of index that are downward deflections (Q or S) of the maternal QRS complex in every RR interval by
Creation of MQRS Window
The main difficulty in the fetal extracted signal is the residual MQRS peaks especially that are (which are) overlapped with the fetal peaks. Many techniques are proposed previously aiming at optimal solution to separate the maternal residual peaks. In this algorithm a new enhancement technique is developed, that is the MQRS window (MQRSW). The design of this MQRSW depends on the maternal peaks detected in the previous stage, where the indexes of these peaks are used as a center of MQRSW. The MQRS complex is captured within a MQRSW, which is defined by taking 13 samples before, and after every detected maternal peak found in the input signal Y2. Figure 4.7 explains how the components of MQRS complex inside the MQRSW are captured and remain components outside the MQRSW are eliminated (zero padded).
The MQRS complex interval, which is represented by the MQRSW, is given by:
where s =13 is the number of samples as shown in Figure 4.8 and the window signal can be defined as:
where is the peak index.
i = i+1
Y2(i-s) = 0
i = 0
h = âˆž
i > h
i > h + 2s
Figure 4. 7 Flow chart for the formation of the MQRSW
Figure 4. 8 An example of MQRSW
FECG Extraction Technique
Adaptive filters minimize the difference between the output signal and the desired signal by altering their filter coefficients (Jimenez et al. 2000). One of the main applications of adaptive filters is noise removal using adaptive noise canceling (ANC).
In ANC, the goal is to remove the noise signal from the measured signal by using a reference signal that is highly correlated with the noise signal. Figure 4.9 shows the ANC system implementation for the FECG extraction. A signal FECGp is transmitted over a channel to a sensor that also receives a noise MECGp, pïƒŽ [2,3] uncorrelated with the signal. The combined signal and noise form the primary input to the canceller. A second sensor receives a noise uncorrelated with the signal but correlated in some unknown way with the noise. This sensor provides the reference input to the canceller.
Figure 4. 9 Adaptive noise canceller system
The and (,) are the signals acquired from the maternal abdomen. The noise is filtered to produce an output that is as close a replica as possible of. This output is subtracted from the primary input to produce the system output.
where is the output of the adaptive filter. Squaring both sides of Equation (4.9)
Applying expectations on both sides of Equation 4.10
As is uncorrelated neither with nor with then the last term is zero. Finally,
The goal of the adaptive filter is to minimize the mean square error (MSE) of. This can be obtained iteratively to give the optimal solution when. If one knew the characteristics of the channels over which the noise was transmitted to the primary and reference sensors, it would theoretically be possible to design a fixed filter capable of changing into. The filter output could then be subtracted from the primary input, and the system output would be the signal alone.
However, the characteristics of the transmission paths are as a rule unknown or known only approximately and are seldom of a fixed nature, hence the use of a fixed filter is not feasible. Moreover, if a fixed filter were feasible, its characteristics would have to be adjusted with a precision difficult to attain, and the slightest error could result in an increase in output noise power. An adaptive filter differs from a fixed filter in that it automatically adjusts its own impulse response. Adjustment is accomplished through an algorithm that responds to an error signal dependent, among other things, on the filter's output. Thus with the proper algorithm, the filter can operate under changing conditions and can readjust itself continuously to minimize the error signal.
After extraction using ANC, it is noted that the maternal residual peaks are still observed, which means that it is still difficult to detect the fetal peaks. Hence an effective enhancement technique is required to enhance the fetal extracted signals by attenuating other interfering components.
After ANC the fetal extracted signal corrupted with the maternal residual peaks is fed to the postprocessing stage for enhancement. This stage consists of the following parts:
A. The MQRS scaling down window
The MQRSW is created as described in Section 4.2.3. Two scenarios are developed to enhance the fetal signal: first apply the MQRSW as MQRS removal window and second apply the MQRSW as MQRS scaling down window. The scaling down version is used in this work to avoid removing the maternal peaks, which are overlapped with fetal peaks, which need to be detected later.
An example of the scaled down signal is shown in Figure 4.10(b). The window signal is used to attenuate the maternal residual peaks in the fetal extracted signal. If equals to zero, then the fetal extracted signal remains the same. If the samples of are non zero, then the corresponding samples in the fetal extracted signal are scaled down by multiplying them by 0.1.
Figure 4. 10 (a) the window signal and (b) scaled down signal
B. IIR notch filtering
After scaling down the maternal residual peaks in the extracted signal, a small amount of baseline wander has been observed. Therefore, a second order IIR notch filter centered at 1 Hz is used to attenuate this baseline wander. The following transfer function is used for the filter:
To provide the required noise attenuation, the value of is chosen Î² to be 0.85. Figure 4.11 shows the frequency response of the IIR notch filter.
Figure 4. 11 Frequency response of IIR notch filter
C. Adjustment of the maternal QRS amplitude
The resulting signal from the previous stage is normalized and made absolute in order to apply the fetal peak detection algorithm. The amplitudes of the maternal and the fetal overlapped peaks in the extracted signal need to be adjusted, to keep all amplitudes of the maternal peaks shorter than those of the fetal peaks. The first step is to get the maximum value (mv) between adjacent maternal peaks. Once the maximum has been detected, the amplitude of the adjacent maternal peaks in the extracted signal are adjusted to be 0.75 * mv. The maternal (M) and the possible overlapped (F+M) peaks (labeled with black stars) in the extracted fetal signal are adjusted as shown in figure 4.12(c).
Figure 4. 12 (a) the window signal, (b) fetal signal and (c) fetal
signal with adjusted maternal peak amplitudes.
FHR Detection Algorithm
The principle of the fetal peak detection is based on the normal fetal heart beat, fetal RR interval and the sampling frequency similar to the maternal peak detection in section 4.2.2. The FHR of interest is between 93 to 180 bpm, Therefore the maximum normal RR interval is about 164 samples (its double is 328 samples) and the minimum is about 85 samples (its double is 170 samples).
Before explaining the detection algorithm, the moving interval should be defined as illustrated in figure 4.13.
The maximum RR interval is represented at the top of figure 4.13 and the minimum RR interval is represented at the bottom. In between the other RR intervals within the frequencies of interest are shown. Assume the first fetal peak FP(i) and its index (i) is used to define the moving interval (MI). The SMI is chosen to be, that is after the QRS complex of FP(i). The EMI must be in a location that is greater than the location of the peak (A) of the maximum RR interval and smaller than double the minimum RR interval or before Peak (B), thus the EMI is chosen to be.
Figure 4. 13 The moving interval for peak detection
Within these limits only one peak (A, C, D or E) can be detected. Detecting the peak in the MI is executed by taking the maximum value within the interval,
After the (A, C, D or E) is detected, by MI. The next peak is detected by using similar MI starting at five samples after the peak. In this way the fetal peaks are detected without using amplitude threshold.
Peak Position Corrections
The extracted overlapped peaks are usually shifted around the original peak because of the MQRS complex overlapped with the FQRS complex. In order to correct the possible presence of overlapped peaks, a new correction criterion based on the window signal is developed. After peaks detection, overlapped peaks which are shifted from their locations are corrected. All fetal peaks detected in Figure 4.14 (b) should have value (x=2) for the same index in Figure 4. 14 (c), if the value of the same index in Figure 4. 14 (a) is equal to zero. The fetal peaks detected in Figure 4. 14 (b) should have value (y=1.45) for the same index in Figure 4. 14(c), if the value of the same index in Figure 4. 14 (a) is not equal to zero. The indexes of all value (y) are corrected if the difference between RR intervals more than two samples before and after (y) as shown in Figure 4. 14 (c).
Figure 4. 13 Peak position corrections
ALGORITHM IMPLEMENTATION USING SIMULINK
The proposed algorithm discussed in Section 4.2 has also been implemented under MatlabÂ®/SimulinkÂ® for on-line FHR monitoring. Simulink model was created using the blocks from Simulink Library and the blocks embedded with Matlab function. The full simulink model is shown in Appendix E. the main parts are discussed in detail as follows.
The preprocessing stage consists of the removal of the DC signal, baseline wander and the power line interference. Each observation signal is made zero mean by applying Equation 4.1. For this purpose, an add/subtract block and a mean block are copied into the model as shown in Figure 4.15.
The leftmost block in Figure 4.15 represents the three recorded abdominal signal which are saved in a computer file. The output of the zero mean function is connected to the MUX block to split the ECG channels. Each ECG channel is then connected to the digital bandpass filter as described in Section 4.2.1. This stage is then ended by the buffering block of 1280 samples (equal to 5 seconds) as shown in Figure 4.15.
Figure 4. 14 Preprocessing stage
Maternal Peak Detection
The preprocessing stage is ended with buffer block and connected to Data Type Conversion blocks to work with data in double precision format. Y1, Y2 and Y3 are the preprocessed signals. Then two blocks are dragged from Simulink library: first block is for the maternal peak detection and second block for creation of the MQRSW, which come in successive stages. In order to execute the maternal peak detection stage, Embeded Matlab Function 1 is used as shown in Figure 4.16. The input to this block is the filtered signal from Y2 of the preprocessing stage. The Embedded Matlab Function 1 executes the detection of the maternal peaks Mp, their indices im and the MHR as discussed in Section 4.2.2.
Figure 4. 15 Simulink Blocks for the window processing stage.
Creation of MQRS window
The window creation stage depends directly on the peak indices. The Embedded Matlab Function 2 in Figure 4.16 is used to execute the MQRSW creation task as described in 4.2.3.
FECG Extraction Technique
The ANC technique discussed in section 4.2.4 has been implemented here using Simulink to extract the FECG. In this stage the adaptive filter RLS blocks are connected to the preprocessing stage for FECG extraction as shown in Figure 4.16. The filtered signal from Y1 is fed as reference signal to the input port of the RLS Filter 1 and 2. At the same time, Y2 is fed to the Desired ports of the RLS Filter 1 and to the Y2 port of the Embedded Matlab Function 1 in Figure 4.16. Y3 is fed as Desired signal to the desired port of the RLS Filter 2 in Figure 4.16
The output of this stage is the fetal extracted signal, which comes out from the Error port. All the other variables from each block are maintained for processing in the following blocks.
This stage is applied to the fetal extracted signal by ANC to enhance the fetal extracted signal before fetal peak detection stage. Postprocessing stage is shown in Figure 4.17 together with the fetal peak detection stages, which are all explained as follows.
A. Scaling Window Signal
All codes in this stage are implemented using. Embedded Matlab Function 3 as shown in Figure 4.17 to apply the signal Xw to scale down the fetal extracted signal, from Error port of the RLS Filter 1. The principle of scaling down stage depends on the samples values of Xw (if it is zero or non zero) as in Section 4.2.5 A
Figure 4.16 Simulink blocks for postprocessing and fetal peak detection stages
B. Notch filtering
After scaling down the maternal residual peaks in the extracted signal, a small amount of baseline wander has been observed. Therefore, a second order IIR notch filter centered at 1 Hz is used to attenuate this baseline wander. In Figure 4.17, Embedded Matlab Function 4 performs the characteristics of the notch filter.
C. Maternal peak amplitude adjustment
After the signal is filtered by 1 Hz IIR notch filter, the amplitude of the maternal peaks in the fetal extracted signal (FECG2) would have to be adjusted by Embedded Matlab Function 5 in Figure 4.17 as described in section 4.2.5 C.
Amplitude Threshold Free Peak Detection
In Figure 4.17, Embedded Matlab Function 6 performs the fetal peak detection. The adjusted fetal signal from the output port (FECG3) of the Embedded Matlab Function 5 is fed to the input port (FECG3) of the Embedded Matlab Function 6 in order to detect the fetal peak. The principle of the fetal peak detection is explained in section 4.2.6. After the peak detection, the detected fetal overlapped peaks are corrected as explained in section 4.2.7. Finally, the calculated FHR can be monitored at the output port (FHR) of the Embedded Matlab Function 6.
The development of the algorithm, which includes FECG signal extraction, FHR and MHR detection, are presented. Firstly, the algorithm was implemented using Matlab 7.4 (Section 4.2). Secondly, the algorithm was implemented under Matlab simulink, in order to be used on line as well as in real time (Section 4.3). The complete implementation of this algorithm under Matlab simulink, and the complete flow chart of this algorithm are given in Appendix C.