Electroencephalography and Clinical Neurophysiology, 1979, 4 6 : 7 2 7 - - 7 3 0

727

© Elsevier/North-Holland Scientific Publishers, Ltd. Technical contribution AN OPTICAL SCAN SYSTEM FOR ENCODING SCORED SLEEP DATA 1

AND TABULATION

OF VISUALLY

G. FEIN and I. F E I N B E R G

Psychiatry Service (116A), San Francisco Veterans Administration Hospital, and University o f California at San Francisco, San Francisco, Calif. 94121 (U.S.A.) (Accepted for publication: December 13, 1978)

Most systems for visual scoring of all-night sleep records recommend scoring by successive epochs or pages of record. These typically range in duration from 20 sec to 1 min (Feinberg et al. 1967; Rechtschaffen and Kales 1968; Williams et al. 1974). A given epoch may receive more than one score (for example, stage 1 EEG with eye movement or body movement, etc.). Thus, the record of a single night might consist of 1500 20-sec epochs of record (500 rain) which, with multiple scores, could generate 2000--2500 data entries. Since subjects in sleep investigations are typically studied over several nights within a single condition, a massive volume of data rapidly accumulates. A major obstacle to computer analysis of visually scored sleep data has been the time, expense and the possible error involved in introducing this voluminous information into the computer. A number of systems have been developed in an attempt to systematize the tabulation and data analysis of visually scored sleep data (Anders and Zangen 1972; Tassone et al. 1973; Stanley 1974; Walker and Reite 1976). All of these systems require input of the visually scored sleep data as an operation separate from the visual scoring. In addition, these systems do not have the dual capability of retaining the original data by individual polygraph sleep data (PSD) page and the indexing of events in real time. This capability permits the integration of visually scored sleep staging with computer analyses of the EEG wave form (Feinberg et al. 1978). We present here a new system -- OPSCAN -- which overcomes these limitations. It consists of two parts. The first part is an input system in which specially designed scoring sheets are optically scanned and data directly entered into the computer. However, these entries must be monitored by the operator since the OPSCAN sheets sometimes contain human error. To

1 This work was supported by research funds from the Veterans Administration.

facilitate this monitoring, we have included extensive error and edit-checking as described below. The second part consists of a data base for the visually scored PSD. The visually scored data base (VSDB) is organized by NREM and REM periods but retains within those units the original coding of each epoch (PSD page) of sleep. Organization of data by REMPs and NREMPs has proved both efficient and informative in previous studies (Feinberg et al. 1967; Feinberg 1974; Feinberg and Floyd 1979). We thought the OPSCAN programs might be useful to other investigators. For this reason, those variables which often differ among laboratories (number of seconds per PSD page, length criteria for NREM and REM periods, etc.) were made specifiable program parameters. From the optically scanned input, with 3 additional cards of key punched data, the OPSCAN system yields scores for virtually all sleep variables. Data are provided both for the entire night and for successive NREM and REM periods. All data are entered directly into the Statistical Package for the Social Sciences (SPSS) (Nie et al. 1975) for analysis. Among the analyses we routinely include are the computation of means and standard deviations, both by cycles across the nights and by nights within and across conditions; the testing for trends within nights and for differences across conditions in both cycle trends and all-night mean values. The program described above could prove useful to any laboratory engaged in the visual scoring of all-night sleep records. In addition, by establishing an intermittent correspondence between real-time and PSD page (e.g., using a time-code generator or wall clock) the VSDB can be indexed by real-time and real-time correlates of specific PSD pages can be sought. For example, we have developed programs that combine the VSDB with our period-amplitude analysis data base (Feinberg et al. 1978) also indexed in real time, enabling us to examine the wave form characteristics of record visually classified as stages 2, 3, 4, NREM or REM. An additional advantage to the use of a highly accurate and uninterrupted time

728

G. F E I N , I. F E I N B E R G

c o d e is t h a t it p e r m i t s us, in o u r i n d e x i n g o f t h e VSDB, to a c c o u n t for b o t h v a r i a t i o n s in p a p e r speed a n d gross t i m e d i s r u p t i o n s of t h e PSD record.

mat. T h e scan s h e e t s are o r g a n i z e d b y PSD page. Fifty pages of PSD are e n c o d e d o n a single scan sheet. Each r o w of t h e scan s h e e t d e n o t e s a specific page of t h e PSD. T h e PSD r e c o r d is visually s c o r e d directly o n scan sheets. This p r o c e d u r e e l i m i n a t e s t h e n e e d for s e p a r a t e t r a n s c r i p t i o n of t h e original data. O n l y changes in sleep stage are e n c o d e d r e d u c i n g t h e n u m ber o f e n t r i e s r e q u i r e d . A p p r o x i m a t e l y 30 scan s h e e t s are g e n e r a t e d for an 8.5 h PSD r e c o r d at t h e p a p e r speed ( 1 5 m m / s e c ) we e m p l o y . Occasionally ( o n c e or t w i c e / 3 0 pages) t h e IBM

Methods

(A) Input T h e r e are t w o f o r m s o f i n p u t t o t h e V S D B s y s t e m . (1) Optical scan s h e e t s are used to i n p u t t h e visually s c o r e d data. Fig. 1 illustrates t h e s c a n s h e e t for-

-,.=,

3

0 i

=,=,~

W

STAOi

50 •

--

OA~! MISC.

|M

2

l, a O l i Q

OATI

s~uoy

~OUt i

i:

s

I

t

K

$

N

i

1

S

I

i



i

m

2



S

:1:

t

i

s

w

2

41

$ I

t

g(

s

m

|

It:

~1.

0

A w

$2 53 ,

2 55

i ~l'"

2 2

57 •

l

S : $

ii

3

~

II

I

62 ,,

'l

II

i

63 ,

~

i

64 •

~

:i:

l l:

i

~l

S

:i:

v

,

S:

~

s

:i:

::i::

:;i

:S

i

II"

:t::

::i:

:#:~

I

t

'i::

~11

"l

::~"

:i:

,

:i

~

7"2'

:'~::

i

: : i:

l: 61 •

:I

K

S

,+. . . .

67

a



+

+++:

:i+:

::l

::i :+

:i

:++:

"'t "

"'It"

: I ,+

:i::

::~

*+

" i"

"'i ....

" l ....

71

a

+

+

l

~

I

::l

+. . . .

72



1

+

~

~

+"

~

l:

73 •

i

S



I

l

i:

"

~' :i

? ....

l ....

:s

I

6

6:

$ ::i: * .... i : $1JIJl~

n N

"IP i::

i::

S "

5

N

:~+:

S

N

s ....

f4"

::S::

0 :i::

::~:

t

~"

+l

N

I

1

K

::s:

N

l

K

: s . . . . P+:

::i :

K

:6 V

. i+

J

i

::i

S:

S::

: 6:"

::6:"

:$"

6

::*::

'I ....

i:

:i:

::i . . . .

:i . . . .

"P

l :+

I T

1"

~

i ....

:S:

;i

--

; 1~

65 t "

3

l::

,i++

i::

~ " %: i=: "P" +

75 76 *

~

3

+

l ....

l:

~i

:":

:~l:

77 •

2

3

,

I

i....

i

+ :~

i

+ 5:

79 ,,

~

:l

,+

~

i

1

~::

i

S:

80 81

;

3

i

ii

)

: t

:l +

::i::

:~ .

~

i .... : i::

s

N

4 :S % ....

0

i

4

S:: +=

s +::

J

Fig. 1. S a m p l e optical scan s h e e t for e n c o d i n g o f visually s c o r e d PSD. T h e r e are b o t h A a n d B sheets: t h e A sheets are used for e n c o d i n g t h e first h a l f a n d t h e B sheets, t h e s e c o n d h a l f o f e a c h 100 pages. T h e page c o d e ( u p p e r r i g h t c o r n e r ) i n d i c a t e s t h e c e n t i l e while t h e n u m b e r e d lines ( l e f t m a r g i n ) c o r r e s p o n d t o t h e particular page w i t h i n t h e centile. T h e s a m p l e s h e e t (scan s h e e t 4 B ) is u s e d for e n c o d i n g PSD pages 4 5 0 - - 4 9 9 . N o t e t h a t t h e stage c h a n g e s ( w h i c h o c c u r r e d o n PSD pages 4 5 3 a n d 4 5 9 ) are c o d e d for 2 c o n s e c u t i v e pages. Stage 3, c o d e d at t h e t o p of t h e scan sheet, is n o t a stage c h a n g e since it c o n t i n u e s stage 3 c o d e d o n t h e p r e v i o u s page and, t h e r e f o r e , is c o d e d for o n l y o n e page. T h e eye m o v e m e n t s ( E M c o l u m n s ) are c o d e d as t h e n u m b e r of 4 sec e p o c h s w i t h eye m o v e m e n t s w i t h i n a 20 sec PSD page. T h e m i s c e l l a n e o u s c o l u m n s are used t o c o d e b o d y m o v e m e n t s (B), t w i t c h e s (T), K c o m p l e x e s (K), spindles (S), a n d n o d a t a (N). It s h o u l d b e n o t e d t h a t stage 1 is n o t i n c l u d e d o n t h e scan s h e e t s as stage 1 is n o t s c o r e d in o u r l a b o r a t o r y . In o r d e r t o facilitate t h e t a b u l a t i o n of stage 1 b y o t h e r l a b o r a t o ries, t h e p r o g r a m s have b e e n w r i t t e n t o r e c o g n i z e stage 1 w h e n stage A t o g e t h e r w i t h 1 EM is c o d e d o n t h e scan sheet. A p p r o x i m a t e l y 30 s u c h scan s h e e t s are used f o r e n c o d i n g a t y p i c a l 8 h PSD sleep record.

VISUALLY SCORED SLEEP DATA optical m a r k r e a d e r has failed t o sense m a r k s o n t h e scan sheets. To deal w i t h this p r o b l e m , each stage c h a n g e is m a r k e d for t w o c o n s e c u t i v e pages a n d t h e e d i t i n g p r o g r a m c h e c k s for this d o u b l e coding. This s y s t e m ensures a reliable p i c t u r e o f t h e PSD scoring i n f o r m a t i o n and m o n i t o r s t h e o p t i c a l m a r k r e a d e r ' s reliability. (2) F o r each c o m p l e t e PSD r e c o r d (i.e., a n e n t i r e n i g h t ) a s e c o n d i n p u t consists of 2--3 k e y p u n c h e d cards w h i c h code s u b j e c t i d e n t i f i c a t i o n , e x p e r i m e n t a l c o n d i t i o n s , t i m e - c o d e / P S D page c o r r e s p o n d e n c e , etc. T h e PSD p a g e / t i m e - c o d e c o r r e s p o n d e n c e is accomplished by selecting s e c t i o n s of t h e i n k - w r i t t e n r e c o r d in w h i c h t h e r e are n o time d i s r u p t i o n s . T h e PSD page a n d t i m e - c o d e are e n t e r e d for t h e b e g i n n i n g and e n d of each such s e c t i o n . T h e d i f f e r e n c e in t i m e codes b e t w e e n t h e e n d o f o n e s e c t i o n a n d t h e beginning of t h e n e x t s e c t i o n specifies t h e l e n g t h o f a n y d i s r u p t i o n s ( p a p e r changes, snags, etc.) o f t h e PSD record. If n o t i m e c o d e s are e n t e r e d , t h e PSD scan s h e e t d a t a are t r e a t e d as o n e c o n t i n u o u s section.

(B) Processing T h e scan sheets are read by t h e IBM o p t i c a l m a r k reader. These m a c h i n e s are usually available at university c o m p u t e r c e n t e r s w h e r e t h e y are used for t h e grading of exams. T h e o p t i c a l m a r k r e a d e r g e n e r a t e s t w o c o l u m n b i n a r y cards for each scan sheet. T h e colu m n b i n a r y cards are read i n t o t h e O P S C A N s y s t e m as a n i n p u t . T h e first p r o g r a m s r e c o n s t r u c t t h e scan s h e e t images f r o m t h e c o l u m n b i n a r y cards a n d edit the scan s h e e t c o r r e s p o n d i n g t o each n i g h t o f t h e PSD record. It is at this p o i n t t h a t h u m a n e r r o r in m a r k i n g scan s h e e t s is d e t e c t e d a n d c o r r e c t e d . T h e e d i t i n g process includes c h e c k s for m i s p l a c e d a n d / o r m i s o r d e r e d scan sheets a n d signals t h e o c c u r r e n c e o f u n l i k e l y events (e.g., eye m o v e m e n t s in stage 4 sleep). T h e o p e r a t o r can e x a m i n e t h e e d i t / e r r o r messages and, d e p e n d i n g u p o n t h e seriousness of t h e p r o b l e m , interr u p t t h e p r o g r a m to c o r r e c t scan s h e e t errors or perm i t processing t o c o n t i n u e . Processing c o n t i n u e s by m e r g i n g t h e r e c o n s t r u c t e d a n d e d i t e d PSD r e c o r d s w i t h t h e i d e n t i f i c a t i o n a n d (if p r e s e n t ) t i m e c o d e i n f o r m a t i o n . Data are n e x t i n d e x e d by t i m e - c o d e (if p r o v i d e d ) a n d a b s t r a c t e d into r e c o r d s w h i c h c o r r e s p o n d t o successive N R E M and R E M periods. W i t h i n each record, stage changes, a w a k e n i n g s a n d phasic events such as b o d y movem e n t s , t w i t c h e s , eye m o v e m e n t a c t i v i t y a n d / o r K c o m p l e x a n d spindle a c t i v i t y are i n d e x e d b y t h e i r t i m e of o c c u r r e n c e (or page n u m b e r ) . T h e s e r e c o r d s c o m p r i s e t h e VSDB. Every visually s c o r e d d a t u m is c o d e d a n d i n d e x e d b o t h b y its t i m e of o c c u r r e n c e a n d t h e N R E M or R E M p e r i o d d u r i n g w h i c h it occurs. Selected variables are t h e n e x t r a c t e d f r o m t h e V S D B ( e p o c h s of a w a k e n i n g , stages 2, 3, 4 a n d R E M ;

729 n u m b e r of stage c h a n g e s ; phasic events s u c h as eye movements, body movements and twitches during each R E M / N R E M p e r i o d , l a t e n c i e s o f R E M activity, sleep o n s e t and delta, etc.) a n d t r a n s f e r r e d t o t h e SPSS s y s t e m w h e r e a set of s t a n d a r d statistical analyses are p e r f o r m e d . T h e s e analyses i n c l u d e t r e n d analyses across cycles, c o m p a r i s o n s of al]-night values across c o n d i t i o n s , c o m p u t a t i o n o f w i t h i n - s u b j e c t reliabilities a n d analysis o f cycle t r e n d by c o n d i t i o n i n t e r a c t i o n s . In a d d i t i o n t h e d a t a are, of course, readily accessible for o t h e r specialized analyses. T h u s , O P S C A N p r o v i d e s for t h e e n c o d i n g , tabulat i o n a n d statistical analysis of visually scored PSD. T h e o n l y m a n u a l o p e r a t i o n s are in t h e visual scoring a n d t h e 2--3 cards of k e y - p u n c h e d data. All f u r t h e r t a b u l a t i o n , r e o r g a n i z a t i o n a n d analyses o f data are d o n e by c o m p u t e r . T h e V S D B p r o v i d e s a p e r m a n e n t , easily r e t r i e v a b l e r e c o r d o f t h e scoring o f each consecutive PSD page o r g a n i z e d b y N R E M a n d R E M periods. This data base will u l t i m a t e l y be used to describe t h e f r e q u e n c y d i s t r i b u t i o n s of R E M a n d N R E M o c c u r r e n c e s ; such d i s t r i b u t i o n s c a n provide r a t i o n a l criteria for N R E M P a n d R E M P l e n g t h s (e.g., mean 2 S.D.s). In o u r l a b o r a t o r y , t h e i n t e g r a t i o n of these data w i t h t h e o u t p u t of t h e c o m p u t e r analysis of E E G wave f o r m s is of f u r t h e r value. All of t h e p r o g r a m s are w r i t t e n in P L / I IBM OS 3 6 0 / 7 0 a n d require less t h a n 1 2 0 K of core for execution. T h e cost of processing a single n i g h t ' s PSD is less t h a n $ 6.00.

Discussion Sleep studies are i n h e r e n t l y expensive. It is, therefore, i m p o r t a n t to e c o n o m i z e w h e r e possible a n d to e x t r a c t a n d m a i n t a i n in r e t r i e v a b l e f o r m as m u c h of t h e i n f o r m a t i o n o b t a i n e d as possible. T h e O P S C A N s y s t e m virtually e l i m i n a t e s t h e e x p e n s e of m a n u a l t a b u l a t i o n s and r e t a i n s t h e visually s c o r e d sleep data in p e r m a n e n t l y accessible f o r m . M a n y sleep l a b o r a t o r i e s , i n c l u d i n g o u r own, are c a r r y i n g o u t c o m p u t e r analyses o f sleep E E G wave forms. Typically, results o f such analyses are pres e n t e d in parallel w i t h the results o f visual sleep stage scoring. A s e c o n d a d v a n t a g e o f t h e O P S C A N s y s t e m is t h a t because o f real t i m e i n d e x i n g o f visually s c o r e d events, it b e c o m e s possible to carry o u t d i r e c t comp a r i s o n s o f t h e visually scored a n d c o m p u t e r measures. These p r o g r a m s are available at cost to i n t e r e s t e d investigators. We will p r o v i d e s o u r c e a n d load m o d u les of all p r o g r a m s o n m a g n e t i c t a p e t o g e t h e r w i t h user d o c u m e n t a t i o n a n d s a m p l e o u t p u t illustrating t h e c o m p l e t e analysis of 2 n i g h t s of PSD record.

730 Summary A system for computer-assisted encoding, tabulation and analysis of visually scored sleep data is presented. The main features of the system are: (1) The use of computer-readable optical scan sheets for direct encoding of the sleep data. This eliminates the need for a separate transcription and/or key-punching operation. (2) The development of a visually scored data base, organized by NREM and REM periods, which contains all items of visually scored data indexed by time and/or page of occurrence in the sleep record. The advantages of this new system are: (a) the low cost per night of operation; (b) the facilitation of analysis of cycle phenomena and testing of new hypotheses that would usually involve retabulation of the data; and (c) the facilitation of analysis of real-time correlates of visually scored sleep stages. R6sum6 S y s t ~ m e de balayage o p t i q u e p o u r coder et marquer les stades de s o m m e i l scords visuellement

Les auteurs pr6sentent un syst6me assist6 par ordinateur pour coder, mettre en tableau et analyser des donn6es de sommeil scor6es visuellement. Les principales caract6ristiques de ce syst6me sont: (1) L'utilisation de bordereaux destin6s ~ ~tre lus par l'ordinateur par balayage optique, pour codage direct des donn6es de sommeil. Ceci 61imine la n6cessit6 d'une transcription s6par6e et/ou d'op6rations d'entr6e sur clavier. (2) Le d6veloppement d'une base de donn6es scor6es visuellement, organis6e par p6riodes de sommeil lent et de sommeil paradoxal, qui contient t o u s l e s items des donn6es scor6es visuellement, index6es en fonction du temps et/ou de la page ot~ elles surviennent dans le trac6 de sommeil. Les avantages de ce nouveau syst6me sont: (a) le cofit peu 61ev6 par nuit ou par op6ration; (b) la facilitation d'analyse des ph6nom6nes de cycles et la possibilit6 de tester de nouvelles hypoth/~ses qui impli-

G. FEIN! I. FEINBERG queraient habituellement la remise en tableau des donn6es; (c) la facilitation de l'analyse des corr61ats en temps r6el des stades de sommeil visuellement scor6s.

References Anders, T.F. and Zangen, M. R I P V A N - sleep state scoring in human infants. IBM 360/40 (64K) (Fortran IV G). Psychophysiology, 1972, 9: 653--654. Feinberg, I. Changes in sleep cycle patterns with age. J. psychiat. Res., 1974, 10: 283--306. Feinberg, I. and Floyd, T.C. Systematic trends across the night in human sleep cycles. Psychophysiology, 1979, in press. Feinberg, I., Koresko, R.L. and Heller, N. EEG sleep patterns as a function of normal and pathological aging in man. J. psychiat. Res., 1967, 5: 107--144. Feinberg, I., March, J.D., Fein, G., Floyd, T.C., Walker, J.M. and Price, L. Period and amplitude analysis of 0.5--3 c/sec activity in NREM sleep of young adults. Electroenceph. clin. Neurophysiol., 1978, 44: 202--213. Nie, N.H., Hull, C.H., Jenkins, J.G., Steinbrenner, K. and Bent, D.H. SPSS: Statistical Package for the Social Sciences. McGraw-Hill, New York, 1975. Rechtschaffen, A. and Kales, A. (Eds.) A Manual of Standardized T~rminology, Techniques and Scoring System for Sleep Stages of Human Subjects. National Institutes of Health Publication No. 204, U.S. Government Printing Office, Washington, D.C., 1968: 58. Stanley, U.W. A sleep information storage and retrieval system (SISAR). Comput. biol. Med., 1974, 4: 199--213. Tassone, E., Feinberg, I. and Carlson, V.R. SLPTAB: a computer program for the analysis of scored sleep data. Psychophysiology , 1973, 10: 612--613. Walker, S. and Reite, M. SLEEPSTA: sleep stage data handler. Psychophysiology, 1976, 13 : 159. Williams, R.L., Karacan, I. and Hursch, C.J. Electroencephalography (EEG) of Human Sleep: Clinical Applications. Wiley, New York, 1974.

An optical scan system for encoding and tabulation of visually scored sleep data.

Electroencephalography and Clinical Neurophysiology, 1979, 4 6 : 7 2 7 - - 7 3 0 727 © Elsevier/North-Holland Scientific Publishers, Ltd. Technical...
332KB Sizes 0 Downloads 0 Views