EEL5934 BioSignals Processing

hopefulrebelΤεχνίτη Νοημοσύνη και Ρομποτική

24 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

102 εμφανίσεις

FLORIDA ATLANTIC UNI
VERSITY

EEL5934

Bio
Signals Processing


EEG Signal Processing


S
e
i
zure Detection


By:

Wilfredo Rivas
-
Torres

Roxana Melendez


Professor: Dr.
Erdol





2



Table of Contents


0bjective:

................................
................................
................................
................................
.......................

3

Analysis Outline:

................................
................................
................................
................................
...........

3

Part 1: Analysis using fixed frame length spectrogram

................................
................................
................

4

Comments on the results:

................................
................................
................................
.........................

9

Part 2: AR Filter Order Estimate

................................
................................
................................
..................

10

Comments:

................................
................................
................................
................................
..............

11

Part 3: Spectral Error Measure using the Whitening method

................................
................................
....

12

Comments on the results:

................................
................................
................................
.......................

17

Pa
rt 4. Wigner
-
Ville distribution spectrogram

................................
................................
............................

18

Comments on the results:

................................
................................
................................
.......................

19

Appendix A: Fixed Frame Spectrogram Matlab Code

................................
....

Error! Bookmark not defined.

Appendix B: AR Filter Order Study Code

................................
........................

Error! Bookmark not defined.

Appendix C: SEM Fixed Frame Method Code

................................
................

Error! Bookmark not defined.

Appendix D: Wigner
-
Ville Distribution Code

................................
.................

Error! Bookmark not defined.

References:

................................
................................
................................
................................
.................

22


3


0bjective
:

The objective of this project is to develop code for
the analysis o
f EEG (electro
-
encephalogram)
signal
s
for
the detection of
the onset and end time of
epileptic seizures.


Introduction:

The EEG
signals are

commo
nly recorded using the 10/20
standardize system for
electrode location
s
. The recorded EEG signal
s

have amplitud
es that vary from a few µV
to approximately 100 µV and a frequency range from 0.5 Hz to 40 Hz.

While there is
some level of debate as to whether the EEG signals exhibit stochastic or
deterministic
characteristics,

our approach is to consider them

a stochas
tic signal
s
.


Analysis Outline:


The following analyses are performed as part of this report, more details are provided in
each section.


1. Fixed frame length spectrogram

2
. AR filter order estimate via filter order swept analysis

3
.
Spectral Error Measur
e using the Whitening method

4.
Wigner
-
Ville distribution

spectrogram


Physionet data used:

The following summarize
s

the data used in
the

analyses
which

was obtained at
www.physionet.com.


File Name

chb02_15.edf

chb02_16+.edf

chb12_24.edf

chb12_23.edf

Sta
rt Time

8:31:38

10:50:23

13:06:45

12:06:43

End Time

9:31:38

11:50:23

14:06:45

13:06:43

Seizure 1

None

Start: 2972 s


End: 3053 s

None

Start: 253 s


End: 333 s

Seizure 2







Start: 425 s


End: 522 s

Seizure 3







Start: 630 s


End: 670 s


Table

1
: Physionet Data
Records
Analyzed


Notice that we have selected two records that include seizures and two records that do
not include seizure. There are only two patients
considered
; which are identified as
chb02 and chb12.


4


Part

1: Analysis using fixed frame length spectrogram


The concept behind the
fixed frame length spectrogram

is to observe the PSD (power
spectral density) versus time. This type of analysis provides information not only of the
spectral content of the EE
G sign
al, it also provides when in time the different spectral
components of the signal occur. This type of analysis is thought to show both the
conditions for the onset and subsequent

seizure events. This is possible because the
PSD of the EEG signal is
t
h
ought

to change during a seizure event.


The Matlab code used to perform this analysis is shown in Appendix A.
The code has a
user input section of which the frame duration (tframe) and the frame overlap
percentage (overlap) are of special interest in this repo
rt. The code is run
for default
values of tframe=10 sec and overlap=80%.


Comments
:



1.

The decimation factor (dec) was set to three (3). The PSD
therefore includes

frequencies up to 46.67 Hz (sr/2/dec) which covers the frequencies of interest in
EEG

signals
.


2.

The frame length was set to 10
seconds;

this works well because the seizure
events reported in the data all lasted more than 10 seconds with the shortest
duration being 40 seconds.


3.

The
FP1
-
F7

signal was selected from the Physionet records to be studied

in this
part of the project.

5


Results:


File:chb_02_15.edf








6


File:chb_12_24.edf










7


File:chb_02_16+.edf










8


File:chb_12_23.edf










9


Comments on the results:


1. The results for chb02_15.ed
f and chb12_24.edf (non
-
seizure) rec
ord show some
areas with a broadband response (such as that pointed by th
e blue arrows in the
chb02_15.ed
f results).

The following charts show the EEG signal just before the
blue arrow location (440 to 450 s) and the location near where the arrow points to

(460 to 470 s):








Notice that in th
e lower

time frame
shown
the signal is in fact higher amplitude
and higher frequency. The origin of this high frequency could be related to
artifacts related to other physiological events that got picked up by the

EEG
electrodes but this is just a conjecture.


2.
The spectrogram for the chb02_16+.edf file ha
s

frequency components at close to
4 Hz and it
s

harmonic
s

(up to the 9
th

harmonic). This is an outstanding feature
since it happens before the seizure that actu
ally is reported on Physionet to start
at 2972 s, in the record but these extraneous frequencies “disappear” around
10


2700 s, which is more than 4 minutes before the seizure is reported to start.
Remarkably there is no observable special feature during the s
eizure that can
easily be observed on this spectrogram.


3. The ch12_23.edf spectrogram

show
a

only some weak 16 Hz and 32 Hz signal in
the early portion of the records

that are visible
. This is remarkab
le because for this

record the 3 seizures occurred ear
ly
in the record
(between 253 s and 6
70 s) and
the expectations were that some event would be recorded in the EEG signals.


4.

There is no appreciable difference between the two windows used in the
spectrograms, namely Hamming and Gaussian. In the rest of
this report we use
the Hamming window.


5
.

The spectrogram technique could be used to detect

the “onset” of

epileptic
seizure events using the
FP1
-
F7

signal based on our results mentioned in #2.
However this is a conjecture based on a single sample. It wou
ld be interesting to
research this further
, including

looking at other EEG signals and records to get a
firm grasp if this is a clear tendency.



Part 2: AR Filter Order Estimate



In part 3 of this project autoregressive (AR) modeling will be used. The mo
del
parameters
can be
estimated using the aryule()
or arburg()
function
s

in Matlab.
The
se

function
s

also provides the model prediction error which is to be as low as
possible. In practice after a certain order the reduction in error is negligible and may
e
ven increase (i.e. after certain orders there are diminishing returns). The question is
what is the correct order? In order to study this in the EEG framework the
chb02_15.edf record will be used. The intention is to sweep the order and record the
predicti
on variance versus filter order.


The Matlab code used to plot the AR mod
el variance versus filter order is included in
Appendix B.

The results of this analysis are shown on the next page.


11





Comments:



Notice that for orders greater than
20

(see data m
arked on the plot) the variance
does not change much. This gives a reasonable value for setting the AR filter
order to use in the analyses. In an abundance of extra caution and because only
one record was studied the order will be set at 5
0

for the rest of

this project.

The
aryule() function will was also selected since it provide the least intense
computing resources even though the Burg AR modeling method provides smaller
variance. If the computing resources were not an issue then arburg() could be the
pr
eferred option if it can be proven that it provides a better spectrum
representation of the original data than aryule().



12


Part 3:
Spectral Error Measure using the Whitening method


In this part of the project techniques that divide the EEG signal into se
gments of similar
spectral characteristics are explored. The basis of these methods can be found in
reference [1] chapter 3. The basic idea behind this method is to find a quantitative and
compact

metho
d to describe the entire EEG record. Of particular int
erest are brief
physiological events that occur in the signal that may be overlooked.

This method
requires a reference and a test window. An estimate of the error in the reference is
obtained and compared to the error estimate in the test window. A “dissim
ilarity
measure” between the two windows is then computed and the test window slides to the
next frame.

The methodology uses a variable frame boundary for the test signal, i.e.
during the dissimilarity measure the test frame is increase and compared to the

reference frame until a threshold (η) is exceeded.


The algorithm described above is in fact searching for an indicator of non
-
stationary
behavior as indicated in reference [2].
S
egment boundaries
also
need to take into
consideration (see ref.
[
1
]

pp
.

127)

that any activity remain stationary for at least one
second and the change in the signal statistics needs to be abrupt in order to detect a
change.
These requirements clearly put significant pressure on the developer to come
up
with a clear criterion

as t
o the boundaries of the different segments. For example see
Figure 3.26 of reference [1], it clearly shows that the measure of dissimilarity can cross
the threshold (
η) but because it is not an abrupt change it does not trigger a new
segment boundary.



In this report a
variation to the method describe in reference [1]

(section 3.5.2)

is
proposed and tested.

The proposed method starts by observing
Figure 3.26 of
refere
nce [1],

here a reference window is reset each time the signal crosses the
threshold in a abrupt fashion and is of a constant length. It is not clear how the length of
this window is established or how the validity of any reference frame was established
(i
.e. stationarity). In order to resolve the reference window issue a record from a patient
in which no seizure was report will be used as the baseline to establish the reference
frame. The idea behind this is the
posteriori

knowledge that no seizure occurre
d during
the reference frame since this record does not contain any seizures. Furthermore the
method will explore a variable reference frame, the idea being that if a maximum frame
length is reach the frame can be established in confidence since non
-
statio
nary effects
were not detected within this frame.

In the event that an abrupt dissimilarity is detected
the reference frame length is limited to this length of time.
The method is applied per
patient so there will be one reference frame per patient.


The
Spectral Error Measure (
SEM
)

fixed frame method is based on the parametric
estimation of AR (autoregressive) power spectra (see Firure 3.27 reference [1]). Once a
spectral change occurs in the n
th

frame, the output of the AR filter is no longer
a
white
pro
cess. Assuming th
at

the order of the AR filter has been chosen appropriately (see
part 2 of this report) to describe the reference window, the prediction error variance
2
e


13


can be estimated using the aryule() function in Matlab.

Using t
his error variance the
quadratic spectral error measure


n
2


is defined as:










2
2
2
2
,
2
1
,
2
1
























d
n
e
S
d
n
e
S
n
j
e
e
j
e


The new method uses th
is

SEM measure for each fixed frame length of the test record.
Based on the average and standard deviation of the

SEM color coded graphs of the
traces in the test record
are

generated.


The Matlab code used to plot the SEM fixed frame method is included in Appendix C.
The results again are shown for those records shown in Table 1.


Comments:


1.

The decimation factor
(dec) was set to three (3).


2.

The reference frame length will have a variable length depending on the signal
up to a maximum of one minute. The one minute l
imit was set rather arbitrarily to
make sure it did not cover the entire record length.


3.

The frame l
ength
for the test record
was set to 10 seconds.


4.

The
FP1
-
F7
, F7
-
T7, T7
-
P7, and P7
-
O1 signals were selected from the Physionet
records to be studied in this part of the project.


5.

Test Record Traces are plotted below. The collow code identify the area in wh
ich
the SEM was either within acceptable range (green), in an ambiguous range
(yellow) and in a range in which the SEM is beyond a reason value to consider
the process properly characterized as being a white output (red).



The limits are:



Green

SEM
n



M
ean⡓EM⤫N⁓楧ma

ve汬ow


an⡓EM⤫NY

p楧ma

卅p
n
< Me
an(SEM)+2

Sigma

Red

SEM
n




an⡓EM⤫O

p楧ma


乯keW

qhe獥⁶a汵l猠浡s⁳ em⁴o⁩ d楣慴e⁴ha琠瑨e pbM⁤楳瑲ibu瑩tnf⁴he⁦牡mes
楳igau獳楡s⸠䥮 fa捴 楴i楳ino琠and no a瑴emp琠wa猠made 瑯 楤en瑩fy 瑨e a捴c
al
d楳瑲ibu瑩tn 瑹pe⸠qhe mean and 獴snda牤r dev楡i楯i猠a牥r u獥d only a猠a
mean猠瑯 au瑯ma瑥 瑨e de捩獩on 汥le氠獥瑴楮g 楮i a 牡瑨e爠a牢楴牡特 way a琠
瑨楳⁰oin琮


14


Test
A

Results
.

Record
#1: chb02_15.
edf, reference, non
-
seizure

Record #2: chb
02_16+.
edf
, tes
t record


Reference Frame
Variance

(
2
e

)




Spectral Error Measure


15




Test Record Traces



Test B Results.

Record #1: chb12_24.edf, reference, non
-
seizure

Record #2: chb12_23.edf, test record


Reference Frame Variance

(
2
e

)


16




Spectral Error Measure



Test Record Traces






17


Comments on the results:


1.

The results for
both patients show the method is
partially

successful. The met
h
od
did not succeed in pointing out exactly the time frame in which each seizure
hap
pened but it did identify the general area (see the red marked frames).


2.

In observing the results for Test A this patient was reported to have a seizure
starting at 2972 s that ended at 3053s. The method did not turn any of the traces
studied red in this p
eriod of time but before and after this period there are areas
of red so in the “general time” period some abnormal activity was detected.


3.

The results for Test B show the method was actually quite successful. It detected
all three areas in which seizures
were reported on Physionet. It did however on
some of the traces report other areas in red that were not reported as seizures
which could indicate another physiological process was detected or some issue
with a probe.


4.

Based on these results there are two
areas of concern with this method. First the
exact levels at which to declare a seizure are not well defined and based on the
mean and standard deviation of the SEM. The other area of concern is what
actually is a good reference frame
, while checking for d
issimilarities using the
SEM seems to prove effective there is no way in an automatic process to detect
this until after the data is actually looked at. These issues preclude this and any
other methodology discussed in reference [1] based on SEM from becom
ing a
clinically accepted methodology.


5.

A general discussion of AR modeling can be found in appendix F.



18


Part 4
. Wigner
-
Ville distribution spectrogram


Wigner
-
Ville distribution

(WVD)

is a very useful tool when we need to analyze time
-
frequency represent
ations of non
-
stationary signals. The
Wigner
-
V
ille distribution
graphical appearance is very similar to a signal’s spectrogram. The definition is :



The general idea is to compare the results of the common spectrogram with
the
WVD

of the signal. As we kn
ow, if we want to get better resolution i
n frequency
domain, we should
increase the number of

points

in
the
time domain. But the
challenge, with the application of this kind of distribution, is really to
create a
distribution with as many points in the tim
e domain
, h
aving the same reso
lution in
the frequency domain!

This works ‘’IN THEORY’’, but the implementation needs
some research.


The WVD approach used in this report follows closely that developed by
Boashashand and Black, see reference [3].
Therefore
, for EEG processing,
M
atlab
code can be created in order to calculate the
Wigner
-
V
ille distribution of
an

EEG
signal

(see appendix E).


Test A:
Record
chb02
_16+.edf






19


Test B:
Record
chb12
_23.edf




Comments

on the results
:

-

The
W
igner
-
V
ille distributi
on a
pproach
used in this report follows closely that
developed by Boashashand and Black, see reference [3].


-

Actually, th
e idea was to process by using Wigner
-
V
ille distribution method and
see what’s the difference between the spectrogram resulting from t
he AR
modeling and the
W
igner
-
V
ille spectrogram. Well, at first sight both spectrogram
shows

the same results, and we can’t see a significant difference. What can be
done
in the future is to make some “
trial’’ with others EEG signals and see the
results fo
r the respective spectrograms.


20









21







22


References:


1.

Leif Sornmo and Pablo Laguna
,


Bioelectrical Signal Processing in Cardiac and
Neurological Applications


,

Elsevier Academic Press, 2005.


2.

G. Bodenstein and H
.M. Praetorius, “Feature extraction

from
electroencephalogram by adaptive segmentation”, Proc. IEEE, vol. 65, no. 5, pp.
642


652, 1977


3.

B. Boashashand P. Black
,


An efficient real
-
time implementation of the Wigner
-
Ville distribution”, IEEE T
ransaction on

A
coustics
, S
peech
,
and

S
ignal
P
roc
essing
,
vol
. ASSP
-
35, NO. 11, N
ovember

1987. pp. 1611
-
1618