doi:10.6062/jcis.2015.06.01.0091 V. R. Batista 45 J. Comp. Int. Sci. (2016) 7(2):45-54 http://epacis.net/jcis/PDF_JCIS/JCIS-0109.pdf jcis@epacis.net ©2016 PACIS (http://epacis.net) PAN-AMERICAN ASSOCIACION OF COMPUTATIONAL INTERDISCIPLINARY SCIENCES First Steps to Automatic Interpretation of Electroencephalograms Val´erio Ramos Batista 1 Federal University of ABC, St Andr´e - SP, Brazil Received on May 25, 2016 / accepted on July 25, 2016 Abstract In this paper a hypnogram generator fully written in Matlab/Octave programming languages is intro- duced. The software presented in this paper extracts data from brainwaves during sleep and then classifies wave stretches according to their predominant frequency. Differently from other programs, which rely on blackheavy numerical data analyses, our approach is the plain shape analysis of the waves. For this purpose we focus on properties of the waves that are purely geometrical. The result is a fast and reliable algorithm that was implemented with only 135 lines of source code. Keywords: Image processing, shape analysis, electroencephalograms. 1. Introduction The early history of Electroencephalography (EEG) is composed of many important names from Medical and Biological Sciences, specially Physiology and Psychiatry. Here we give a very brief blackdescription: in 1875 Richard Caton made the first electrical measurements of small mammals’ brains. He could not record these measurements, which was later achieved by Vladimir Pravdich-Neminskii in 1913. The first machine dedicated to measuring and recording such electrical activities was finally invented in 1924 by Hans Berger, and he was also the first who applied it to humans. Details about the history of EEG can be found in [1, 2, 3]. In this work we deal with EEGs recorded blackduring sleep and our databank is described in [4, 5]. They are supposed to cover the blackentire average sleep period of 8h. This is because many disorders can only be properly studied if compared with the so-called normal cases (see [6] for details). Figure 1 shows a standard graph of sleep stages. Mental disorders like amnesia, schizophrenia and Tourette syndrome deviate from the normal sleep cycle. The hypnogram is a helpful tool in the diagnosis of such disorders. In [7] the authors introduced a nomenclature of sleep stages classified as REM and NREM, which stand for rapid and non-rapid eye movement, respectively (see Figure 1). They can be interrupted by very brief periods of wakefulness indicated by W in the picture. Until 2007 the types of NREM were classified as I, II, III and IV, which correspond to light, intermediate, deep and very deep sleep, respectively. Since 2007 the American Academy of Sleep Medicine incorporated IV into III, but here we shall keep the distinction for the sake of detailing. At REM we have a so-called paradoxical sleep because the brainwaves attain 8-12Hz, namely the frequency of alpha waves, which also characterise the most relaxed awake state. Beta waves predominate at W and their frequency ranges within 12-27Hz. 1 E-mail: valerio.batista@ufabc.edu.br