WT, STFT and WMSD S An Automatic Sleep Spindle D etector based on

— Sleep spindles are the most interesting hallmark of stage 2 sleep EEG. Their accurate identification in a polysomnographic signal is essential for sleep professionals to help them mark Stage 2 sleep. Sleep Spindles are also promising objective indicators for neurodegenerative disorders. Visual spindle scoring however is a tedious workload. In this paper three different approaches are used for the automatic detection of sleep spindles: Short Time Fourier Transform, Wavelet Transform and Wave Morphology for Spindle Detection. In order to improve the results, a combination of the three detectors is presented and comparison with human expert scorers is performed. The best performance is obtained with a combination of the three algorithms which resulted in a sensitivity and specificity of 94% when compared to human expert scorers.


I. INTRODUCTION
LEEP spindles (SS) are particular EEG patterns which occur during the sleep cycle.They resemble an AM/FM sinusoid with center frequency in the band 11 to 15 Hz and they are used as one of the features to classify the sleep stages [1].Sleep spindles are promising objective indicators for neurodegenerative disorders [2].In this work, three methods are used to find SS, Short Time Fourier Transform (STFT), Wavelet Transform (WT) Wave Morphology for Spindle Detection (WMSD).These methods are then combined in the pursuit of a better SS detector.In section 2, a brief description of Sleep Spindles and their characteristics is presented.A survey in the state of the art regarding SS detection is presented.The methods are then explained and basic statistical measures used to compare algorithms' performances are presented.In section 3, results of applying the SS detectors to a EEG signal, previously scored by two human experts are presented.Conclusions are made about differences in performance from the three algorithms.
It is shown that the proposed algorithms perform well in the Sleep Spindle detection task.

A. Sleep Spindles (SS)
It is commonly referred in literature that sleep spindles are the most interesting hallmark of stage 2 sleep electroencephalograms (EEG) [1].A sleep spindle is a burst of brain activity visible in an EEG and it consists of 11-15 Hz waves with duration between 0.5s and 2s in healthy adults, they are bilateral and synchronous in their appearance, with amplitude up to 30 µV (Fig. 1).The spindle is characterized by progressively increasing, then gradually decreasing amplitude, which gives the waveform its characteristic name [3].It is now accepted that sleep spindles are originated in the thalamus and can be recorded as potential changes at the cortical surface [4].Sleep EEG measures seem promising as objective indicators in neurodegenerative disorders, including dementia, where sleep changes appear to be an exaggeration of changes that come normally with aging.

B. State of the Art
There are several publications related to sleep spindle automatic detection.Most of them make use of two or more detection algorithms, which combined provide best results.It is not easy to compare results, as authors tend to publish different statistical measures of the performances.The use of sensitivity, specificity and accuracy are however the most common, but, rarely the authors publish all these statistical measures.

S
An approach for the automatic detection of SS based upon the Teager Energy Operator and Wavelet Transform was presented in [5].These two features were integrated into a spindle detection algorithm with a reported accuracy of 93.7%, without reference to sensibility or specificity.
In [6], STFT and Wavelet Transform were used.After the detection, Teager Operator is applied to determine the duration of the spindle.True localization is reported to be 92%, without references to other statistical measures of the performance.
An automated spindle detection using AR modeling for feature extraction was proposed in [7].Multilayer Perceptron and Support Vector Machine are used as classifiers for comparison.Performances were reported as 93.6% for the MLP and 94.4% for the SVM classifiers.
In [8] an artificial neural network based on the Multi-Layer Perceptron architecture was used for detecting SS in band-pass filtered EEG's.Following optimum classification schemes, the sensitivity of the network ranges from 79.2% to 87.5% and false positive rate ranges from 3.8% to 15.5%.
A SS detection algorithm based on decision tree was proposed in [9].After analyzing the EEG waveform, the decision algorithm determines the location of sleep spindle by evaluating the outputs of three different methods namely: STFT, Multiple Signal Classification algorithm and Teager Energy Operator.A 96.17% sensitivity and 95.54% specificity is reported.

C. Short Time Fourier Transform (STFT)
The use of STFT is commonly used in signal processing [11].
The STFT of a discrete signal is: , .
The magnitude squared of the STFT yields the spectrogram of the signal: An example of detection of SS using STFT and corresponding spectrogram can be seen in Fig. 2. It is clear the presence of peak in the spectrogram (t=0.5s and f=15Hz), corresponding to a SS.

D. Wavelet Transform (WT)
In this method, the detection of sleep spindles employ the continuous wavelet transform of EEG signal x(t): where Ѱ (t) is called the 'mother wavelet', the asterisk denotes complex conjugate, whereas a and b are scaling parameters [12].The corresponding normalized wavelet power is defined by: , , / , and σ is the standard deviation of the EEG segment used.Complex Morlet WT was used.In Fig. 3 a SS is detected using the normalized wavelet power (dashed line).

E. Wave Morphology for Spindle Detection (WMSD)
The WMSD algorithm proposed in this paper is based on the definition of Sleep Spindle by Rechtschaffen and Kales [13] which states: "The presence of a sleep spindle should not be defined unless it is of at least 0.5sec duration, i.e., one should be able to count 6 or 7 distinct waves within the half-second period.Because the term "sleep spindle" has been widely used in sleep research, this term will be retained.The term should be used only to describe activity between 12 and 14 cps." The WMSD algorithm was for the first time published by the authors in [14].The implemented algorithm consists of: a) Detection of peaks in the signal (maxima and minima), based on a defined threshold, thus, eliminating small peaks; b) Determination of extreme to extreme time distance and conversion to frequency: 1 ; (5) c) Verification if the determined frequencies lie in the SS range (11-15 Hz); d) If there are more than 12 consecutive peaks (6 maxima and 6 minima) in the SS frequency band a spindle is marked.
The whole process mimics the visual detection mechanism.An example of a SS detected using this algorithm can be seen in Fig. 4, where the SS is marked between t=0.6s and t=1.1s.The peaks above the threshold limit are marked with a '*', the ones which also satisfy the frequency criteria are marked with a '•'.

F. Mixed detection using WT, STFT and WMSD, the ALL algorithm
In this work, after the SS has been detected using WT, STFT and WMSD algorithms, mixed results were computed.
In this approach, we use a vector to characterize the signal (same length as the sampled signal).This vector defines each point as belonging to a SS or not.The mixed result is computed, i.e., a point is considered belonging to a SS if it is marked as SS in WT, STFT and WMSD algorithms.
Finally, if there are not enough consecutive points marked as belonging to a SS, in order to last at least 0.5 seconds, they are considered as non-spindle.We now address it as the ALL algorithm.

G. Statistical Measures
In order to assess the validity of results, the algorithm was applied to the data and results compared with visually scored signal.Measures were taken, namely true positive (TP), false positive (FP), true negative (TN) and false negative (FN) events.
A TP result is counted when a sample was scored as a spindle by the automatic method and the expert simultaneously.A TN result is set when a correct decision of absence of spindle was made.
If the automatic result indicated a presence of spindle and there was no spindle visual scoring, a FP result was counted.On the opposite, if the output indicated no spindle whereas the expert scored some, a FN result was counted.[15] Sensitivity, specificity and accuracy are defined as: .
In [16] a comparison of the threshold choice is presented based on a EEG signal partly scored by a human expert.In this work, however, several values have been used in order to obtain representative curves of the sensitivity vs specificity relationship.

III. RESULTS
This study makes use of a sample representative of human sleep, obtained from healthy male volunteers: 18 sets comprising 3 minutes each.Briefly, all polysomnograms were performed in an 18-channel analog NIHON-KOHDEN polygraph with 12 bit digital conversion (STELLATEs RHYTHM V10.0), recorded with 128Hz resolution [17].
Sleep was visually scored according to RK [13].From a screen display of C3-A2 channel, two specialists scored all concordant spindles, using the RK68 spindle definition.
The detection methods were applied with a combination of threshold parameters for the STFT, WMSD and WT algorithm.In the STFT case, the threshold value corresponds to the cumulative value of peaks in the spectrogram.In the WMSD algorithm, a point is considered a maximum peak if it has the maximal value, and was preceded (to the left) by a value lower than the threshold defined.The Normalized Wavelet Power amplitude is used as threshold in the WT case.
In STFT, WMSD, WT and ALL algorithms.It can be seen that there is a trade-off between these two measures, the higher the sensibility, the lower the specificity and vice-versa.For a better performance comparison, threshold values have been chosen so that sensitivity equals specificity.For the STFT algorithm a sensitivity of 90.9% and a specificity of 90.9% were achieved.Using the WMSD a sensitivity of 91.5% (specificity of 91.5%) was achieved.The WT performed at a sensitivity and specificity of 92.8%.The ALL algorithm produced, as expected, the best results with a sensitivity and specificity of 94.0%.

IV. CONCLUSION
The overall performance of the implemented methods is good; changing the thresholds can lead to sensitivity next to 100%.However, high values of sensitivity lead to a decrease in specificity.This low value in specificity is due to higher values in False Positives.Both STFT and WMSD produced good results in sleep spindle detection.Sensibility and specificity for these algorithms is around 91%.The WT performed slightly better around 93% sensitivity and specificity.When the combination of the previous detection algorithms was used, detection performance improved to a sensitivity and specificity of 94%.The combination of methods lead to better results by eliminating some False Positives, not compromising the True Positives; thus improving specificity with minor changes in sensitivity.

Fig. 2
Fig. 2 Example of SS detection using STFT

Fig. 3
Fig. 3 Example of SS detection using WT

Fig. 4
Fig. 4 Example of SS detection using WMSD