Computer Programs in Biomedicine 4 (1975) 175-179

© North-Holland Publishing Company

EEG SPECTRAL ANALYSIS FOR NOVA COMPUTERS Franz HUBER University of Colorado Medical Center, Cardiovascular Pulmonary Research Laboratory, Denver, Colorado 80220, USA

Two programs for the spectral analysis of EEG data are presented. Both are designed to be independent of any particular I/O environment. The implementation of the programs on different Nova configurations is therefore easily accomplished. Spectral analysis EEG analysis

Nova computer Abstract I/O modelling

1. Introduction The application of electroencephalography for clinical diagnosis and for research is becoming more diverse and widespread as the difficulties in recording and processing are overcome. The use of computers for spectral analysis of EEG data increased enormously after the introduction of the Fast Fourier Transform algorithm [ 1]. Software systems for extensive analysis of EEG data have been developed by many for their specific computer configurations. Some systems have been reported in the literature [ 2 - 5 ] . They are rather involved and the implementation for different hardware necessitates reprogramming. There is very little exchange of programs between users of Nova computers. The reason appears to be the wide variety of I/O equipment and the custom designed interfaces we find in different laboratories. An effort was made to create a spectral system that can be implemented on any Nova computer configuration with a minimum of reprogramming. The variety of I/O devices encountered in modern laboratories is handled by abstract I/O modelling [6].

2. Description of programs The system consists of two programs called CNT and CNPL. Both are written in the relocatable as-

sembly language of the Nova computers. The Compressed Spectra Technique [5] is used for the graphical representation of the power spectra. According to this technique each power spectrum is plotted slightly above the previous spectra. Lines hidden by previous peaks are removed in order to create a three-dimensional effect. The resultant plots clearly show reproducibility and trends. See fig. 1.

Fig. 1. Output of program CNT. Each tic mark represents 2 Hz 2.1. Program C N T

The flow of the program CNT is shown in fig. 2. This program calculates the power spectral intensity function, which represents the mean square value of intensity of an EEG record as a function of frequency. The computation is performed in the following steps: (1) Digitizing and storing N equally spaced samples

176

F. Huber, Spectral analysis for Nova computers START "~ 'I

LI

I ASK QUESTIONS SET SCALE FOR OUTPUT TAPE ID MESSAGE O -~TRF

ZINP~ FFTIO[ READCH ] SAMPLEINTO ]

,

ZINP

I

,

TRANSFORM BUFFERI

FFT]O (2 EPOCHS)I

I I

HANN UNSCRAMBLE SQUARE -l-"TRF

HALT

|

READ CH I SAMPLE INT0 ZINP GET 2 EPOCHS

~START

PLB

SUMMJ

NEW PAGE'

DRAW AXIS

WAIT ON TAPE I ADD SPECTRUM TO AVERAGE

I

ZERO AVERAGE I BUFFER

( ~

IPLOT

[

IGRAPHAVERAGEI

IREMOVEHIDDEN| I

WAIT UNTIL INPUT BUFFER

HALT@ I

s FULL

LINES

I

I TAPE AVERAGE I ADJUST FOR NEXT GRAPH

IREADJUST GRAPHI I SCALE(Y) I I(OR RESTART I

I

PROGRAM)

;{ 4 ]

I

Fig. 2. Flow of program CNT. of EEG Xi. (2) Computing the Fourier transform using the F F T algorithm

zk

N-1 = (l/N) ~ xiexp(-]27rik/N ) i=0

k = 0 , 1. . . . . N - 1 .

(3) Applying a Hanning window to the raw Fourier transform by the convolution

~-k= !

+

--~Zk-1 ½Zk -- ¼Zk+l (4) Computing the power spectral intensity function as the absolute value squared: Izk 12 k = 0, 1. . . . . N - 1 . The duration between samples in milliseconds (MSEC) and the length of the sample buffer (LBUFF) can be set at assembly time. The rest of the parameters is then given by: epoch length = MSEC* LBUFF/1000 (in seconds) frequency range of spectra = 0-½ of sampling fre-

F. Huber, Spectral analysis for Nova computers quency resolution of spectra = 1/epoch length length of program ~ 47008 + 5*LBUFF 8 + I/O handlers Data are processed and results are presented continuously at the fastest possible rate. If fast output devices are used, the program runs on-line. A check is incorporated to halt the computer in the case of data being lost. However, this halt instruction can be deleted in order to run the program with slower devices. Usually an average of a number of power spectra is desired in order to improve the statistical variability or to analyse data longer than one epoch [7]. The program allows to compute such an average. It is this average that will be recorded on mass storage for off line plotting. Provisions for recording identifying messages are made. 2.2 Program CNPL

I ASK SET

FOR~

QUEST,OHS

SCALES GRAPHICAL OUTPU T A ~

l

1

HALT

O-'tASK P0R A ST00¥ HO.l

[,A -ST00 HO. 1

~ SAGE

The flow of the program CNPL is shown in fig. 3. This program is used to replay studies that were previously recorded by program CNT. For this purpose a CRT is used as output device. For hard-copies the program is run with a digital plotter as output device.

177

GRAPH DATA REMOVE HI DDEN LINES

ADJUST FOR NEXT GRAPH

Fig. 3. Flow of program CNPL.

3. Hardware and software specifications The programs are designed to operate on a Nova computer with almost any kind of peripheral environment. In our laboratory the system is run on a computer configuration as shown in fig. 4. The programs do not depend on any particular monitor system. Multiplying and dividing are carried out by software. If hardware for these operations is available, then these can be used to replace their counterparts. All I/O requests are made by calling on abstract I/O models, called channels. These are: Channel 1 analog input Channel 2 graphical output Channel 3 output onto mass storage Channel 4 console I/O The calls to these channels are of the form: JSR @lOOP number of parameters

channel number operation code parameter 1

parameter n The link between the calls and the actual devices used for the realization of the channels is established by the program module IOOP. Both programs use the same abstract I/O models and a complete description of their behaviour is given in the program listings. In order to implement the system for a different environment, only the environment module IOOP has to be rewritten. A listing of the IOOP module used by the author is furnished to serve as a guide for new implementations. This module will be easily devised if I/O routines exist to perform the various operations. For these cases the module reduces to a translation program between the calls to the I/O channels and the calls

17 8

l I0+A/D CHANNELS L SIGNAL p CONDITIONING I

F. Hu bet, Spectral analysis for Nova computers

SYKES ] COMPUC /ORDER

NOVA

Ioo

1200 ISWITCHES

8K

.~TEKTRONIX I 601 CRT

I ! I I

j HOUSTONI N I STRUMENTI COMPLOT• Fig. 4. Block diagram of hardware configuration.

to the appropriate driver routines.

4. Operation

Operator interaction with the program CNT affect only the size of the graphical representation of the results. As the program is started, parameters for the graphs are established by answering the following questions: N OF CURVES TO AVERAGE type number of spectra to be averaged FREQUENCY SCALE 0 plot all frequencies calculated - 1 (or 1) plot first half etc. SCALE OF X-AXIS (establishes length o f x axis plotted) 0 full screen - 1 half screen 1 twice as large as screen etc. SINGLE (0) OR DOUBLE (1) SPACING 0 or 1 for spacing between successive power spectra ID TEXT type any identification text. Terminate with empty line. TEXT is stored on magnetic tape in lieu of a study. WHEN READY PRESS CONTINUE Now make sure that all connections are made and

that gains and falters are set properly. When CONTINUE is pressed the program will take successive power spectra. The computer's console switches are used for any further interaction with the program. Any change in the switches 1-15 will cause a change in the Y-scale of the gr~.phs. Any switch turned up will double the scale in the Y-direction. Any switch turned down will cut the scale in the Y-direction into half. Changing switch 0 will cause the program to restart. The program should be restarted only in this way. The reason is that the particular FFT used must always be allowed to run to completion. The program CNPL is started by answering questions setting the frequency range and the scales of the X and Y axes. After that the program will ask for a study number by typing TA=. The operator responds by typing the study number to be replayed. If this particular study happens to be an identification message rather than a spectrum, then the message will be printed on the console output device. The program can be restarted at location 2.

5. S a m p l e runs

5.1. Sample run o f program CNT The EEG signal was obtained from a FP1-A2 lead using a portable Offner Type T Electroencephalograph. N OF CURVES TO AVG 4 FREQUENCY SCALE - 1 SCALE OF X-AXIS q~ SINGLE (@) OR DOUBLE (1) SPACING ID TEXT: SAMPLE RUN WHEN READY PRESS CONTINUE The output of the program over a 5-min span is depicted in fig. 1. 5.2. Sample run o f program CNPL FREQUENCY SCALE - 1 SCALE OF X-AXIS @ SCALE OF Y-AXIS SINGLE (0) or DOUBLE (1) SPACING WHEN READY CONTINUE

F. Huber, Spectral analysis for Nova computers TA= 1 SAMPLE RUN TA= 2 TA = 3

TA = 23 Program CNPL set up in the indicated way recreates fig. 1 either on a CRT or on a digital plotter.

6. Mode of availability Persons interested in obtaining the programs are invited to contact the author.

Acknowledgement This work was supported by the Program Project Grant HL 14985 of the National Institutes of Health.

179

References [1] J.W. Cooley and J.W. Tukey, Math Computers 19 (1965) 297-301. [2] B. Kleiner, H. Fluhler, P.J. Huber and G. Dumermuth, Computer Programs in Biomedicine 1 (1970) 183-197. [3] A.S. French and A.V. Holden, Computer Programs in Biomedicine 1 (1971) 219-234. [4] A.S. French, Computer Programs in Biomedicine 3 (1973) 45-57. [5] J.J. Stockard, J.F. Schauble, T.W. BiUingerand R.G. Bickford, Proceedings of the San Diego Biomedical Symposium 11 (1972) 277-286. [6] W.M. Waite, Implementing software for non-numeric applications (Prentice-Hall, Inc., Englewood Cliffs, N.Y., 1973). [7] R.K. Otnes and L. Enochson, Digital time series analysis (John Wiley, 1972).

EEG spectral analysis for Nova computers.

Computer Programs in Biomedicine 4 (1975) 175-179 © North-Holland Publishing Company EEG SPECTRAL ANALYSIS FOR NOVA COMPUTERS Franz HUBER University...
254KB Sizes 0 Downloads 0 Views