Berk SOYSAL 180206053
1
EE434 Biomedical Signal Processing Project
Article: An Algorithm for EMG Noise Detection in Large ECG Data
(P Raphisak, SC Schuckers, A de Jongh Curry)
Abstract
Electrocardiogram recordings (ECG)
are valuable for researchers. However;
some sections of the recorded ECG may
be corrupted by electromyogram (EMG)
noise from muscle.
An electromyogram (EMG) is a test
that is used to record the electrical activity
of muscles. When muscles are active,
they produce an electrical current. This
current is usually proportional to the level
of the muscle activity.In order to obtain
clear ECG signal, EMG noise needs to be
detected and filtered before performing
data processing.
In this project, an automated
algorithm for detecting EMG noise in
large ECG data is presented. The
algorithm extracts EMG artifact from the
ECG by using morphological operations.
1. Introduction
Electrocardiography (ECG ) is the
recording of the electrical activity of the
heart. An ECG is used to measure the
heart’s electrical conduction system.
In this project, a fast aIgorithm for
detecting EMG noise is implemented
which uses morphological filters. It has
low computational complexity therefore it
can be applied in massive ECG
collections.
2. Methods
2.1 Morphological Operations
Morphological filters have been
widely used in the field of image
processing. It has applications in filtering
unwanted shapes of the signal while
leaving the other parts of signal
unchanged. The fundamental operations
of morphological filters is accomplished
by erosion and dilation operations.
The erosion of the binary image A by the
structuring element B is defined by:
The erosion of the dark-blue square by a
disk, resulting in the light-blue square.
The dilation of A by the structuring
element B is defined by:
The dilation of the dark-blue square by a
disk, resulting in the light-blue square with
rounded corners.
Opening and closing are two operations,
defined in term of erosion and dilation.
Opening is defined as erosion followed by
dilation while closing is dilation followed
by erosion.
The morphological filter is constructed
based on these operations and illustrated
in Fig. 1.
Fig. 1. Diagram of morphological filter
Berk SOYSAL 180206053
2
2.2 Algorithm
EMG is produced by muscle
electrical activity. In recorded ECG; EMG
interference appears as rapid fluctuations
which vary faster than ECG waves.
EMG noise in the ECG can be
detected by the developed EMG
detection algorithm. The algorithm is
described & follows.
Fig. 2. EMG Detection Algorithm
1. Extracting EMG noise: Impulsive
noise, such as EMG can be separated
from ECG by using morphological filter
with a dome-like structuring element
which is smaller than ECG waves. The
EMG noise can be retrieved back by
subtracting the output of the
morphological filter from the input ECG.
2. Suppressing QRS: The output from
the EMG extraction morphological filter
contains EMG noise and partial QRS
complexes which need to be suppressed.
By using the beat detection algorithm, the
QRS complexes can be located and
suppressed by squaring.
3. Moving Averaging: A moving average
filter is used to obtain the envelope of the
EMG noise.
4. Thresholding: In order to remove any
components of ECG signal thresholding
is used.
3. Results
Fig. 3. Extracting EMG noise
Fig. 4. Suppressing QRS & M.Averaging
Fig. 5. Thresholding & EMG Detection
Berk SOYSAL 180206053
3
%% Berk Soysal EE434
close all;
% EMG signal construction
r = 0.03*randn(length(newdata),1);
t = 0.019*randn(length(newdata),1);
r(500:2000)=0;
t(1:2000)=0;
r(3000:4170)=0;
t(3500:4170)=0;
x=newdata+r+t; % ECG Signal Corrupted by
EMG Signal
subplot(4,1,1);plot(x); title(' ECG Signal
Corrupted by EMG Signal' );
SE=[0, 1, 0;1,1,1;0,1,0 ]; % Structuring Element
for Morphological Operations
x2 = imopen(x,SE); % Opening
x3 = imclose(x2,SE); % Closing
subplot(4,1,2);plot(x3); title(' ECG Signal After
Morphological Operations' );
% QRS Detector
x4 = diff(x3);
x4= diff(x4);
x4=x4.*x4;
subplot(4,1,3);plot(x4); title('QRS Compressed' );
for i=1:length(x4)
if ( x4(i) > 0.001 ) x5(i) =1;
else x5(i)=0;
end
end
%Moving Average Filter
movav=ones(200,1)/200;
x6=conv(movav,x5);
for i=1:length(x6)
if ( x6(i) > 0.001 ) x7(i) =0.3;
else x7(i)=0;
end
end
subplot(4,1,4); plot(x7); axis([0 length(x7) 0
0.5]);title('Detected EMG Noise Regions');
figure;plot(x); hold on
plot(x7,'r'); axis([0 length(x7) -0.2 0.5]);
title('Detected EMG Noise Regions');
4.Conclusion
In this project, a fast EMG detection
algorithm was explained in detail. EMG is
extracted by two steps. First, a
morphological filtering was operated,
second EMG and QRS complexes were
extracted. Then, QRS complexes were
detected and suppressed. EMG was
detected by setting a threshold on its
moving average. Moving average size
and threshold value are 200 seconds and
0.001, respectively.
The algorithm achieved 100%
detection rate on the sample ECG signal.
Computational complexity of the
algorithm is very low therefore it would be
very convenient in medical cloud
applications.
5.References
[1] Sun Y, Ramires FJ, Weber KT. Fibrosis of
atria and great
vessels in response to angiotensin II or
aldosterone infusion.
Cardiovascular Research July 1997;35( 1): 138-
147.
[2] Raphisak P, de Jongh Curry A, Malkin RA,
Schuckers
SC. Heart rate variability in rats with aldosterone-
induced
chronic heart failure. IEEE Engineering Medicine
and Biology Society Annual Conference
Proceedings September
Impulsive noise suppression and
background normalimtion of electrocardiogram
signals using morphological operators. EEE
Transactions on Biomedical Engineering Febuary
1989;2(2):262-273.
[3] Chu CH, Delp EJ.
1990; 167-170.
[4] Wang D, He DC. A fast implementation of I-d
grayscale
morphological filters. IEEE Transactions on
Circuits and
Systems TI September 1994;41(9):634436.
[5] MacDonald R, Jenkins J, Anbaecher R,
Throne R. A
software trigger for intracardiac waveform
detection with
automatic threshold adjustment. Computers in
Cardiology
2003;1:228-231.
Berk SOYSAL 180206053
4

Biomedical project report detecting emg noise

  • 1.
    Berk SOYSAL 180206053 1 EE434Biomedical Signal Processing Project Article: An Algorithm for EMG Noise Detection in Large ECG Data (P Raphisak, SC Schuckers, A de Jongh Curry) Abstract Electrocardiogram recordings (ECG) are valuable for researchers. However; some sections of the recorded ECG may be corrupted by electromyogram (EMG) noise from muscle. An electromyogram (EMG) is a test that is used to record the electrical activity of muscles. When muscles are active, they produce an electrical current. This current is usually proportional to the level of the muscle activity.In order to obtain clear ECG signal, EMG noise needs to be detected and filtered before performing data processing. In this project, an automated algorithm for detecting EMG noise in large ECG data is presented. The algorithm extracts EMG artifact from the ECG by using morphological operations. 1. Introduction Electrocardiography (ECG ) is the recording of the electrical activity of the heart. An ECG is used to measure the heart’s electrical conduction system. In this project, a fast aIgorithm for detecting EMG noise is implemented which uses morphological filters. It has low computational complexity therefore it can be applied in massive ECG collections. 2. Methods 2.1 Morphological Operations Morphological filters have been widely used in the field of image processing. It has applications in filtering unwanted shapes of the signal while leaving the other parts of signal unchanged. The fundamental operations of morphological filters is accomplished by erosion and dilation operations. The erosion of the binary image A by the structuring element B is defined by: The erosion of the dark-blue square by a disk, resulting in the light-blue square. The dilation of A by the structuring element B is defined by: The dilation of the dark-blue square by a disk, resulting in the light-blue square with rounded corners. Opening and closing are two operations, defined in term of erosion and dilation. Opening is defined as erosion followed by dilation while closing is dilation followed by erosion. The morphological filter is constructed based on these operations and illustrated in Fig. 1. Fig. 1. Diagram of morphological filter
  • 2.
    Berk SOYSAL 180206053 2 2.2Algorithm EMG is produced by muscle electrical activity. In recorded ECG; EMG interference appears as rapid fluctuations which vary faster than ECG waves. EMG noise in the ECG can be detected by the developed EMG detection algorithm. The algorithm is described & follows. Fig. 2. EMG Detection Algorithm 1. Extracting EMG noise: Impulsive noise, such as EMG can be separated from ECG by using morphological filter with a dome-like structuring element which is smaller than ECG waves. The EMG noise can be retrieved back by subtracting the output of the morphological filter from the input ECG. 2. Suppressing QRS: The output from the EMG extraction morphological filter contains EMG noise and partial QRS complexes which need to be suppressed. By using the beat detection algorithm, the QRS complexes can be located and suppressed by squaring. 3. Moving Averaging: A moving average filter is used to obtain the envelope of the EMG noise. 4. Thresholding: In order to remove any components of ECG signal thresholding is used. 3. Results Fig. 3. Extracting EMG noise Fig. 4. Suppressing QRS & M.Averaging Fig. 5. Thresholding & EMG Detection
  • 3.
    Berk SOYSAL 180206053 3 %%Berk Soysal EE434 close all; % EMG signal construction r = 0.03*randn(length(newdata),1); t = 0.019*randn(length(newdata),1); r(500:2000)=0; t(1:2000)=0; r(3000:4170)=0; t(3500:4170)=0; x=newdata+r+t; % ECG Signal Corrupted by EMG Signal subplot(4,1,1);plot(x); title(' ECG Signal Corrupted by EMG Signal' ); SE=[0, 1, 0;1,1,1;0,1,0 ]; % Structuring Element for Morphological Operations x2 = imopen(x,SE); % Opening x3 = imclose(x2,SE); % Closing subplot(4,1,2);plot(x3); title(' ECG Signal After Morphological Operations' ); % QRS Detector x4 = diff(x3); x4= diff(x4); x4=x4.*x4; subplot(4,1,3);plot(x4); title('QRS Compressed' ); for i=1:length(x4) if ( x4(i) > 0.001 ) x5(i) =1; else x5(i)=0; end end %Moving Average Filter movav=ones(200,1)/200; x6=conv(movav,x5); for i=1:length(x6) if ( x6(i) > 0.001 ) x7(i) =0.3; else x7(i)=0; end end subplot(4,1,4); plot(x7); axis([0 length(x7) 0 0.5]);title('Detected EMG Noise Regions'); figure;plot(x); hold on plot(x7,'r'); axis([0 length(x7) -0.2 0.5]); title('Detected EMG Noise Regions'); 4.Conclusion In this project, a fast EMG detection algorithm was explained in detail. EMG is extracted by two steps. First, a morphological filtering was operated, second EMG and QRS complexes were extracted. Then, QRS complexes were detected and suppressed. EMG was detected by setting a threshold on its moving average. Moving average size and threshold value are 200 seconds and 0.001, respectively. The algorithm achieved 100% detection rate on the sample ECG signal. Computational complexity of the algorithm is very low therefore it would be very convenient in medical cloud applications. 5.References [1] Sun Y, Ramires FJ, Weber KT. Fibrosis of atria and great vessels in response to angiotensin II or aldosterone infusion. Cardiovascular Research July 1997;35( 1): 138- 147. [2] Raphisak P, de Jongh Curry A, Malkin RA, Schuckers SC. Heart rate variability in rats with aldosterone- induced chronic heart failure. IEEE Engineering Medicine and Biology Society Annual Conference Proceedings September Impulsive noise suppression and background normalimtion of electrocardiogram signals using morphological operators. EEE Transactions on Biomedical Engineering Febuary 1989;2(2):262-273. [3] Chu CH, Delp EJ. 1990; 167-170. [4] Wang D, He DC. A fast implementation of I-d grayscale morphological filters. IEEE Transactions on Circuits and Systems TI September 1994;41(9):634436. [5] MacDonald R, Jenkins J, Anbaecher R, Throne R. A software trigger for intracardiac waveform detection with automatic threshold adjustment. Computers in Cardiology 2003;1:228-231.
  • 4.