Computer Programs in Biomedicine 10 (1979) 197-208 © Elsevier/North-Holland Biomedical Press
E E G D A T A A C Q U I S I T I O N A N D P R E P R O C E S S I N G BY M I C R O C O M P U T E R S A T E L L I T E SYSTEM G. DUMERMUTH and R. DINKELMANN Department of EEG and Clinical Neurophysiology, University Children's Hospital, Steinweisstrasse 75, CH-8032 Ziirich, Switzerland Recent development in computer technology allows already medium scale EEG data processing to be performed within the clinical neurophysiology department, if a fast minicomputer with adequate mass storage and graphical output facilities is used. Data acquisition, however, should be delegated to a microcomputer which also should take over as much preprocessing as possible. A system is presented, where one or several microcomputer-based satellite units perform analog-digital conversion, Fourier transformation (FFT), calculation of power spectra and crossproducts, as well as event-related averagingor other preprocessing procedures. The units are connected to a fast central minicomputer, where a supervisor program loads the microprocessors with their programs, supervisestheir activity, receives preproeessed data and activates appropriate postprocessing programs to produce the final results. Data acquisition
EEG
Microcomputer
Spectralanalysis A similar situation is presented by Intensive Care Units where simultaneous automatic EEG monitoring of several patients is desired. The advent of minicomputer-compatible microcomputers has allowed us the design of a multiunit EEG processing system of which the first step, i.e., a microcomputer-based EEG data acquisition and preprocessing unit,, together with an outline of its control by the master minicomputer is presented in this paper.
1. Introduction
Despite considerable progress in computerized EEG analysis during the past years, the problems of efficient handling and interpretation of analysis output still exist. Most of the actual processing outcome consists of spectra, histograms, averaged evoked responses, which generally give no substantial data reduction. This may be of secondary concern to research work and in selected questions on small materials, but for clinical routine applications further automatic processing is indispensable. This next step of computerized EEG includes extraction of relevant parameters, submission to statistical treatment and taxonomial procedures, as well as suitable synoptic presentation of the outcome of the examination to the clinician. Such comprehensive processing, however, requires already a relatively powerful minicomputer well equipped with mass storage and graphical facilities, which may be too expensive for only one data recording unit. As many departments of clinical neurophysiology consist of more than one EEG recording unit, usually also of units for electromyography or other neuro. physiological measurements, connecting several data recording units to a common central minicomputer has to be considered.
2. System philosophy The system master is a standard minicomputer (e.g., DEC PDP-11/55) equipped with mass storage and graphical output facilities, running under a multiuser-multitask operating system (RSX 11M). Standard communication lines are connected to several data acquisition and preprocessing units like the one described below. The operating system allows the following software philosophy: A Supervisor task is permanently active and waiting for input from the communication lines. If a unit is activated by the EEG-technician (by simply turning the power switch on), the supervisor calls first a Loading task which loads the program into the micr 0. 197
198
G. Dumermuth, R. Dinkelmann, EEG data acquisition by microcomputer
computer and, subsequently, calls a Data receiving task interacting with the satellite unit. Standard data files are generated and one or several Postprocessing task_ automatically called. Results of postprocessing are presented in numerical or graphical form and, although to a limited extent, may be transmitted back to the data acquisition units.
3. Data acquisition by microcomputer 3.1. Connection of the satellite unit to the EEG machine The data acquisition unit is connected to the standard IRIG normed interstage outlet of a conventional EEG machine, allowing the production of a simultaneous paper record. To prevent aliasing [1,2] the data are submitted to an active low-pass filter (Burr-Brown-type UAF41 5-pole Bessel filter, attenuation up to 24 rib/octave) preset to a cutoff frequency of 0.8-0.9-times the Nyquist frequency which is determined by the sampling rate of the analog-digital converter. This prefiltering may be optionally bypassed by connecting the data directly to the multiplexer. 3.2. Analog-digital conversion (ADC) Multiplexer and analog-digital converter (ADAC model 1012) are program controlled. Conversion is done by successive approximation with a maximal conversion time of 28.5 #s/sample and a resolution of 12 bit for a range of +5 V. A crystal-controlled oscillator is preset to the standard sampling rate of 102.4 Hz proposed by tiffs laboratory for EEG analysis [1 ], giving a Nyquist frequency of 51.2 Hz and a fundamental frequency of 0.4 Hz after FFT. This oscillator is switched on and off via software by external push button control. Optionally an external oscillator with variable frequency may be connected. Each clock pulse generates an interrupt which initiates a complete multiplexer cycle, with successive sampling of the preselected number of channels as fast as possible. The digital values are stored as 16 bit integers in two alternating buffers, with size of 256 words/channel. Once a buffer is filled up by data, it is ready for preprocessing (e.g., FFT, see below).
3.3. Sampling control After the initial dialogue where personal data on the subject, derivations, preprocessing mode, etc., are specified, the system is ready to run. The following definitions hold: NCH BLOCK NBS SECTION NSF FILE
Number of channels Smallest data unit: NCH*256 words Number of blocks per section Continuous sequence of NBS blocks Number of sections per file Set of NSF sections defined at initial dialogue
The ADC-control panel has three control lights and push buttons: Control light
Push button
1 Green ADC IN PROGRESS STARTADC 2 Red ADC STOPPED STOP ADC 3 Yellow SYSTEMRESET CLEAR Pushing START initiates sampling, pushing STOP discontinues sampling and the data of the actual block (or of the entire section in spectral mode, see below) are discarded. Pressing CLEAR during sampling stops ADC and calls a questionary which asks whether the data collection is to be repeated from the beginning (i), the session is terminated and the collected data are to be kept (il), or deleted (iii).
4. Preprocessing by the microcomputer The contents of the two buffers, alternately f'dled with data from ADC are available for preprocessing. With 8 parallel channels and a sampling rate of 102.4 Hz the incoming data rate is one block of 2048 words/2.5 s. The following preprocessing modes are provided for this system and selected at the initial dialogue: (1) Spectral mode Tapering or Hanning (after FFT) Fourier transformation (FFT) Averaged periodogram (squares of sines and cosines) over NBS blocks Averaged cross-products between preselected channel pairs
G. Dumermuth, R. Dinkelmann, EEG data acquisition by microcomputer (2) Averaging mode Event-locked data averaging Averaging of squares (variances) (3) Bandpass mode FFT and cut-off of higher and/or lower frequency components (4) Direct transfer Transfer of raw data (no preprocessing)
4.1. Spectral analysis
199
age, but at the cost of a reduction of stability 2 TUKEY taper TP(/) = 0.5"(1 - COS(2"P1"(1- 1)/52)) for l = 1,26 = 1.0 for I = 27,230 = 0.5"(1 - COS(2*PI*(I- 204/52)) f o r / = 231,256 Compromise between reduction of leakage and loss of stability
4.1.1. Tapering/hanning Each individual data block submitted to the Fourier transformation may be regarded as a multiplication of the ongoing data with a rectangular Time window, which corresponds to a convolution of the spectrum with a sin X/X-shaped Spectral window. The very slow decay of its side lobes introduces leakage between neighbouring frequency bands, which should be reduced by modifications of the window in either time or frequency domain. In this system either Tapering of the data, i.e., multiplication with a window function going down symmetrically from 1 to 0 on both sides of the data block, or Harming, i.e., smoothing of the Fourier coefficients by - 1 / 4 , 1/2, - 1 / 4 , may be selected. Full tapering or hanning, however, reduces information and therefore stability of the spectral estimates, which could be compensated either by overlapping data blocks by 50% or by averaging a larger number of blocks per section. In this application, overlapping is not used. The following options may be selected at the initial dialogue: NO MODIFICATION (rectangular time window) Full data, considerable leakage, but best stability
Discussions of various time and spectral windows are found in [3].
4.1.2. Fast Fourier transform (FFT) The FFT algorithm of Morris [4] assembled from DECUS no. 11-296 is used. It performs complex Fourier transform of two interleaved input data vectors of 256 points each within 220 ms on a LSI-11. Unscrambling and reordering of the Fourier coefficients (see [5]) - by subroutine CTORS provided by the same DECUS package - into two separate sine and cosine series takes some additional time. The Fourier coefficients are transferred to a new buffer for further processing, leaving the arrays free for the next FFT output.
4.1.3. Computation oJ'power spectra and crossproducts The sines and cosines are squared and summed up in a double precision 32 bit integer array. Equally the crossproducts between preselected channel pairs are formed and summed up. Calculations are done only for frequencies up to 100 points, i.e., 40 Hz for the applied sampling rate of 102.4 Hz. After completion of a section the results are scaled to 24 bit integers.
4. 2. Data averaging HANNING Smoothing the Fourier coefficients
SF(I) = 0.5*F(/) - 0.25"(F(I - 1) + F(I + 1)) which is considered as equivalent to a full cosine taper:
TP(1) = 0 . 5 . ( I - COS(2*PI*(I- 1)/256)) Hanning brings considerable reduction of leak-
The data and its squares are summed up to form average and variance of a section of stimulus correlated EEG. ADC of each data block is started in relation to an external stimulus event or, during each sweep, the unit produces a stimulus after a preselected delay. Either the raw data or the growing sums may be displayed for a preselected channel on an oscilloscope screen during sampling. As in section
200
G. Dumermuth, R. Dinkelmann, EEG data acquisition by microcomputer
4.1.3 scaling to 24 bit integers takes place before transfer to the master computer. 4.3. Bandpass mode In this mode a preselected frequency band of Fourier coefficients forms the preprocessing outcome, to be transferred blockwise to the master computer for further processing either in the frequency domain (e.g., bispectra, cepstra, complex demodulation) or in the time domain after inverse Fourier transformation.
lem, as it is performed only at the end of a stimulus series. The raw data flow, however, is too fast for a 9600 baud line (still maximum for PDP-11 standard minicomputers with RSX11M) when 8 channels are sampled at 102.4 Hz (yielding ~820 data words/s or 1640 bytes). For transfer of raw data, appropriate reduction of the number of channels or the sampling rate is necessary (mode 4). However, cutting out a selected frequency band ~ > > Program LPEAK for extraction of spectral peak parameters
Spectral mode: Selection of taper, or -
~ XX
204
G. Dumermuth, R. Dinkelmann, EEG data acquisition by microcomputer
hanning - Cross spectral combinations - Number of blocks per section Number of sections Average mode number of points per sweep External or internal stimulus generation Delay of stimulus Number o f sweeps - Send header block to LRECVn
Push buttons: STOP Stops sampling, data of actual section are discarded START Resumes sampling - CLEAR -+ EOF
- Wait for second 'GO' If message = 'BAD' Start sampling and preprocessing Spectral mode: After NSF sections: Receive and print result Average mode: After each section, if another run otherwise
~XX - , QQ
-~EOF
RS EOF
- Another file ? - If YES ~ RR -If NO send 'END OF JOB' to LSV - Waiting loop for new job: CTRL X ~ RR (Option: Wait for results from postprocessor, not yet implemented) -
Questionary 1 Repeat entire data acquisition 2 Keep sampled data 3 Delete file (This info is transmitted to LRECVn)
I
ASYNCHRONOUS1 SERIAL INTERFACE POP-11/SSBUS I~ DL11E k
OISPLAY TERMINAL REGENT 20
DISPLAY
F
1 LSi-I1CPU KDIIF K(YI1 4KN flOS
D/A-CONVERTER AOA¢ 1400
I
1