Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Digital processing of somatosensory evoked potentials applied to the early diagnosis of multiple sclerosis Roberts, Kim Byron 1984

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-UBC_1984_A7 R62.pdf [ 6.06MB ]
Metadata
JSON: 831-1.0096283.json
JSON-LD: 831-1.0096283-ld.json
RDF/XML (Pretty): 831-1.0096283-rdf.xml
RDF/JSON: 831-1.0096283-rdf.json
Turtle: 831-1.0096283-turtle.txt
N-Triples: 831-1.0096283-rdf-ntriples.txt
Original Record: 831-1.0096283-source.json
Full Text
831-1.0096283-fulltext.txt
Citation
831-1.0096283.ris

Full Text

D i g i t a l A p p l i e d P r o c e s s i n g of Somatosensory Evoked to the E a r l y D i a g n o s i s of M u l t i p l e P o t e n t i a l s S c l e r o s i s By KIM BYRON ROBERTS B.A.Sc. UBC 1982 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF APPLIED SCIENCE i n THE FACULTY OF GRADUATE STUDIES Department of E l e c t r i c a l E n g i n e e r i n g We accept t h i s t h e s i s as conforming to the r e q u i r e d standard U n i v e r s i t y of B r i t i s h Columbia May 1984 f^Kim Roberts, 1984 In presenting t h i s thesis i n p a r t i a l f u l f i l m e n t of the requirements fo r an advanced degree at the University of B r i t i s h Columbia, I agree that the Library s h a l l make i t f r e e l y a v a i l a b l e for reference and study. I further agree that permission for extensive copying of t h i s t h e s i s f o r scholarly purposes may be granted by the head of my department or by h i s or her representatives. I t i s understood that copying or p u b l i c a t i o n of t h i s t h e s i s f o r f i n a n c i a l gain s h a l l not be allowed without my written permission. Department of The University of B r i t i s h Columbia 1956 Main Mall Vancouver, Canada V6T 1Y3 Date IC ftffl ABSTRACT T h i s s t u d y i n v e s t i g a t e d s e v e r a l d i g i t a l t e c h n i q u e s f o r t h e e x t r a c t i o n o f p a r a m e t e r s f r o m S o m a t o s e n s o r y E v o k e d P o t e n t i a l s ( S E P s ) . The h i g h e r f r e q u e n c y s m a l l e r p e a k s i n t h e SEP were e m p h a s i s e d u s i n g a d i g i t a l f i l t e r t o remove t h e l o w f r e q u e n c y c o m p o n e n t s . The f i l t e r e d SEPs were compared t o a S t a n d a r d Wave u s i n g D y n a m i c Time W a r p i n g t e c h n i q u e s w h i c h p r o d u c e d a C o s t F u n c t i o n t o m e a s u r e a b n o r m a l i t y . A q u a n t i f i c a t i o n o f t h e d i s p e r s i o n o f t h e SEPs was a l s o c o m p u t e d . T h e s e p a r a m e t e r s were e v a l u a t e d as t o t h e i r s e n s i t i v i t y and r e l i a b l i l i t y when u s e d t o c l a s s i f y N o r m a l and M u l t i p l e S c l e r o s i s S E P s . They p r o v e d t o be c l i n i c a l l y s i g n i f i c a n t d i a g n o s t i c t o o l s . i i i Table of Contents ABSTRACT i i TABLE OF CONTENTS i i i ACKNOWLEDGEMENTS v LIST OF TABLES v i LIST OF FIGURES v i i 1) INTRODUCTION 1 2) EXAMINATION OF SEPS USING DIGITAL FILTERING 12 2.1) I n t r o d u c t i o n 13 2.2) Methods 15 2.3) R e s u l t s 21 2.4) D i s c u s s i o n 29 2.5) C o n c l u s i o n 47 3) DYNAMIC TIME WARPING OF THE FILTERED SEP 49 3.1) I n t r o d u c t i o n 50 3.2) Design of the Cost F u n c t i o n 57 3.2.1) The C o r r e l a t i o n Quotient Q 59 3.2.2) C o n s t r a i n t s and the Penalty F u n c t i o n 60 3.2.3) Summary of the Cost F u n c t i o n Used 65 3.3) Implementation 66 3.4) The Standard Wave 67 3.5) C l i n i c a l Test 76 3.6) R e s u l t s 83 3.7) D i s c u s s i o n 86 iv 4) DISPERSION FIGURE 87 4.1) I n t r o d u c t i o n 88 4.2) Methods 93 4.3) R e s u l t s 94 4.4) D i s c u s s i o n 104 5) BAYESIAN DECISION MAKER . . . 106 5.1) I n t r o d u c t i o n . 107 5.2) Methods 108 5.3) R e s u l t s 112 5.4) D i s c u s s i o n . 113 5.5) C o n c l u s i o n 117 6) CONCLUSIONS 119 REFERENCES 122 APPENDIX 1) USER'S MANUAL FOR THE PROGRAM EMG 133 APPENDIX 2) THE PROGRAM FILTER 150 APPENDIX 3) THE PROGRAM WARP 169 APPENDIX 4) THE PROGRAM WEFT 186 APPENDIX. 5) DESIGN OF RESEARCH FACILITIES 200 V ACKNOWLEDGEMENTS I would l i k e to thank Peter Lawrence and Andrew Ei s e n f o r t h e i r advice and f o r t h e i r support, both academic and f i n a n c i a l . Cathy E i s e n arranged and coor d i n a t e d the group of MS p a t i e n t s . Maureen Hoir c h and S t e l l a K y r i a k i d i s provided v a l u a b l e a s s i s t a n c e and a d v i c e . A s p e c i a l thank you to the f o r t y - n i n e people who volu n t e e r e d to come to the l a b and have the t e s t s done, without whom there would have been no data. v i L i s t of Tables I L a t e n c i e s of Peaks 27 II Interpeak L a t e n c i e s . . 28 III Cost F u n c t i o n Values 84 IV Values of the D i s p e r s i o n F i g u r e 103 V Test of Normal D i s t r i b u t i o n of Data I l l VI Y i e l d of D e c i s i o n Maker 118 v i i L i s t of F i g u r e s 1.1 A Normal Median SEP 3 1.2 A Normal Median SEP 5 1.3 A Normal Median SEP 7 1.4 A Normal Median SEP 9 1.5 A Normal Median SEP 11 2.1 Blackman Window 18 2.2 1000 Hz Sine Wave F i l t e r e d Between 300 and 2500 Hz. . . 19 2.3 S p e c t r a l Window 300 to 2500 Hz 20 2.4 Impulse Response F i l t e r s @ 300 - 2500 Hz 22 2.5 Un i t Impulse F i l t e r e d Between 300 and 2500 Hz 23 2.6 A Normal Median SEP: U n f i l t e r e d and F i l t e r e d 24 2.7 Two Separate Averages of a Normal SEP: U n f i l t e r e d and F i l t e r e d 25 2.8 Four Normal Median SEPs: U n f i l t e r e d and F i l t e r e d . . . 26 2.9 Window Used on Slowly Sampled Data 30 2.10 Slowly Sampled SEPs: U n f i l t e r e d 31 2.11 Slowly Sampled SEPs: F i l t e r e d 32 2.12 A m p l i f i e r and Analog F i l t e r Impulse Response 33 2.13 N o n b i o l o g i c a l Noise averaged 1024 Times 35 2.14 D e t a i l of N o n b i o l o g i c a l Noise 36 2.15 T o t a l Noise Averaged 1024 Times 37 2.16 Spectrums of: an SEP, No Stimulus Noise, and N o n b i o l o g i c a l Noise 38 2.17 Spectrums of an SEP: U n f i l t e r e d and F i l t e r e d 39 2.18 E f f e c t of D i f f e r e n t High Pass F i l t e r i n g s on an SEP. . . 41 2.19 Analog F i l t e r e d SEP 42 2.20 Latency S h i f t s Due to Analog F i l t e r i n g 43 2.21 No S h i f t s With D i g i t a l F i l t e r i n g 44 2.22 F i l t e r e d Blackman Window Superimposed on a F i l t e r e d SEP 46 v i i i 3.1 A Normal SEP D i g i t a l l y F i l t e r e d 51 3.2 A Normal SEP D i g i t a l l y F i l t e r e d 52 3.3 A Normal SEP D i g i t a l l y F i l t e r e d 53 3.4 A Normal SEP D i g i t a l l y F i l t e r e d 54 3.5 A Normal SEP D i g i t a l l y F i l t e r e d 55 3.6 Standard D i g i t a l l y F i l t e r e d SEP 69 3.7 Average of 24 Warped SEPs 70 3.8 Peaks i n a Normal Warped Wave 72 3.9 A Normal Warped Wave compared to the Standard Wave. . . 73 3.10 A Normal Wave: Warped and Unwarped 74 3.11 An MS Wave: Warped and Unwarped 75 3.12 A Normal Warping F u n c t i o n 77 3.13 Some Normal Warping Fu n c t i o n s 78 3.14 A l l of the Normal Warping Functions 79 3.15 An MS Warping F u n c t i o n 80 3.16 Some MS Warping Fu n c t i o n s 81 3.17 A l l of the MS Warping Functions 82 3.18 What Happens With a M i s s i n g Peak? 85 4.1 A M u l t i p l e S c l e r o s i s SEP 89 4.2 A M u l t i p l e S c l e r o s i s SEP 90 4.3 A M u l t i p l e S c l e r o s i s SEP 91 4.4 A M u l t i p l e S c l e r o s i s SEP 92 4.5 The Spectrum of a Normal SEP 95 4.6 The Spectrum of a Normal SEP 96 4.7 The Spectrum of a Normal SEP 97 4.8 The Spectrum of a Normal SEP 98 4.9 The Spectrum of an MS SEP 100 4.10 The Spectrum of an MS SEP 101 4.11 The Spectrum of an MS SEP 102 5.1 Bayesian C u t o f f : Latency vs. Cost F u n c t i o n 114 5.2 Bayesian C u t o f f : D i s p e r s i o n vs. Cost F u n c t i o n 115 5.3 Bayesian C u t o f f : D i s p e r s i o n vs. Latency 116 1. 1) INTRODUCTION 2. S e n s o r y s t i m u l i i n d u c e e l e c t r i c a l e v e n t s r e c o r d a b l e o v e r t h e c e r e b r a l c o r t e x . T h e s e c e r e b r a l evoked p o t e n t i a l s a r e c l a s s i f i e d as s o m a t o s e n s o r y (meaning body s e n s a t i o n ) when p e r i p h e r a l s e n s o r y n e r v e s a r e s t i m u l a t e d . The r e c o r d i n g o f S o m a t o s e n s o r y Evoked P o t e n t i a l s (SEPs) i s n o t new. They were f i r s t r e c o r d e d w i t h o u t t h e a i d o f computer a v e r a g i n g [Dawson,1947]. W i t h t h e a d v e n t o f s o p h i s t i c a t e d e l e c t r o n i c e q u i p m e n t i n t h e 1970's, t h e r e c o r d i n g o f c e r e b r a l e v o k e d p o t e n t i a l s became p o p u l a r i z e d . W i t h i n t h e l a s t f i v e t o t e n y e a r s , t h e f i e l d has b l o s s o m e d and t h e t e c h n i q u e s a r e now r o u t i n e i n many c l i n i c a l n e u r o p h y s i o l o g i c a l l a b o r a t o r i e s t h r o u g h o u t t h e w o r l d . The S o m a t o s e n s o r y Evoked P o t e n t i a l can be e l e c t r i c a l l y or m e c h a n i c a l l y e l i c i t e d by e x c i t i n g p e r i p h e r a l n e r v e s or t h e i r e n d - o r g a n s . The r e s u l t i n g i m p u l s e s a r e c o n d u c t e d , by l a r g e - d i a m e t e r s e n s o r y f i b r e s , i n t o t h e c e n t r a l n e r v o u s s y s t e m , where t h e y a r e c a r r i e d p r e d o m i n a n t l y by t h e d o r s a l c o l u m n - l e m n i s c a l s y s t e m s [ E i s e n , 1 9 8 2 a ] . The SEP, measured between two s c a l p e l e c t r o d e s , c o n t a i n s peaks t h a t a r e t h o u g h t t o be g e n e r a t e d by s e q u e n t i a l s u b c o r t i c a l and c o r t i c a l s t r u c t u r e s : t h e c u n e a t e n u c l e u s , t h e m e d i a l l e m n i s c u s , t h e t h a l a m u s , t h e t h a l a m o - c o r t i c a l c o n n e c t i o n s , and t h e S o m a t o s e n s o r y C o r t e x . [ K r i t c h e v s k y e t a l , 1978; A n z i s k a e t a l , 1978; Desmedt and C h e r o n , 1980; 1 9 8 1 ] . The l a s t i s t h o u g h t t o p r o d u c e t h e l a r g e 3. > 4. peak a b o u t 20 m i l l i s e c o n d s a f t e r t h e s t i m u l a t i o n . [ A l l i s o n e t a l , 1 980]. However, t h e s e s u g g e s t e d g e n e r a t o r s o f t h e SEP a r e volume c u r r e n t s t h a t p a s s t h r o u g h l a y e r s o f d i f f e r e n t c o n d u c t i v i t i e s and c o m p l i c a t e d g e o m e t r i e s , making i t v e r y d i f f i c u l t t o r e s o l v e t h e s o u r c e s [Kaufmann, 1 9 8 1 ] . A l t h o u g h some i n v a s i v e measurements have been done [ L a r s o n , 1968; C e l e s i a , 1 9 7 9 ] , much more needs t o be done i n humans b e f o r e any f i r m c o n c l u s i o n s can be drawn as t o t h e s o u r c e o f t h e components o f t h e SEP. In S o m a t o s e n s o r y Evoked P o t e n t i a l s , t h e l a t e n c y o f t h e e a r l y components, t h a t i s , t h e t i m e t a k e n f o r i m p u l s e s t o r e a c h t h e b r a i n a f t e r a p p l i c a t i o n o f a s t i m u l u s , i s us e d as t h e c h i e f means o f d i a g n o s i n g a b n o r m a l i t y . The v a r i a b i l i t y i n i n t e r - p e a k l a t e n c i e s , w h i c h i s h e l d t o be i n d i c a t i v e o f t h e c o n d u c t i o n t i m e s t h r o u g h v a r i o u s p a r t s o f t h e p e r i p h e r a l and c e n t r a l n e r v o u s s y s t e m , i s used t o a l e s s e r e x t e n t . S h o r t l a t e n c y components a r e c o n s i d e r e d as t h o s e w i t h l a t e n c i e s o f under 25 m i l l i s e c o n d s when s t i m u l a t i n g an arm, and l e s s t h a n 45 m i l l i s e c o n d s when s t i m u l a t i n g a l e g . T h e s e components a r e v e r y s t a b l e , b e i n g u n a f f e c t e d by d r o w s i n e s s , s l e e p , o r l i g h t a n a s t h e s i a [Abrahamian e t a l , 1963; G o f f e t a l , 1 9 6 6 ] , They a r e , however, a f f e c t e d by d e e p e r a n a e s t h e s i a . Medium, and l o n g l a t e n c y components a r e much l e s s s t a b l e . Figure 1.2 msQC 6. P o s s i b l e p a r a m e t e r s o f t h e SEP (which a r e n o t n o r m a l l y used) i n c l u d e t h e o v e r a l l shape o f t h e waveform, a m p l i t u d e o f v a r i o u s m a j o r p e a k s , t h e smoothness o r d e g r e e o f s y n c h r o n i z a t i o n o f t h e r e s p o n s e , and t h e p r e s e n c e o f t h e h i g h e r f r e q u e n c y s m a l l e r p e a k s . The a m p l i t u d e o f t h e SEP i s v a r i a b l e between s u b j e c t s and t h e r e f o r e o f l i m i t e d v a l u e i n a b s o l u t e t e r m s , a l t h o u g h a 50 or g r e a t e r p e r c e n t a g e d i f f e r e n c e between l e f t and r i g h t l i m b s i n a g i v e n i n d i v i d u a l i s u s u a l l y r e g a r d e d as b e i n g a b n o r m a l . S i m i l a r l y , t h e shape o f t h e SEP i s d e p e n d e n t upon s t i m u l a t i o n and r e c o r d i n g s i t e s , and p r o b a b l y o t h e r , so f a r u n d e t e r m i n e d , f a c t o r s . F i g u r e s 1.1 t o 1.5 show t y p i c a l n o rmal median n e r v e SEP waveforms measured between a p a i r o f s c a l p e l e c t r o d e s . T h e s e f i g u r e s a r e i n d i c a t i v e o f t h e wide v a r i a t i o n i n shape t h a t i s o b s e r v e d i n n o r m a l s . Abnormal SEPs a r e p a r t i c u l a r l y a s s o c i a t e d w i t h t h e p o s i t i o n s e n s e l o s s [ G i b l i n , 1 9 6 4 ] . Amongst th e v a r i o u s d i s e a s e s i n w h i c h e v o k e d p o t e n t i a l r e c o r d i n g have been f o u n d u s e f u l , M u l t i p l e S c l e r o s i s (MS) r a n k s amongst t h e h i g h e s t . T h i s d i s e a s e , w h i c h has an i n c i d e n c e o f about 100 p e r 100,000 i s p r e s e n t l y o f unknown c a u s e . MS c a u s e s a l o s s o f t h e m y e l i n c o v e r i n g o f c e n t r a l n e r v o u s s y s t e m f i b r e s . C o n s e q u e n t l y , c o n d u c t i o n i n t h e s e f i b r e s i s s l o w e d and e v e n t u a l l y f a i l s . The i n t e r r u p t e d c o n d u c t i o n p r o d u c e s d i s t o r t i o n o f i m p u l s e 4.000 H 2.000 H 0. 000 -2. 000 -4. 000 H A Normal Median S E P 10. 0 14. 0 18.0 22.0 Fi gure 1.3 msQC 8. t r a f f i c w h i c h i s i n t e r p r e t e d i n t h e b r a i n as a h o s t o f i n a p p r o p r i a t e s e n s a t i o n s and can r e s u l t i n i m p a i r e d motor f u n c t i o n [ E i s e n , 1 9 8 3 ] . M u l t i p l e S c l e r o s i s c a u s e s a b n o r m a l i t i e s o f c e r e b r a l e v o k e d p o t e n t i a l s . T h e r e have been many s t u d i e s r e p o r t i n g t h e use o f S o m a t o s e n s o r y Evoked P o t e n t i a l s i n MS [ C h i a p p a , 1 9 8 2 ] . In c a s e s where t h e r e i s d e f i n i t e MS, and d i s e a s e r e f e r a b l e t o t h e n e r v e s b e i n g t e s t e d , t h e d i a g n o s t i c a c c u r a c y o f t h e s e t e s t s a p p r o a c h e s 100%. However, i n s u s p e c t e d MS, a s t a g e o f t h e d i s e a s e i n w h i c h t h e r e i s a r e a l need f o r a good l a b o r a t o r y t e s t , t h e d i a g n o s t i c a c c u r a c y i s p o o r , u s u a l l y l e s s t h a n 40%, and i f t h e p a t i e n t i s a s y m p t o m a t i c i n t h e n e r v e s y s t e m b e i n g s t i m u l a t e d the d i a g n o s t i c a c c u r a c y i s v e r y p o o r . The p r i m a r y p u r p o s e o f t h i s work was t o d e v e l o p a more s u b t l e and o b j e c t i v e p h y s i o l o g i c a l t e s t f o r MS, w h i c h , when used i n c o m b i n a t i o n w i t h o t h e r l a b o r a t o r y t e s t s , m i g h t a l l o w e a r l i e r d i a g n o s i s . W h i l e t h e r e i s c u r r e n t l y no e f f e c t i v e t r e a t m e n t f o r MS, t h e a b i l i t y t o d i a g n o s e t h e d i s e a s e i n i t s e a r l y s t a g e s w i l l , u n d o u b t a b l y , be e s s e n t i a l t o any p o t e n t i a l t h e r a p y . 2.000 -i 1.000 H 0.000 H -1.000H -2. 000 + A Normal Median SEP Figure 1.4 msQc 10. T h i s t h e s i s a d d r e s s e s t h e f o l l o w i n g a s p e c t s : 1) The d e s i g n o f r e s e a r c h f a c i l i t i e s f o r t h e N e u r o m u s c u l a r D i s e a s e s U n i t . 2) The i s o l a t i o n o f f e a t u r e s o f t h e S o m a t o s e n s o r y E v o k e d P o t e n t i a l t h a t c a n b e u s e d as a d i a g n o s t i c t e s t f o r M u l t i p l e S c l e r o s i s . 3) The e v a l u a t i o n o f t h e s e n s i t i v i t y a n d r e l i a b i l i t y o f t h e i s o l a t e d f e a t u r e s i n d i a g n o s i n g M u l t i p l e S c l e r o s i s . A Normal Median SEP 2. 000 1.000 -0.000 --1.000--2. 000 -14.0 18. 0 msQC Figure 1.5 2) EXAMINATION OF SOMATOSENSORY EVOKED POTENTIALS USING DIGITAL FILTERING 13. 2.1) I n t r o d u c t i o n Many of the e a r l y peaks of the SEP are i n c o n s i s t e n t or of such small amplitude as to make them d i f f i c u l t to measure. A high-pass f i l t e r can be used to enhance the e a r l y l a t e n c y peaks by removing the lower frequency components and thereby making the e a r l y peaks e a s i e r to measure [King and Green, 1979; R o s s i n i et a l , 1981; Lueders et a l , 1981; Lueders et a l , 1983; Maccabee et a l , 1983]. C e p h a l i c b i p o l a r r e c o r d i n g i s popular i n the r o u t i n e c l i n i c a l s e t t i n g , and so i t i s of i n t e r e s t to explore the value of high-pass f i l t e r i n g of waves recorded with t h i s technique. Although high-pass analog f i l t e r i n g was i n v e s t i g a t e d i n t h i s l a b o r a t o r y , i t had s e v e r a l s e r i o u s drawbacks. A 48 dB/octave Krohn-Hite Butterworth analog f i l t e r was i n s e r t e d a f t e r a DISA 15C01 a m p l i f i e r . The f i l t e r ' s sharp c u t - o f f made i t p o s s i b l e to remove components of the SEP below 300 Hz. However, s e v e r a l inherent f e a t u r e s of the analog f i l t e r s e v e r e l y d i s t o r t e d the s i g n a l . When the i m p u l s e - l i k e stimulus a r t i f a c t passed through the f i l t e r i t produced a slowly decaying 300 Hz r i n g i n g superimposed on the SEP (Figure 2.19). The no n l i n e a r phase c h a r a c t e r i s t i c of the analog f i l t e r s meant that d i f f e r e n t frequency components were delayed by d i f f e r e n t amounts. The amount of r i n g i n g and phase s h i f t v a r i e d with the r o l l - o f f frequency s e t t i n g s of the f i l t e r s [Doyle, 1983; Doyle, 1981; Scherg, 1982; W a s t e l l , 1979; Dawson, 1973] (Figure 2.20). T h i s made i d e n t i f i c a t i o n of peaks and measurement of l a t e n c i e s d i f f i c u l t and i n a c c u r a t e . D i g i t a l f i l t e r i n g e l i m i n a t e d a l l of these problems. Through use of a sweep delay, the stimulus a r t i f a c t i s not d i g i t i z e d and so does not even enter the d i g i t a l f i l t e r . The d i g i t a l f i l t e r was designed to int r o d u c e no de l a y . One SEP may be d i g i t a l l y f i l t e r e d i n s e v e r a l d i f f e r e n t ways without d e s t r o y i n g the o r i g i n a l data. T h i s allows s e v e r a l d i f f e r e n t f e a t u r e s to be h i g h l i g h t e d from one r e c o r d i n g . In t h i s chapter i t w i l l be shown that s e v e r a l components of the SEP recorded using c e p h a l i c b i p o l a r techniques can be made more e a s i l y i d e n t i f i a b l e by the use of a d i g i t a l f i l t e r . 2.2 Methods T w e n t y - f o u r normal s u b j e c t s v o l u n t e e r e d f o r t h i s s t u d y . T h e r e were f o u r t e e n f e m a l e s (ages 28 +_ 12) and t e n males (ages 24 + 3) . S q u a r e c u r r e n t p u l s e s from a DISA 15E25 s t i m u l a t o r were d e l i v e r e d t h r o u g h s i l v e r d i s c s s e p a r a t e d l o n g i t u d i n a l l y by about 40 mm, p o s i t i o n e d a l o n g t h e median n e r v e a t t h e w r i s t . S t i m u l u s d u r a t i o n was 1.0 ms. T h i s l o n g d u r a t i o n s t i m u l u s was c h o s e n b e c a u s e i t s e l e c t i v e l y e x c i t e s a f f e r e n t , p r e d o m i n a n t l y g r o u p l a , n e r v e f i b e r s ( V e a l e e t a l , 19 7 3 ) , w h i c h m e d i a t e t h e SEP ( G a n d e v i a e t a l , 1 9 8 3 ) . The s t i m u l u s i n t e n s i t y was a d j u s t e d t o i n d u c e a v i s i b l y m i n i m a l m u s c l e t w i t c h . . The s t i m u l i were d e l i v e r e d a t a r a t e o f 4 t o 5 Hz. S c a l p n e e d l e e l e c t r o d e s were used f o r r e c o r d i n g . They were p o s i t i o n e d a t C3 or C4 ( I n t e r n a t i o n a l 10-20 system) c o n t r a l a t e r a l t o t h e s i d e o f s t i m u l a t i o n and a t Fpz [ J a s p e r , 1 9 5 8 ] . The s i g n a l was a m p l i f i e d by a D i s a 15C01 EMG a m p l i f i e r p a s s i n g a band from 10 Hz t o 10,000 Hz Next t h e s i g n a l was low p a s s f i l t e r e d u s i n g a K r o h n - H i t e 3342 B u t t e r w o r t h f i l t e r s e t w i t h a c u t o f f f r e q u e n c y o f 2500 Hz and a r o l l o f f o f 48 d B / o c t a v e . The f i l t e r e d s i g n a l was sampled a t 20 m i c r o s e c o n d i n t e r v a l s f o r 20 ms and then quantized to e i g h t b i t accuracy. The sampling r a t e of 50 KHz, which was ten times the Nyquist minimum sampling r a t e , was used to reduce the q u a n t i z i n g e r r o r . Longer epochs sampled at 10 KHz were a l s o recorded to observe the l a t e r components of the SEP. In 50% of the v o l u n t e e r s the noise was a l s o measured by r e c o r d i n g with no s t i m u l u s . In order to reduce the v a r i a t i o n i n l a t e n c y due to arm l e n g t h , and to avoid the stimulus a r t i f a c t , the s t a r t of the sampling was delayed a f t e r the s t i m u l a t i o n a c c o r d i n g to the formula: D=0.15L-3.0 where L was the length of the s u b j e c t s arm measured from w r i s t to C7 and D was the delay i n m i l l i s e c o n d s . T h i s formula was d e r i v e d from r e s u l t s p u b l i s h e d i n [Eisen and Nudleman, 1978], In t h e i r f i g u r e 3 the r e g r e s s i o n l i n e r e l a t i n g the arm length to the onset l a t e n c y of the c e r v i c a l somatosensory response had the equation Y=0.15X+0.98 with X i n centimeters and Y i n m i l l i s e c o n d s . The r value f o r t h i s r e g r e s s i o n was 0.84 . From l a b o r a t o r y data i t was decided that s t a r t i n g the epoch 4.0 m i l l i s e c o n d s before the onset of the SEP would s e l e c t the most i n f o r m a t i v e r e g i o n of the wave. Ther e f o r e , the delay becomes D=0.15L-3.0 . 17. The s i g n a l next passed through an e i g h t b i t analog to d i g i t a l c o n v erter i n the Disa d i g i t a l c o n t r o l u n i t . The converter c l i p p e d the s i g n a l at + 8 m i c r o v o l t s . I f one t r a c e had more than two such c l i p p e d regions the s i g n a l was r e j e c t e d and was not used i n the averaging. The 1024 e i g h t b i t values composing one sweep were added to the contents of the memory of the averager. T y p i c a l l y 1024 i n d i v i d u a l sweeps were added i n t o the memory. The 1024 e i g h t b i t v a l u e s , comprising the averaged wave, and the 64 bytes of s w i t c h - s e t t i n g i n f o r m a t i o n , were passed to the l a b o r a t o r y PDP-11/23. The program EMG (Documented i n Appendix 1) stored the data and f u r t h e r s u b j e c t i n f o r m a t i o n in d u p l i c a t e data f i l e s and added an entry to the index of waves recorded. The program FILTER (Documented i n Appendix 2) was used to read i n a s e l e c t e d data f i l e and d i g i t a l l y f i l t e r i t . FILTER f i r s t removed any DC b i a s from the data and then a p p l i e d a Blackman window (Figure 2.1) [Oppenheim + Schafer,1975] between samples 10 and 960 of the 1024 samples comprising the wave. The Blackman window was chosen because of i t s very low s i d e l o b e s ( F i g u r e 2.2). The Fast F o u r i e r Transform [Cooley + Tukey, 1965; Brenner, 1980] of the windowed data was c a l c u l a t e d . The components between 300 and 2500 Hz were s e l e c t e d by windowing the spectrum. The s p e c t r a l window used had a square lower end and a one quarter width Blackman upper frequency end (Figure 2.3). T h i s window provided a sharp c u t o f f at the low frequency end 18. BLACKMAN WINDOW 10.0 12.0 14.0 16.0 18.0 20.0 Figure 2.1 The waveform i s multiplied by a Blackman window before being transformed. 1000 Hz SINE WAVE FILTERED BETWEEN 300 AND 2500 HZ i — i i i 111 10000. Power in DocibeIs vs Frequency in Hartz Figure 2.2 The Blackman window produces very low s ide lobes as demonstrated by t h i s spec t ra o f a f i l t e r e d s i ne wave. SELECTED AREA i • — i 1 1 1 1 1 0 . 0 1 0 0 0 . 0 2 0 0 0 . 0 3 0 0 0 . 0 FREQUENCY in Hz. Figure 2.3 The s p e c t r a l window passed f requencies between 300 and 2500 Hz. ro o while reducing the r i n g i n g that a sharp high frequency c u t - o f f would produce (Figures 2.4, and 2.5). The Inverse Fast F o u r i e r Transform was then a p p l i e d to produce the f i l t e r e d waveform that was s t o r e d i n an EMG data f i l e . The program EMG could be used to p l o t , d i s p l a y or manipulate the f i l t e r e d s i g n a l . 2.3) R e s u l t s A f t e r d i g i t a l f i l t e r i n g , the SEP evoked by median nerve s t i m u l a t i o n had a s t e r e o t y p e morphology which (see F i g u r e s 2.6, 2.7, and 2.8) c o n s i s t e d of a s e r i e s of r i p p l e s . T h e i r peak and interpeak l a t e n c i e s are summarized i n Tables I and I I . Four negative (N16, N18, N19, and N20) and four p o s i t i v e (P15, P17, P18, and P19) peaks were i n v a r i a b l y r e c o g n i z e d . An e a r l y negative peak, N14, and a l a t e r p o s i t i v e peak, P21, were a l s o f r e q u e n t l y seen (Table I ) . Negative to negative and p o s i t i v e to p o s i t i v e interpeak l a t e n c i e s between N16 and P21 averaged 1.3 + 0.22 ms (range 1 - 1.7 ms). These peaks are only r a r e l y r e c o g n i z a b l e i n the o r i g i n a l SEP. The SEPs i n f i g u r e s 2.7-2.9 are e x e p t i o n a l i n that the peaks can be recognized without f i l t e r i n g . These were chosen f o r the f i g u r e s to show the correspondance between peaks of the f i l t e r e d and u n f i l t e r e d SEPs. Impulse Response FILT. 300. TO 2500. 2.000 -1.000 -0.000 --1.000--2. 000 -2.0 T r T 1 1 r 8.0 10.0 14. 0 — i 1 IB. 0 msec Figure 2.4 The impulse response of the d i g i t a l f i l t e r was noncausal and symmetric. 40.0 20.0 0.0 -20.0 -40.0 -60.0 UNIT IMPULSE FILTERED BETWEEN 300 AND 2500 HZ i 1—i—i i i 11 10. 100. T 1—I I I I I 1000. 1 — I — I I I 11 10000. Power in Decibels vs Frequency i n Hertz Figure 2.5 The frequency response of the d i g i t a l f i l t u r e to a unit impulse. ro u> Pl8 1 1 1 1 1 1 r 12. 0 16. 0 20. 0 msec Figure 2.6 A normal SEP u n f i l t e r e d (top) and f i l t e r e d (bottom). The peaks of the f i l t e r e d signal are recognizable in the u n f i l t e r e d SEP from this person. This i s not usually the case. 10-2500 Hz 1 2 . 0 1 6 . 0 2 0 . 0 2 4 . 0 msec Figure 2.7 Two separate recordings of the SEP from one person are shown u n f i l t e r e d (top) and f i l t e r e d (bottom). The differences between two superimposed waveforms are an indication of the noise present in the recordings. 2 6 . Figure 2 . 8 Four normal SEPs u n f i l t e r e d ( l e f t ) and f i l t e r e d ( r i g h t ) . The time axes have been s h i f t e d to l i n e up the peaks and demonstrate t h e i r consistency. Table I Latencies (ms) of Peaks of F i l t e r e d SEPs PEAK NUMBER PRESENT MEAN SD RANGE N14 16 13.8 0.85 12. 8 14 . 9 P15 24 15.3 0. 82 13.7 - 16.9 N16 24 16. 2 0. 82 14.7 - 17.9 P17 24 17. 0 0. 89 15.1 - 18.5 N18 24 17.6 0.80 15.8 - 19.0 P18 24 18.4 0. 82 16. 6 - 20.9 N19 24 19. 1 0. 86 17.9 - 20.9 P19 24 19.5 0. 88 17. 9 - 21.2 N20 20 20.1 0. 80 18.5 - 21.6 P21 14 20.7 0.96 19.8 — 22. 4 Table I I Interpeak Latencies (ms) INTERVAL # MEASURABLE MEAN SD RANGE NEGATIVE PEAKS N14 - N16 16 2.4 0.4 1.9 - 3.0 N16 - N18 24 1.4 0.2 0.9 - 1.8 N18 - N19 24 1.5 0.2 1.1 - 1.9 N10 - N20 20 1.0 0.2 0.8 - 1.4 POSITIVE PEAKS P15 - P17 20 1.7 0.2 1.3 - 2.2 P17 - P18 20 1.2 0.2 0.7 - 1.4 P18 - P19 24 1.3 0.1 1.0 - 1.5 P19 - P21 15 1.2 0.3 0.5 - 1.4 When a wider m o d i f i e d Blackman window (Figure 2.9) was used on longer sweeps (100 ms), i t was apparent that the peaks e x t r a c t e d by d i g i t a l f i l t e r i n g were r e s t r i c t e d to the r e g i o n of the "N19" component. (see F i g u r e s 2.10, 2.11). S i m i l a r i d e n t i f i a b l e peaks were not seen i n a s s o c i a t i o n with l a t e r SEP components. 2.4) D i s c u s s i o n The a m p l i f i e r and analog f i l t e r s were t e s t e d by p u t t i n g a 0.1 ms wide pu l s e i n t o the a m p l i f i e r and measuring the impulse response. F i g u r e 2.12 shows that the decay of the 2500 Hz r i n g i n g i s such that i t was 35 dB down from the s i g n a l a f t e r 5 ms. In the data c o l l e c t e d the s t a r t of sampling was delayed by 6 to 8 m i l l i s e c o n d s so the stimulus a r t i f a c t was not a problem. The frequency response of the a m p l i f i e r and analog f i l t e r s was measured to be f l a t (+0.3 dB) from 25 to 2000 Hz. The response was down 3 dB at 2500 Hz and down 44 dB at 3800 Hz. To measure the a m p l i f i e r , A/D, and enviromental n o i s e , together with stimulus a r t i f a c t , the r e c o r d i n g e l e c t r o d e s and a ground were placed i n a t r a y of s a l i n e s o l u t i o n that was then s t i m u l a t e d . 1024 epochs were averaged to produce a r e p r e s e n t a t i v e sample of the n o i s e from a l l n o n b i o l o g i c a l sources WINDOW USED ON SLOWLY SAMPLED DATA 0.0 20.0 40.0 60.0 80.0 100.0 I N C Figure 2.9 A modified Blackman window was used with longer waveforms. o 4.000 -2.000 -0. 000 -2. 000 --4.000 -msec Figure 2 . 1 0 A normal SEP recorded with a longer ( 100 ms) epoch. CO FILTERED 300 to 1500 Hz. 0. 400 0.200 0.000 -0. 200 -0.400 10.0 30.0 50.0 70.0 90.0 msec Figure 2.11 The result i f d i g i t a l l y f i l t e r i n g the SEP of figure 2 . 1 0 . The signal rises and f a l l s around the 20 ms point. OJ ro 2.000 - i -2 . 000 msec Figure 2.12 The impulse response of the DISA 15C01 amplifier and the Krohn-Hite 3342 f i l t e r used to record the SEPs. which i s shown in F i g u r e s 2.13 and 2.14. The t y p i c a l SEP r e c o r d i n g s t a r t e d e i g h t ms a f t e r the s t i m u l u s . In the r e g i o n of the t y p i c a l r e c o r d i n g the stimulus a r t i f a c t i s not present and the noise was 34 dB below the s i g n a l . The t o t a l noise was measured, i n 50% of the s u b j e c t s , by averaging 1024 epochs of the SEP with the s t i m u l a t o r turned o f f (Figure 2.15). The t o t a l noise was t y p i c a l l y 30 dB below the SEP a f t e r averaging 1024 epochs. I f a s u b j e c t was abnormally noisy the r e c o r d i n g s were redone. F i g u r e 2.16 compares the s p e c t r a of: a median SEP, the same measurement with no s t i m u l u s , and the n o n b i o l o g i c a l n o i s e . At f r e q u e n c i e s above 1000 Hz the SEP of a normal s u b j e c t was dominated by n o i s e . F i g u r e 2.17 shows the s p e c t r a of the SEP before and a f t e r f i l t e r i n g and demonstrates the sharp c u t o f f of the d i g i t a l f i l t e r (greater than 50 dB per o c t a v e ) . The d i g i t a l f i l t e r i n g i ntroduced no phase s h i f t i n the components of the f i l t e r e d wave because the frequency s e l e c t i o n window was s t r i c t l y r e a l and symmetric about the Nyquist frequency. The noncausal symmetric impulse response shown in F i g u r e 2.4 i l l u s t r a t e s t h i s . The Blackman Window changed the r e l a t i v e amplitude at d i f f e r e n t p o i n t s of the waveform, depending upon where they were Nonbio log ica l Noiso Avoragod 1024 Timas 2.000 H 1.000 -0.000 --1.000--2.000 4 C l ipped Shown in Dotal1 On th« N«xt Pag* St imulus A r t i f a c t B.00 S ta r t of Typ i ca l SEP Recording T 1 1 1 1 1 1 1 6.0 10.0 14.0 18.0 msec Figure 2.13 An estimate of the nonbiological noise present in an SEP recording was measured. Deta i l of Nonb io log ica l Noiso 0.080 -0.040 -0.000 --0 . 040 --0. 080 -msec Figure 2.14 A detailed look at a section of figure 2.13. Tota l Noiso Averagod 1024 Times 0.150 -msec Figure 2.15 The total noise present in an SEP recording was estimated by recording the potential with no stimulus. Typ ica l Normal Spect ra -50.0 -70.0 -90.0 -110.0 -130. 0 -150.0 i i i n 1000. I I 1 I I I I 10000. Power i n Decibels vs Frequency i n Hertz Figure 2.16 The spectra of an SEP and of noise measurements. At high frequencies the normal SEP becomes dominated by noise. CO 00 -50.0 -70.0 -90.0 -110.0 -130.0 -150.0 Power i n Decibels vs Frequency i n Hertz Figure 2.17 The spectra of a f i l t e r e d and u n f i l t e r e d SEP. The d i g i t a l f i l t e r has a cutoff rate of greater than 50 dB per octave. 40. i n the window. For t h i s reason a modified Blackman Window (Figure 2.9) was used with 100 ms long sweeps when one wished to compare the amplitudes of d i f f e r e n t s e c t i o n s of the wave. The f l a t p o r t i o n of the M o d i f i e d Blackman Window allowed accurate comparisons of the amplitude of d i f f e r e n t peaks.. The much longer sweep time overcame the e f f e c t of the l a r g e r window s i d e l o b e s . When using the longer sweep times the d i g i t a l f i l t e r band-pass used was 300 to 1500 Hz and the Krohn-Hite low pass f i l t e r was set to 1500 Hz. When employing the M o d i f i e d Blackman Window, i t was apparent that the p o t e n t i a l s e x t r a c t e d by d i g i t a l f i l t e r i n g were r e s t r i c t e d i n d i s t r i b u t i o n (see F i g u r e s 2.10, 2.11). They rose and f e l l f a i r l y a b r u p t l y around "N19" with onsets at about 16 ms. If the beginning or end of the wave i s not c l o s e to the DC median, then m u l t i p l y i n g by the Blackman window w i l l produce d i s t o r t i o n s at the f r e q u e n c i e s that are being c o n s i d e r e d . F i g u r e 2.22 shows the Blackman window i t s e l f f i l t e r e d between 300 and 2500 Hz. While these r i p p l e s were more than 30 dB below the s i g n a l i n the c e n t r a l r e g i o n , they are n o t i c e a b l e at the edges of many of the f i l t e r e d waves. Figure 2.18 An SEP highpass fi ltered with various cutoff frequencies. The peaks remain aligned. SEP Analog F i l t e r e d 300 to 2500 Hz. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2.0 6.0 10.0 14.0 16.0 22.0 26.0 30.0 msec Figure 2.19 An analog highpass f i l t e r produced substantial ringing from the stimulus a r t i f a c t . Latency S h i f t Due To Analog F i l t e r i n g 0.400 H 0.200 H LIV 0.000 H -0.200 H -0 . 400 H i*—Analog F i l t e r e d msec Figure 2.20 An analog highpass f i l t e r produced phase s h i f t . -p. oo No Latency S h i f t With D i g i t a l F i l t e r i n g 10.0 14.0 18.0 22.0 26.0 msec Figure 2.21 The digital f i l ter produced no ringing and no phase shift. In t h i s study, d i g i t a l f i l t e r i n g revealed s e v e r a l SEP components. For the f o l l o w i n g reasons they were not considered a r t i f a c t u a l : 1. The same time l o c k e d , but l e s s c l e a r l y i d e n t i f i a b l e components were recorded i n most s u b j e c t s before d i g i t a l f i l t e r i n g (see f i g s 2.7, 2.8, and 2.9). 2. There was a l a t e n c y s h i f t of corresponding components i n d i f f e r e n t s u b j e c t s i n keeping with v a r i a b l e limb l e n g t h . On the other hand there was constancy of component l a t e n c i e s recorded at d i f f e r e n t times i n a given i n d i v i d u a l . 3. When the Blackman window was s h i f t e d to the r i g h t or l e f t , component peaks remained true to l a t e n c y . 4. Analog f i l t e r i n g with a s i m i l a r pass band has a l s o allowed the e x t r a c t i o n of s i m i l a r small amplitude, high frequency components, but does induce phase s h i f t (King and Green, 1979; R o s s i n i et a l , 1981; Luders et al,1983; Maccabee et a l , 1983). BLACKMAN WINDOW F I L T E R E D 300 TO 2500 HZ. PERONEAL SEP F I L T E R E D 300 TO 2500 HZ —i 1 1 1 1 1 1 i 1 22.0 26.0 30.0 34.0 38.0 msec Figure 2.22 The edges of the f i l tered signals contain artifact due to windowing. 2.5) CONCLUSION D i g i t a l f i l t e r i n g u s i n g t h e Blackman Window and a p a s s band o f 300 t o 2500 Hz was a p p l i e d t o S o m a t o s e n s o r y Evoked P o t e n t i a l s r e c o r d e d w i t h c e p h a l i c b i p o l a r m ontages. The d i g i t a l f i l t e r i n g e l i m i n a t e d t h e p r o b l e m o f r i n g i n g from t h e s t i m u l u s a r t i f a c t and t h e p r o b l e m o f phase s h i f t v a r i a t i o n s o f peak l a t e n c i e s . R e l a t i v e a m p l i t u d e c o m p a r i s o n was n o t a c c u r a t e u s i n g t h e Blackman window; however, " t h e use o f l o n g e r sweep t i m e s and a m o d i f i e d window a l l o w e d a c c u r a t e a m p l i t u d e measurements when s u c h were d e s i r e d . The Blackman window i n t r o d u c e d a s m a l l amount o f h i g h e r f r e q u e n c y d i s t o r t i o n a t t h e edges o f some waves. T h i s a r t i f a c t was e a s i l y r e c o g n i s a b l e and was n o t l a r g e enough t o p o s e a p r o b l e m (30 dB down). F o u r c o n s i s t e n t n e g a t i v e and c o r r e s p o n d i n g p o s i t i v e peaks w i t h l a t e n c i e s o f a b o u t 16, 18, 19, and 20 ms were e l i c i t e d w i t h median n e r v e s t i m u l a t i o n . The i n t e r p e a k l a t e n c i e s measured 1.3 + 0.2 ms. T h e s e peaks a r e r a r e l y i d e n t i f i a b l e i n u n f i l t e r e d SEPs. S i m i l a r p eaks have been e l i c i t e d by l o w e r l i m b s t i m u l a t i o n where t h e y a r e n e v e r v i s i b l e i n t h e u n f i l t e r e d SEPs. The p r e s e n c e o f t h e h i g h f r e q u e n c y p e a k s i n t h e SEP r a i s e s q u e s t i o n s a b o u t t h e c u r r e n t t h e o r i e s o f t h e o r i g i n o f t h e SEP [ E i s e n , 1 9 8 4 ] . The n e x t c h a p t e r o f t h i s work u s e s t h e s e peaks t o d e t e c t M u l t i p l e S c l e r o s i s . DYNAMIC TIME WARPING OF THE FILTERED SEP 3.1) I n t r o d u c t i o n The d i g i t a l l y f i l t e r e d S o m a t o s e n s o r y E v o k e d P o t e n t i a l s , a s d e s c r i b e d i n s e c t i o n 2, h a v e a d i s t i n c t i v e p a t t e r n o f p e a k s ( F i g u r e s 2.6, 2.7, 2.8, 3.1 - 3.5). However, n o t a l l p e a k s a r e s t r o n g l y p r e s e n t i n a l l w a v e s , and t h e r e i s v a r i a t i o n i n t h e i r l a t e n c i e s . T h i s makes t h e a c c u r a t e c o m p u t e r i d e n t i f i c a t i o n o f t h e p e a k s a n o n t r i v i a l p r o b l e m . E v o k e d P o t e n t i a l Waveforms h a v e b e e n r e p r e s e n t e d as l i n e a r c o m b i n a t i o n s o f P r i c i p a l C omponents [ S u t e r , 1970; A u n o n , 1981; Van R o t t e r d a m , 1970]. T h i s a n a l y s i s i s u s e f u l f o r q u a n t i f y i n g c h a n g e s i n one p e r s o n ' s r e s p o n s e due t o v a r y i n g s t i m u l i . T e c h n i q u e s s u c h a s L a t e n c y C o r r e c t e d A v e r a g i n g [Woody, 1967; A u n o n , 1978; A u n o n , 1981] h a v e b e e n u s e d f o r c o r r e c t i n g v a r i a t i o n s i n t h e l a t e n c i e s o f f e a t u r e s o f t h e e v o k e d p o t e n t i a l f r o m one p e r s o n . H o w e v e r , t h e s e t e c h n i q u e s a r e n o t a p p l i c a b l e t o t h e p r o b l e m o f i d e n t i f y i n g c o r r e s p o n d i n g f e a t u r e s i n many d i f f e r e n t p e o p l e . The method u s e d i n t h e p r e s e n t work t o s o l v e t h i s p r o b l e m i s Dynamic Time W a r p i n g w h i c h c a n f i n d an o p t i m a l t i m e a d j u s t m e n t ( s h i f t i n g , s t r e t c h i n g and c o n t r a c t i n g ) b e t w e e n w a v e f o r m s . Dynamic Time W a r p i n g i s t h e u s e o f t h e D y n a m i c P r o g r a m m i n g A l g o r i t h m [ B e l l m a n , 1957; W h i t t l e , 1 9 8 2 ] t o f i n d f r o m g i v e n waves a and b t h e w a r p i n g f u n c t i o n w t h a t m i n i m i z e s a s p e c i f i e d c o s t . 0.600 H -0. 400 H -0. 600 H 10.0 14.0 18.0 22.0 26.0 Figure 3.1 m s Q c A Normal SEP D i g i t a l l y F i l t e r e d 16.0 20.0 24.0 Figure 3.2 msQC 0. 300 0. 200 0. 100 LiV 0.000 -0. 100 -0. 200 -0. 300 A Normal SEP D i g i t a l l y F i l t e r e d 1 1 1 1 1 1 1 1 1 — 8.0 12.0 16.0 20.0 24.0 mSGC Figure 3.3 tn co A Normal SEP D i g i t a l l y F i l t e r e d ~ ~ i 1 1 1 r 1 1 1 1 r 10.0 14.0 18.0 22.0 26.0 Figure 3.4 m s e c A Normal SEP D i g i t a l l y F i l t e r e d 0.200 H 0. 100 0.000 H -0.100 -0. 200 H 18.0 22.0 26.0 Figure 3.5 m s Q c T i s used to represent the number of l o c a t i o n s at which each wave i s sampled. The warping f u n c t i o n w i s a monotonic int e g e r mapping from {1...T} to {1...T} with 0 being used to denote an undefined v a l u e . I t i s u s e f u l to v i s u a l i z e w as a path contained i n the two-dimensional a r r a y { 1...T ; 1...T }, with t being the h o r i z o n t a l parameter and w[t] the v e r t i c a l parameter (Figure 3.12). When the path goes o u t s i d e the a r r a y , w[t] i s undefined and given the symbolic value of 0. The t a i l of a path i s the subset of the path from some t on to the end at T. w i s a warping f u n c t i o n i n that when w[t] i s used to r e p l a c e t i t produces a warped time a x i s . Thus, a[w[t]] i s a f u n c t i o n of t that i s a warped v e r s i o n of a [ t ] . Warping i s composed of three o p e r a t i o n s . The f i r s t , s h i f t i n g , i s produced when w[1.0]^1.0 meaning that the whole wave has been s h i f t e d along the time a x i s . The second, a jump, i s produced when w[t+1.0] > w[t]+1.0 and so the time a x i s has been s t r e t c h e d near the p o i n t s t and t+1. The other form of o p e r a t i o n i s a f l a t spot where w[t+l] = w[t] r e s u l t i n g i n the time a x i s being c o n t r a c t e d between t and t+1. A warping f u n c t i o n i s composed of a s h i f t and any combination of jumps and f l a t spots. A cost f u n c t i o n i s a r e a l valued f u n c t i o n of two waves a and b and a warping w. The i n v e r s e warping f u n c t i o n w ^ i s the f u n c t i o n such t h a t , wherever w i s d e f i n e d and s t r i c t l y monotonic, w _ 1 [ w [ t ] ] = t , and wherever w - 1 i s d e f i n e d and s t r i c t l y monotonic, w [ w ~ ^ [ t ] ] = t . 57. 3.2) Design of the Cost F u n c t i o n The cost f u n c t i o n that i s to be minimized i s a f u n c t i o n of the waves a and b, and the warping f u n c t i o n w. The cost f u n c t i o n used i n t h i s work i s based on the c o r r e l a t i o n Q between wave b[t] and the warped wave a [ w [ t ] ] . A high degree of c o r r e l a t i o n produces a low value of the cost f u n c t i o n , and c o n v e r s l y , a poor c o r r e l a t i o n produces a high value of the cost f u n c t i o n . There i s a l s o a p e n a l t y f u n c t i o n P that i s a f u n c t i o n of w. a i s the c o e f f i c i e n t of the pe n a l t y that c o n t r o l s d i r e c t l y how expensive the p e n a l t y i s . The cost f u n c t i o n C(a,b,w,CY) [Q(a,b,w)> t¥P(w) ] Q (a,b,w) - a P (w) I n f i n i t y [Q (a,b,w) <= aP (w) ] As t h e s o l u t i o n s h a v e t o be f o u n d n u m e r i c a l l y , t h e c o s t f u n c t i o n must be d e s i g n e d s u c h t h a t i t can be c a l c u l a t e d f o r t h e Dynamic Programming A l g o r i t h m . A n e c e s s a r y c o n d i t i o n f o r t h i s i s t h a t t h e c o s t o f any t a i l f r o m some t on t o t h e end T can be c a l c u l a t e d knowing o n l y t h e t a i l and n o t t h e r e s t o f t h e p a t h . T h i s c o n d i t i o n a r i s e s f r o m t h e way i n w h i c h t h e Dynamic Programming A l g o r i t h m works. I t i s d e s i r a b l e t o be a b l e t o compute t h i s c o s t i n a s m a l l number o f o p e r a t i o n s as i t w i l l be c a l c u l a t e d many m i l l i o n s o f t i m e s . The m i n i m i z a t i o n o f t h e c o s t f u n c t i o n was t r a n s l a t e d t o be a m a x i m i z a t i o n o f t h e d e n o m i n a t o r o f t h e r a t i o : Q(a,b , w ) - C*P (w) T h i s a l l o w e d th e c o n t r i b u t i o n s o f t h e t a i l s t o be c a l c u l a t e d from any t i f t h e c o n t r i b u t i o n s t o P and Q o f t h e t a i l c o u l d be c a l c u l a t e d . The c o s t f u n c t i o n i t s e l f c o u l d n o t be c a l c u l a t e d f o r e a c h t a i l and so c o u l d n o t be used d i r e c t l y w i t h t h e Dynamic Programming a l g o r i t h m . 3.2.1) The C o r r e l a t i o n Quotient Q The s i m p l e c o r r e l a t i o n q u o t i e n t T Q = ^ a [ w [ t ] ] b [ t ] t=l i s summed ove r t and not w [ t ] . T h i s f u n c t i o n i s n o t s y m m e t r i c w i t h r e s p e c t t o a and b b e c a u s e T T ^ a [ w [ t ] ] b [ t ] j y ^ b [ w " 1 [ t ] ] a [ t ] t = l t =l As an o v e r r i d i n g p r i n c i p l e i t was d e s i r e d t h a t t h e c o s t f u n c t i o n and t h e s o l u t i o n s be s y m m e t r i c between a and b. S p e c i f i c a l l y , i f w a r p i n g a t o b p r o d u c e d a c o s t C and a w a r p i n g f u n c t i o n w, t h e w a r p i n g o f b t o a s h o u l d p r o d u c e t h e same c o s t C and t h e i n v e r s e o f t h e w a r p i n g f u n c t i o n w - 1. The i n c l u s i o n o f t h e sub sum a [ s ] b [ t ] w[t]>s>w[t-l] made t h e f u n c t i o n s y m m e t r i c by summing a l l o f t h e p o s i t i o n s i n a jump, j u s t as a l l o f t h e p o s i t i o n s i n a f l a t s p o t a r e summed. T h i s p r o d u c e d t h e m o d i f i e d c o r r e l a t i o n q u o t i e n t T Q = 2^ a [ w [ t ] ] b [ t ] + t=l . / a [ s ] b [ t ] w[t]>s>w[t-l] The c o r r e l a t i o n q u o t i e n t u t i l i z e d t h e a b s o l u t e m i c r o v o l t s c a l e o f t h e waves, as oppo s e d t o t h e t y p i c a l c o r r e l a t i o n t h a t would be d i v i d e d by t h e RMS v a l u e o f each wave. T h i s a c t e d as a s a f e t y f e a t u r e i n t h a t v e r y s m a l l waves t h a t a r e -mostly b a c k g r o u n d n o i s e would p r o d u c e a l a r g e c o s t , even i f t h e i r shape happened t o be c l o s e t o t h a t o f a n o r m a l wave. I t s h o u l d be n o t e d t h a t any DC o f f s e t i n t h e waves was removed p r i o r t o w a r p i n g t o p r e v e n t t h e DC from b i a s i n g t h e c o r r e l a t i o n . The p a t h w i s c o n s t r a i n e d t o be m o n o t o n i c a l l y i n c r e a s i n g , w h i c h i s a s u f f i c i e n t c o n d i t i o n f o r the e x i s t e n c e o f a u n i q u e i n v e r s e . As t h e f u n c t i o n s r a n g e o v e r d i s c r e t e t i m e r a t h e r t h a n c o n t i n u o u s t i m e , d i s c o n t i n u i t i e s i n t h e i n v e r s e a r e n o t a p r o b l e m . T h i s a l l o w s s e c t i o n s o f t h e p a t h s t o have s l o p e z e r o ( f l a t s p o t s ) . 3.2.2) C o n s t r a i n t s and the Penalty Function Dynamic Time Warping has been used i n speech r e c o g n i t i o n [Rabiner, et a l , 1978; Myers + Rabiner, 1981; Myers et a l , 1980; Brown + Rabiner, 1982]. In speech a p p l i c a t i o n s , the s t a r t and end of the word had been i d e n t i f i e d before the Time Warping was a p p l i e d . T h i s allowed the endpoints of the warping f u n c t i o n to be c o n s t r a i n e d to be (0,0) and (T,T). These endpoint c o n s t r a i n t s were not p o s s i b l e i n our a p p l i c a t i o n because, while the v a r i a t i o n s i n onset l a t e n c y due to arm-length were c o r r e c t e d when the SEP 1s were recorded, that c o r r e c t i o n was merely a l e a s t squares e r r o r adjustment and not an i d e n t i f i c a t i o n of the onset of the wave. T h e r e f o r e , d i f f e r e n t waves d i d not n e c e s s a r i l y s t a r t at the same p o i n t . S i m i l a r l y , the f i n i s h of d i f f e r e n t waves d i d not match e x a c t l y . T h i s meant that there could be no endpoint c o n s t r a i n t s . The endpoints had to be able to be s h i f t e d to c o r r e c t f o r any v a r i a t i o n i n alignment. In the speech r e c o g n i t i o n a p p l i c a t i o n s a very severe c o n t i n u i t y c o n s t r a i n t was used. The warping f u n c t i o n was c o n s t r a i n e d to have jumps with a height of at most 1.0, and f l a t spots of l e n g t h at most 1.0. T h i s seemed a harsh and a r b i t r a r y c o n s t r a i n t that would tend to produce s o l u t i o n s that were cons t r a i n t - b o u n d r a t h e r than g l o b a l l y o p t i m a l . I t was decided that a more elegant method of producing reasonable warping f u n c t i o n s would be to i n c l u d e a p e n a l t y f o r d i s c o n t i n u i t i e s i n the cost f u n c t i o n . The p e n a l t y f u n c t i o n c o u l d be o f t h e form: T - l P(w) = ^ | w [ t + l ] - w [ t ] - 1 | n t=l The p a r a m e t e r n d e t e r m i n e s how s e v e r e l y l a r g e jumps a r e t o be p e n a l i z e d r e l a t i v e t o s m a l l jumps. As n a p p r o a c h e s i n f i n i t y , t h e p e n a l t y f u n c t i o n becomes t h e c o n s t r a i n t used i n s p e e c h r e c o g n i t i o n . F o r n = l : T - l P(w) = ^ | w[t+l] - w[t] - 1 t=l T h i s c o m p u t a t i o n a l l y v e r y s i m p l e p e n a l t y f u n c t i o n d i d not s t r o n g l y p e n a l i z e l a r g e jumps, and so t h e w a r p i n g f u n c t i o n s were o f t e n s e v e r e l y d i s c o n t i n u o u s . I n c r e a s i n g t h e p e n a l t y c o e f f i c i e n t , OL , enough t o p r e v e n t l a r g e jumps e l i m i n a t e d t h e s m a l l v a r i a t i o n s as w e l l . F o r n=2: T - l P(w) = / (w[t+l] - w[t] - l ) 2 63. T h i s p e n a l t y f u n c t i o n i s n o t s y m m e t r i c i n t h a t t h e f l a t s p o t s a r e p e n a l i z e d l i n e a r l y r a t h e r t h a n p r o p o r t i o n a l l y t o t h e s q u a r e o f t h e i r l e n g t h . U s i n g t h e i d e n t i t y : 2 x and t h e f o r m u l a f o r t h e l e n g t h o f t h e f l a t s p o t f r o m t on: i n f { s - t - l s u c h t h a t s e { l . . T ] ; s > t ; w [ s ] ^ w [ t ] } T - l p r o d u c e d t h e s y m m e t r i c p e n a l t y f u n c t i o n P = ^ *p(w,t) t = l p(w,t) = < w [ t + l ] - w [ t ] - l ) 2 [ 2 i n f { s - t - 1 | s e { t . . T ] ;w[s] ?^w[t] }-l [w[t+l]>w[t]] [w[t+l]=w[t]] T h i s f u n c t i o n solved the problem of severe d i s c o n t i n u i t i e s by p e n a l i z i n g l a r g e jumps or long f l a t s e c t i o n s very s e v e r e l y . A disadvantage of the squared p e n a l t y , that a l l such n o n l i n e a r p e n a l t i e s share, i s that the dynamic programming a l g o r i t h m may not produce the optimal s o l u t i o n . The pen a l t y f o r a s e c t i o n with slope zero i s the square of the length of the s e c t i o n . The previous length of the f l a t spot a f f e c t s the p e n a l t y f o r c o n t i n u i n g the f l a t spot. T h i s means that l o c a l l y optimal paths may not be g l o b a l l y o p t i m a l , i . e . ; the best path from ( s , j ) to (t,k) may not be a s u b s e c t i o n of the best path from ( r , i ) through (s, j ) to ( t , k ) . T h i s may r e s u l t i n paths t h a t , when traced backwards, have a zero slope s e c t i o n s t a r t i n g one p l a c e too soon. T h i s i s not a major problem as the a l g o r i t h m i s robust and the paths found w i l l be very c l o s e to o p t i m a l . (X i s the c o e f f i c i e n t of the pen a l t y that c o n t r o l s d i r e c t l y how expensive i t i s to warp. A small ( 0 . 0 0 1 ) value of (X produced extreme warpings. A l a r g e ( 0 . 1 ) value of 0 ! produced warping f u n c t i o n s that were merely s h i f t s with no jumps or f l a t spots at a l l . The a p r o p r i a t e value, Oi = 0 . 0 0 7 5 , was s e l e c t e d by t r i a l and e r r o r . 3.2.3) Summary of Cost Function Used The cost f u n c t i o n C ( a , b , w , a ) = Q (a,bfw)-t>! P (w) [Q(a,b,w)> 0£P(w)] I n f i n i t y [Q (a,b,w) <= aP (w) ] where the c o r r e l a t i o n q u o t i e n t T Q t = l a [ w [ t ] ] b [ t ] + ? a[ s ] b [ t ] w[t]>s>w[t-l] Z T - l and the p e n a l t y f u n c t i o n P = ^ * p(w,t) t = l n- H _ \ ( w [ t + i ] - w t t i - i ) 2 [ w [ t + i ] > W [ t n p(w,t) - I 2 i n f { s - t - l | s e f t . . T ] ; w [ s ] / w [ t ] } - l [w[t+1]=w[t]] 3.3) Implementation As the number of p o s s i b l e paths w[t] i n c r e a s e s e x p o n e n t i a l l y with T i t i s not f e a s a b l e to compare a l l p o s s i b l e paths to f i n d the best one. The Dynamic Programming A l g o r i t h m f i n d s the optimal path using only a number of o p e r a t i o n s p r o p o r t i o n a l to T^. By assuming that the s o l u t i o n w i l l have no jumps l a r g e r than some constant, the number of o p e r a t i o n s can be reduced to being 2 p r o p o r t i o n a l to T . In the case at hand, where the number of samples i n a wave equals one thousand, even t h i s i s too slow as i t would take over an hour to warp one p a i r of waves on the l a b o r a t o r y PDP-11/23. However, due to the windowing, only the center regions of the waves are of i n t e r e s t . T h i s allows one to look at only the c e n t r a l 600 samples. As the sampling frequency i s ten times the Nyquist frequency and the d i g i t a l l y f i l t e r e d data i s quantized with fourteen b i t accuracy, the sampling r a t e can be reduced by a f a c t o r of s i x without l o s i n g much i n f o r m a t i o n . T h i s makes T=100 and allows the warping to be done i n under a minute. Warpings with T=200 were computed and compared to the T=100 warpings. There was not a s i g n i f i c a n t d i f f e r e n c e between the two. The Dynamic Programming Al g o r i t h m c o n s i d e r s the warping f u n c t i o n s as paths through a square a r r a y . The a l g o r i t h m s t a r t s at the end (t=T) and column by column f i n d s the lowest cost t a i l s s t a r t i n g i n each row of that column. In t h i s a p p l i c a t i o n the al g o r i t h m found the maximum values f o r the denominator of the cos t f u n c t i o n evaluated over the t a i l s . The Pascal implementation of the a l g o r i t h m i s documented i n Appendix 3. 3.4) The Standard Wave A standard wave was c o n s t r u c t e d to serve as a template. Unknown waves can be warped to t h i s template to determine i f they f i t the p a t t e r n of normal SEPs. The standard wave was c o n s t r u c t e d to be a r e p r e s e n t a t i v e mean of the set of 24 normal d i g i t a l l y f i l t e r e d waves. For each ie{l..T} the normal waveforms a^ were warped to every wave a^ j e { l . . T } . Let the r e s u l t i n g cost be represented by C ^ . T The mean co s t M.= y C../T was c a l c u l a t e d f o r each j 3 ' * 13 i = l a l o n g w i t h t h e v a r i a n c e T V.= > C 2 . / T 3 Z _ J 1 J i = l The means and v a r i a n c e s were s c a l e d by t h e c o s t o f t h e wave a. 3 warped t o i t s e l f . T h i s s c a l i n g was done t o remove t h e v a r i a t i o n due t o t h e a m p l i t u d e o f t h e waves. A f t e r one e s p e c i a l l y l a r g e and two e s p e c i a l l y s m a l l waves were e l i m i n a t e d f r o m c o n s i d e r a t i o n , t h e wave w i t h t h e s m a l l e s t s c a l e d mean and v a r i a n c e was c h o s e n as t h e median wave o f t h e s e t . '. =V . /C . . 3 T 33 MV=M j/SQRT(C j j) STANDARD DIGITALLY FILTERED SEP 0.300 -0.200 -0.100 -0.000 --0 . 100 --0 . 200 --0. 300 -10.0 14.0 18.0 —I 22.0 — i r 26.0 msec Figure 3.6 The standard wave was constructed to serve as a template to which unknown signals are compared. msec Figure 3.7 This average SEP was constructed by applying the warping functions generated by the f i l t e r e d SEPs to the o r i g i n a l SEPs, and averaging together the results. 71. L e t w. r e p r e s e n t t h e w a r p i n g f u n c t i o n p r o d u c e d by w a r p i n g wave t o t h e median wave. s ( t ) i s t h e s t a n d a r d wave where T s ( t ) = a. [w.[t]]/T i = l I . e . a l l o f t h e n o r m a l waves were e a c h warped t o t h e m edian wave and a v e r a g e d p o i n t w i s e t o p r o d u c e t h e s t a n d a r d wave. To c h e c k t h e v a l i d i t y o f t h e p r o c e s s o f c o n s t r u c t i o n o f t h e s t a n d a r d wave, e a c h member o f t h e s e t o f n o r m a l waves was warped t o t h e s t a n d a r d wave. When t h e mean and v a r i a n c e o f t h e c o s t s were e s t i m a t e d and s c a l e d as b e f o r e , t h e y were s m a l l e r t h a n t h o s e o f t h e median wave, v a l i d a t i n g t h e a v e r a g i n g p r o c e s s . W h i l e no c l a i m i s made t h a t t h e s t a n d a r d wave i s t h e optimum t e m p l a t e , i t i s b e t t e r t h a n any o f t h e waves i n t h e s e t o f n o r m a l s . The s t a n d a r d wave i s shown i n F i g u r e 3.6. F i g u r e 3.7 shows t h e a v e r a g e o f t h e SEPs warped w i t h t h e c o r r e s p o n d i n g w a r p i n g f u n c t i o n s . In F i g u r e s 3.8 and 3.9 warped waves a r e p l o t t e d below t h e s t a n d a r d wave. N o t i c e how t h e peaks l i n e up. F i g u r e 3.10 0.300 -0.200 -0. 100 -pV 0.000 -0. 100 -0. 200 --0. 300 -Tho Standard Wava A Normal Warped Wave 10.0 — i — 14.0 —I 18.0 —I 22.0 —I 26.0 msQC Figure 3.8 A normal wave that has been warped to the Standard Wave. Notice how the peaks l i n e up. A N o r m a l W a v e 0.600 -0.400 -0.200 -0. 000 -0. 200 -0. 400 --0. 600 -S t a n d a r d W a v e W a r p e d 10.0 1 1— 14.0 18.0 —i r 22.0 —i r 26.0 msec Figure 3.9 Another normal wave tha t has been warped to the Standard Wave. 10.0 14.0 18.0 22.0 26.0 msec Figure 3.10 Comparing waves before and aft e r warping. This wave is also shown in figure 3.9. An MS Wave l r 8.0 12.0 16.0 20.0 24.0 msec Figure 3.11 An MS wave that has been warped to the Standard Wave. Note how severe warping has lined up some peaks of the irr e g u l a r l y shaped wave. compares the warped wave of f i g u r e 3.9 to what i t was before warping. F i g u r e 3.11 shows an MS wave warped to the standard wave. F i g u r e s 3.12 to 3.17 are graphs of the warping f u n c t i o n s . 3.5) C l i n i c a l Test A c l i n i c a l t e s t was developed using the Dynamic Time Warping Alg o r i t h m : 1) The p a t i e n t s SEP would be recorded using the techniques d e s c r i b e d above. 2) The SEP would be d i g i t a l l y f i l t e r e d between 300 and 2500 Hz. 3) The f i l t e r e d SEP would be warped to the Standard Wave. 4) The r e s u l t i n g Cost F u n c t i o n value would be compared to the mean of the values of the normal waves Twenty-five M u l t i p l e S c l e r o s i s p a t i e n t s volunteered f o r t h i s experiment. Based on a c o n s t e l l a t i o n of l a b o r a t o r y t e s t s over a p e r i o d of s e v e r a l years, each of the p a t i e n t s had been diagnosed as having M u l t i p l e S c l e r o s i s . Twenty-four of the v o l u n t e e r s were c l a s s i f i e d as D e f i n i t e MS and one was c l a s s i f i e d as Probable MS. A Normal Warping Funct ion 0. 200. 400. 600. 600. 1000. Figure 3.12 An example of the warping function generated by a normal waveform. Some Normal Warping Funct ions 0. 200. 400. 600. 800. 1000. t Figure 3.13 A comparison of several normal warping functions. 00 A l l of the Normal Warping Funct ions 0. 200. 400. 600. 800. 1000. Figure 3.14 All twenty-four normal warping functions superimposed. An MS Warping Funct ion 1000.-0. 200. 400. 600. 800. 1000 t Figure 3.15 An example of an MS warping function. There i s l i t t l e apparent difference between the MS and normal functions. Some MS Warping Funct ions 0. 200. 400. 600. 800. 1000. t Figure 3.16 Several MS warping functions. A l l of the M S Warping Funct ions 0. 200. 400. 600. 800. 1000. Figure 3.17 A l l twenty-five MS warping functions. Variations in latency cause a wide variety of s h i f t s . Only s i x of the t w e n t y - f i v e had symptoms i n the median nerve system that was to be s t i m u l a t e d . The r e s t had s p i n a l , o p t i c or other systems a f f e c t e d . There were nineteen females (ages 39 + 11) and s i x males (ages 45+9). T h e i r SEPs were recorded using the same technique as d e s c r i b e d i n s e c t i o n 3.2 f o r the Normals. 3 . 6 ) Results The mean of the MS group was 5.089 compared to 1.305 f o r the Normals. The standard d e v i a t i o n was 4.277 f o r the MS group and 0.501 f o r the Normal group. With the l i m i t of n o r m a l i t y placed at three standard d e v i a t i o n s above the Normal mean, t h i s t e s t i d e n t i f i e d f ourteen out of the twenty f i v e MS p a t i e n t s as being abnormal. None of the Normals were so i d e n t i f i e d . Table I I I The C o s t F u n c t i o n V a l u e s Normal M S Results Results 2.456 5. 627 * * * 1.036 0. 903 0.525 1.217 1.218 0. 906 2.174 0.738 1.073 12.215 * * * 0.918 3.040 *** 1.216 3.165 * * * 1.120 1.952 1.454 2.291 1.270 1.675 0. 529 1.881 0. 772 9.134 * * * 1.270 13.382 * * * 1. 673 3.971 *** 2.263 0.701 0.894 6.357 * * * 1.184 9.578 * * * 1.150 3.428 *** 1. 046 1.785 1.506 9. 587 * * * 2.128 1. 632 1.066 13.972 *** 1.376 7.282 *** 10.812 *** * More t h a n t h r e e S t a n d a r d D e v i a t i o n s above t h e N o r m a l Mean . What happens when there i s a missing Apeak' The missing peak i s ignored. Figure 3.18 Standard Wave Unwarped Warped CO cn 3.7) D i s c u s s i o n The use of the p e n a l t y f u n c t i o n r a t h e r than severe c o n t i n u i t y c o n s t r a i n t s as used i n speech r e c o g n i t i o n i n c r e a s e d the computation time by a f a c t o r of f o u r . In a c l i n i c a l s e t t i n g t h i s warping would be done at most twice per p a t i e n t , and t h e r e f o r e the d i f f e r e n c e between 15 seconds of computation and one minute i s not much of a burden. The Cost F u n c t i o n worked w e l l i n i d e n t i f y i n g MS p a t i e n t s . The Cost F u n c t i o n i s r i g o r o u s l y compared to other f e a t u r e s of the SEP i n chapter 5. I t i s concluded that t h i s i s a very s e n s i t i v e t e s t f o r M u l t i p l e S c l e r o s i s . To t e s t the s t a b i l i t y of t h i s t e s t over time, one of the Normal v o l u n t e e r s was r e t e s t e d s i x months a f t e r the i n i t i a l t e s t . The i n i t i a l Cost F u n c t i o n was 1.073 and the r e t e s t r e s u l t was 1.063. T h i s i s a very small change i n s i x months, i n d i c a t i n g t h a t i n Normals the t e s t i s s t a b l e . One would expect major changes over time with MS p a t i e n t s as the d i s e a s e progressed or r e m i t t e d . The r e s u l t s gained from ongoing c l i n i c a l use of t h i s t e s t with the MS p a t i e n t s w i l l e l u c i d a t e t h i s . MEASUREMENT OF THE DISPERSION OF THE SEP 4.1) I n t r o d u c t i o n A b n o r m a l i t i e s of smoothness or lack of s y n c h r o n i z a t i o n (Dispersion) i n the Somatosensory Evoked P o t e n t i a l are common in d i s e a s e . I t has long been known that p e r i p h e r a l mixed or sensory nerve a c t i o n p o t e n t i a l s can have a s i g n i f i c a n t amount of d e s y n c h r o n i z a t i o n i n d i c a t i n g d i s e a s e , even though the l a t e n c y , and t h e r e f o r e conduction v e l o c i t i e s , are normal with amplitude being only s l i g h t l y reduced. This r e f l e c t s the f a c t that a s i g n i f i c a n t number of myelinated axons are conducting at v a r i a b l e speeds, although there are s t i l l a few la r g e - d i a m e t e r , f a s t - c o n d u c t i n g f i b r e s capable of normal conduction. I t has been shown p r e v i o u s l y [Roberts, Lawrence + E i s e n , 1983; E i s e n , Lawrence, Roberts + H o i r c h , 1982] that the d e s y n c h r o n i z a t i o n of the SEP would be a u s e f u l parameter. Conversely, F i g u r e 4.1 shows that even i n a confirmed MS p a t i e n t a very normal median nerve SEP can be observed. F i g u r e s 4.2, 4.3 and 4.4 more t y p i c a l l y show a shape abnormality and lack of smoothness. 4.000 -2.000 -0. 000 -2. 000 --4. 000 -An MS Median SEP 12.0 16.0 20.0 24.0 Figure 4.1 msGC An MS Median SEP 1.200 H 0.800 H -1.200-4 24.0 Figure 4.2 0. BOO 0.400 H o.ooo H -0. 400 -0. BOO H Figure 4.3 m s e c 0.600 -J 0.400 H -0. 400 --0. 600 -An MS Median SEP 10.0 — I r 14.0 18.0 — | r 22.0 —1 r 26.0 Figure 4.4 m s e c ro Fast F o u r i e r Transform techniques were used to q u a n t i f y the smoothness of Somatosensory Evoked P o t e n t i a l s . For median nerves the measure used f o r the e v a l u a t i o n was the energy between 1000 and 2500 Hz. 4.2) Methods Twenty-five M u l t i p l e S c l e r o s i s p a t i e n t s volunteered f o r t h i s experiment. Based on a c o n s t e l l a t i o n of l a b o r a t o r y t e s t s over a p e r i o d of s e v e r a l y e a r s , each of the p a t i e n t s had been diagnosed as having M u l t i p l e S c l e r o s i s . Twenty-four of the v o l u n t e e r s were c l a s s i f i e d as D e f i n i t e MS and one was c l a s s i f i e d as Probable MS. Only s i x of the t w e n t y - f i v e had symptoms i n the median nerve system that was to be s t i m u l a t e d . The r e s t had s p i n a l , o p t i c or other systems a f f e c t e d . There were nineteen females (ages 39 _+ 11) and s i x males (ages 45+_9). Th e i r SEPs were recorded using the technique d e s c r i b e d i n s e c t i o n 3.2. Normal Somatosensory Evoked P o t e n t i a l s had been recorded as d e s c r i b e d i n s e c t i o n s 2.2. These p o t e n t i a l s , recorded from 24 Normal and 25 M u l t i p l e S c l e r o s i s v o l u n t e e r s , were examined i n the frequency domain. 94. In the a n a l y s i s any DC component of the s i g n a l was removed. The s i g n a l was windowed using the Blackman Window: 2 TT i 4 7T i w(i)=0.42 - 0.5cos( ) + 0.08cos( ) N-1 N-1 where N i s the width of the window and i runs between 0 and N-1. F i g u r e 3.1 shows the shape of the Blackman Window. The windowed data was contained i n an array of 1024, 32 b i t f l o a t i n g p o i n t v a l u e s . The Fast F o u r i e r Transform a l g o r i t h m [Cooley+Tukey, 1965] was used to c a l c u l a t e the power spectrum. The power spectrum was then s c a l e d to have a maximum value of one. The D i s p e r s i o n F i g u r e was d e f i n e d to be the sum of the energy i n the s c a l e d s p e c t r a between 1000 and 2500 Hz. 4.3) Results Graphs of the F o u r i e r s p e c t r a of the SEP *s showed t h a t , r e l a t i v e to t h e i r maximum value, most Normal waveforms had very l i t t l e energy above 1000 Hz, w h i l e , on average, the MS waveforms had s i g n i f i a n t l y more (Figures 4.5 to 4.11) The Spectrum of a Normal SEP 50.0 70.0 Power In Decibels vs Frequency i n Hertz Figure 4.5 The Spectrum of a Normal SEP 50.0 70.0 Power i n Decibels vs Frequency i n Hertz Figure 4.6 The Spectrum of a Normal SEP 50.0 70.0 90.0 -110.0 -130.0 -150.0 10. 100. 1000. 10000. Power In Decibels vs Frequency in Hertz Figure 4.7 The Spectrum of a Normal SEP 50.0 70.0 Powar In Docibole vs Frequency i n Hertz Figure 4.8 The mean D i s p e r s i o n F i g u r e o f t h e s e t o f No r m a l s was 0.0019, w i t h a s t a n d a r d d e v i a t i o n o f 0.0020. One o f t h e Normal SEPs had a D i s p e r s i o n F i g u r e o f 0.0090, w h i c h i s t h r e e and one h a l f s t a n d a r d d e v i a t i o n s f r o m t h e mean. The n o n t y p i c a l SEP was r e - e x a m i n e d t o d e t e r m i n e i f t h e r e c o r d i n g was e x c e s s i v e l y n o i s y , b u t t h i s was n o t t h e c a s e . S e t t i n g t h e o u t e r l i m i t o f n o r m a l i t y a t t h r e e s t a n d a r d d e v i a t i o n s from t h e Normal mean j u d g e d as abn o r m a l s e v e n o f t h e t w e n t y - f i v e MS SEPs and one o f t w e n t y - f o u r Normal SEPs. The Spectrum of an MS SEP 50.0 70.0 -90.0 -110.0 -130. 0 -150.0 i — i — i i i 1 1 1000. T I I I I I 10000. Power In Decibale vs Frequency In Hertz Figure 4.9 The Spectrum of an MS SEP 50.0 -70.0 -90.0 -110.0 -130.0 -150. 0 10. ----........ ... . , , | , | 1 1 1 1 1 1 1 1 '1 l^to* 100. 1000. 10000. Power in Decibale vs Frequency in Hertz Figure 4.10 -50.0 -70.0 -90.0 -110.0 -130.0 -150. 0 10. The Spectrum of an MS SEP ----1 • 1 ' 1 I I I I 1 T r - r . T T | | | — , , w i w 100. 1000. 10000. Power In Dec1bale vs Frequency In Hertz Figure 4.11 103. Table IV Values of the D i s p e r s i o n F i g u r e NORMAL M S 0.0010 0.0021 0.0010 0.0008 0.0009 0.0003 0.0048 0.0002 0.0008 0.0011 0.0009 0.1212 * * * 0.0007 0.0020 0.0003 0.0150 *** 0.0020 0.0029 0.0013 0.0005 0.0034 0.0006 0.0022 0.0004 0.0090 *** 0.0000 0.0004 0.0106 *** 0.0002 0.0032 0.0010 0.0158 * * * 0.0006 0.0052 0.0029 0.0261 * * * 0.0027 0.0007 0.0043 0.0002 0.0004 0.0235 * * * 0.0005 0.0037 0.0010 0.0304 *** 0.0031 0.0009 0.0008 Normal Mean = 0.0019 Normal Standard D e v i a t i o n = 0.0020 *** More than three standard d e v i a t i o n s above the normal mean. 4.4) D i s c u s s i o n A Blackman d a t a window was c h o s e n b e c a u s e o f i t s v e r y low s i d e l o b e s ; t h e f i r s t s i d e l o b e b e i n g down 65 dB. F o r normal d a t a t h e power s p e c t r u m was down 40-50 dB i n t h e r e g i o n o f i n t e r e s t , compared t o the maximum peak. Any s u b s t a n t i a l s i d e l o b e s i n t h i s r e g i o n would have d o m i n a t e d t h e d a t a . The Blackman window's wide main l o b e , a l t h o u g h t e n d i n g t o smear t h e d a t a ' s f r e q u e n c y s p e c t r u m , was t o l e r a t e d b e c a u s e we were i n t e r e s t e d i n t h e c o m p a r a t i v e e n e r g y i n a band o f f r e q u e n c i e s . The f r e q u e n c y band s e l e c t e d h e r e was h i g h e r t h a n t h a t s e l e c t e d i n p r e v i o u s l y p u b l i s h e d works [ R o b e r t s , Lawrence + E i s e n 1983; E i s e n , L a w r e n c e , R o b e r t s , + H o i r c h , 1 9 8 2 ] . T h e r e , t h e a n a l o g f i l t e r s were s e t w i t h a l o w - p a s s r o l l - o f f f r e q u e n c y o f 200 Hz. The s a m p l i n g r a t e was 2.5 t i m e s s l o w e r t h a n used h e r e . T h i s meant t h a t t h e components between 1000 and 2500 Hz. were s e v e r e l y d i m i n i s h e d by t h e f i l t e r s and not as a c c u r a t e l y s a m p l e d . In t h e p r e v i o u s work t h e median n e r v e was s t i m u l a t e d a t t h e f i n g e r r a t h e r t h a n t h e w r i s t , t h e s t i m u l u s l e v e l was 2.5 t i m e s t h e t h r e s h o l d r a t h e r t h a n j u s t enough t o i n d u c e a v i s i b l e t w i t c h . 105. The p a t i e n t s e l e c t i o n was d i f f e r e n t , i n t h a t a l l o f t h e p r e v i o u s s e t o f p a t i e n t s had symptoms o f d e m y e l i n a t i o n i n t h e median n e r v e , w h e r e a s , o n l y s i x out o f t w e n t y - f i v e o f t h e c u r r e n t p a t i e n t s had s u c h . W i t h t h e r e c o r d i n g methods used h e r e , t h e r e was n o t a s i g n i f i c a n t d i f f e r e n c e between t h e Normal and MS s p e c t r a i n t h e 390 t o 1000 Hz band p r e v i o u s l y u s e d . I t i s a n t i c i p a t e d t h a t t h e D i s p e r s i o n F i g u r e w i l l p r o v e a more s u b t l e t e s t o f t h e d i s p e r s i o n t h a n t h a t p r e v i o u s l y u s e d , d e s p i t e t h e o c c u r r e n c e o f one o f t h e n o r m a l SEPs o u t s i d e t h e r a n g e o f n o r m a l i t y . The e n l a r g e m e n t o f t h e s e t o f n o r m a l d a t a t h a t t h e s t a t i s t i c s a r e b a s e d on w i l l , we e x p e c t , i n c r e a s e the e s t i m a t e o f t h e d e v i a t i o n o f t h e n o r m a l s and so i n c l u d e t h e m a v e r i c k Normal r e c o r d i n g s w h i l e s t i l l e x c l u d i n g a f a i r p r o p o r t i o n o f t h e MS r e c o r d i n g s . 5) BAYESIAN DECISION MAKER APPLIED TO FEATURES OF SOMATOSENSORY EVOKED POTENTIALS 5.1) I n t r o d u c t i o n Three d i f f e r e n t f e a t u r e s of the Somatosensory Evoked P o t e n t i a l were measured i n a set of Normal v o l u n t e e r s and a set of M u l t i p l e S c l e r o s i s v o l u n t e e r s : The l a t e n c y measurement [Eisen, 1980], the Cost f u n c t i o n d e s c r i b e d i n chapter 4, and the D i s p e r s i o n F i g u r e d e s c r i b e d i n chapter 5. These f e a t u r e s needed to be evaluated to determine how s e n s i t i v e and how r e l i a b l e i n d i c a t o r s of abnormality they were. The optimal t h r e s h o l d s f o r a judgement of abnormality needed to be determined. The u t i l i t y of using a combination of f e a t u r e s needed to be e x p l o r e d . A Baysian D e c i s i o n Maker [Tou + Gonzalez, 1974] was implemented to s a t i s f y these needs. A Baysian D e c i s i o n Maker, or P a t t e r n C l a s s i f i e r , uses estimates of the d i s t r i b u t i o n s of the f e a t u r e s , the a p r i o r i p r o b a b i l i t y of the r e s u l t s , and estimates of the c o s t s of c o r r e c t and i n c o r r e c t d e c i s i o n s , to judge the f e a t u r e s of an unknown wave. This judgment i s made so as to minimize the expected value of the c o s t s . 5.2) Methods T w e n t y - f i v e M u l t i p l e S c l e r o s i s p a t i e n t s v o l u n t e e r e d f o r t h i s e x p e r i m e n t . B a s e d on a c o n s t e l l a t i o n o f l a b o r a t o r y t e s t s o v e r a p e r i o d o f s e v e r a l y e a r s , e a c h o f t h e p a t i e n t s had b e e n d i a g n o s e d as h a v i n g M u l t i p l e S c l e r o s i s . T w e n t y - f o u r o f t h e v o l u n t e e r s were c l a s s i f i e d as D e f i n i t e MS and one was c l a s s i f i e d as P r o b a b l e MS. O n l y s i x o f t h e t w e n t y - f i v e had symptoms i n t h e m e d i a n n e r v e s y s t e m t h a t was t o be s t i m u l a t e d . The r e s t had s p i n a l , o p t i c o r o t h e r s y s t e m s a f f e c t e d . T h e r e w e re n i n e t e e n f e m a l e s ( a g e s 39 +_ 11) and s i x m a l e s ( a g e s 45+9). T h e i r SEPs were r e c o r d e d u s i n g t h e same t e c h n i q u e as u s e d p r e v i o u s l y f o r t h e c o n t r o l s . A b l i n d t e s t was s e t up by p l o t t i n g t h e s e SEPs and t h o s e o f e i g h t n o r m a l s . F i v e e x p e r i e n c e d c l i n i c i a n s , who were n o t i n v o l v e d i n t h i s work and who had n e v e r s e e n t h i s d a t a b e f o r e , were s e p a r a t e l y a s k e d t o j u d g e w h i c h o f t h e s e m e d i a n SEPs were a b n o r m a l . They had o n l y t h e g r a p h s o f t h e SEPs t o j u d g e f r o m . They were were t o l d t h a t t h e s e t c o n t a i n e d a m i x t u r e o f MS and N o r m a l s SEPs w i t h no a b n o r m a l l y n o i s y r e c o r d i n g s . 109. The c o n t r o l and MS SEP's were d i g i t a l l y f i l t e r e d and t h e n warped t o t h e S t a n d a r d Wave. The r e s u l t i n g c o s t f u n c t i o n s , a l o n g w i t h t h e l a t e n c y o f t h e P19 peak, and t h e D i s p e r s i o n F i g u r e , were t a b u l a t e d . The a p r i o r i p r o b a b i l i t y o f a wave b e i n g MS was s e t t o be 0.50. The c o s t o f m i s - d i a g n o s i n g an MS as Normal (Type A e r r o r ) was s e t t o be 1.0. The c o s t o f m i s d i a g n o s i n g a Normal as MS (Type B e r r o r ) was s e t t o be 2001.0. The c o s t o f a c o r r e c t d i a g n o s i s was s e t as -1.0. T h i s p r o d u c e d a p r o b a b i l i t y t h r e s h o l d o f 1000.0. I f t h e p r o b a b i l i t y o f t h e wave o c c u r r i n g , g i v e n t h a t i s was MS, d i v i d e d by t h e p r o b a b i l i t y o f t h e wave o c c u r i n g , g i v e n t h a t i t was N o r m a l , was g r e a t e r t h a n 1000.0 t h e n t h e wave i s j u d g e d t o be MS. A f a i l u r e t o j u d g e t h e wave as MS doe s n o t i m p l y t h a t t h e wave i s n e c e s s a r i l y n o r m a l . The u n d e r l y i n g p r o b a b i l i t y d i s t r i b u t i o n s were assumed t o be n o r m a l . The d a t a was t e s t e d t o d e t e r m i n e t h e r e a s o n a b l e n e s s o f t h i s a s s u m p t i o n . T a b l e V c o n t a i n s t h e d e t a i l e d r e s u l t s o f t h i s t e s t . The Normal C o s t F u n c t i o n and the Normal L a t e n c y were seen t o have r e a s o n a b l y n o r m a l d i s t i b u t i o n s . The d i s t r i b u t i o n o f t h e Normal D i s p e r s i o n F i g u r e a p p e a r e d l e s s n o r m a l . The MS d i s t r i b u t i o n s were d e f i n i t e l y n o t n o r m a l . They a p p e a r t o be c l o s e r t o t h e a v e r a g e o f a u n i f o r m d i s t r i b u t i o n and t h e d i s t r i b u t i o n o f t h e N o r m a l s . Even s o , when e s t i m a t i n g the p r o b a b i l i t i e s , t h e a s s u m p t i o n o f n o r m a l i t y was us e d f o r t h e MS n o . d i s t r i b u t i o n s . T h i s was s a f e , as t h e e r r o r i n t h e e s t i m a t e s would p r o d u c e even more c o n s e r v a t i v e j u d g m e n t s . S e p a r a t e c o v a r i a n c e m a t r i c e s were used f o r MS and Normal when c a l c u l a t i n g t h e p r o b a b i l i t i e s . The s e t o f MS d a t a r e c o r d s and t h e s e t o f Normal d a t a r e c o r d s was c o m b i n e d . One by one, e a c h r e c o r d was s e p a r a t e d from the r e s t o f t h e s e t . A B a y s i a n D e c i s i o n Maker [ T o u + G o n z a l e z , 1974] was t r a i n e d on t h e r e s t o f t h e d a t a , and t h e n j u d g e d whether t h e s e p a r a t e d r e c o r d was MS o r N o r m a l . The s e p a r a t i o n was done so t h a t t h e r e c o r d b e i n g j u d g e d would have no i n f l u e n c e on t h e p r o b a b i l i t y e s t i m a t e s used by t h e D e c i s i o n Maker. Table V F e a t u r e C h i S q u a r e C h i P r o b . Skewness K u r t o s i s NORMAL C o s t F u n c t i o n L a t e n c y D i s p e r s i o n 2.147 0.427 2.783 0.14 0. 51 0.10 0.842 0. 240 2. 236 0.283 0. 644 6. 145 M S C o s t F u n c t i o n 4.166 L a t e n c y 14.270 D i s p e r s i o n 25.294 0. 04 0.00 0.00 0. 808 2.161 4.052 -0.763 4.634 18.096 5.3) R e s u l t s In t h e b l i n d t e s t t h r e e o f t h e f i v e c l i n i c i a n s p i c k e d t h e same f i v e waves as a b n o r m a l , a l l o f w h i c h were f r o m MS p a t i e n t s . A f o u r t h p i c k e d the same f i v e p l u s one more MS. The f i f t h c l i n i c i a n had a much more l i b e r a l c r i t e r i a f o r a b n o r m a l i t y and j u d g e d s i x t e e n o f t h e SEPs t o be a b n o r m a l . Howeve r , two o f t h e s e s i x t e e n waves were f r o m n o r m a l v o l u n t e e r s , d e m o n s t r a t i n g the d a n g e r o f t o o l i b e r a l a c r i t e r i a o f a b n o r m a l i t y . T h u s , t h e y i e l d f o r r e l i a b l y i d e n t i f y i n g a b n o r m a l i t y i n t h e s e w a v e s , by e x p e r i e n c e d c l i n i c i a n s , was 2 0 % . When j u d g i n g on the l a t e n c y measu remen t a l o n e , 12% o f t h e MS and 100% o f t h e N o r m a l s were c o r r e c t l y j u d g e d . When j u d g i n g on the C o s t F u n c t i o n a l o n e , 44% o f t h e MS and 100% o f t h e N o r m a l s were j u d g e d c o r r e c t l y . The D i s p e r s i o n F i g u r e a l o n e y i e l d e d 28% o f t h e MS c o r r e c t l y j u d g e d , b u t m i s j u d g e d one o f t he n o r m a l s . T a b l e VI shows the r e s u l t s f r o m c o m b i n a t i o n s o f t h e f e a t u r e s . The b e s t r e s u l t s were p r o d u c e d when j u d g i n g on b o t h t h e l a t e n c y and C o s t F u n c t i o n ; i n t h a t 48% o f t h e MS, and 100% o f t h e n o r m a l s were j u d g e d c o r r e c t l y . 113. 5 . 4 ) D i s c u s s i o n I n t h e B a y e s i a n p a t t e r n c l a s s i f i e r , t h e l o s s m a t r i x was c h o s e n t o r e f l e c t t h e enormous p s y c h o l o g i c a l damage t h a t would be done t o a p a t i e n t who was m i s d i a g n o s e d as h a v i n g MS. B e c a u s e o f t h e p r o g r e s s i v e n a t u r e o f t h e d i s e a s e an e r r o r i n t h e d e t e c t i o n o f a p a t i e n t w i t h MS would be p i c k e d up i n a l a t e r a s s e s s m e n t . I t i s p o s s i b l e t h a t i n t h i s i n v e s t i g a t i o n t h e d a t a u s e d t o t r a i n t h e p a t t e r n c l a s s i f i e r may n o t have been p e r f e c t l y c a t e g o r i z e d , as t h e r e i s no d e f i n i t i v e marker f o r MS. MS r e q u i r e s a f a i r l y l a r g e c o n s t e l l a t i o n o f c l i n i c a l and l a b o r a t o r y f e a t u r e s f o r i t s d i a g n o s i s . As e x p e r i e n c e grows w i t h t h e p r e s e n t p a t i e n t s and as f u t u r e p a t i e n t s a r e added t o t h e s e t t h e c l a s s i f i e r i s e x p e c t e d to become more p r e c i s e . The m i s j u d g i n g o f t h e one n o r m a l when t h e D i s p e r s i o n F i g u r e was i n c l u d e d was due t o t h e f a c t t h a t , when t h a t wave i s b e i n g j u d g e d , th e Normal c o v a r i a n c e m a t r i x i s e s t i m a t e d f r o m t h e r e s t o f t h e N o r m a l s . T h i s e s t i m a t e i s s i g n i f i c a n t l y d i f f e r e n t from t h a t b a s e d on a l l o f t h e N o r m a l s . As shown i n F i g u r e s 5.1, 5.2, and 5.3, when a l l o f t h e d a t a i s used t o e s t i m a t e t h e s t a t i s t i c s the c u t - o f f s u r f a c e i s o u t s i d e a l l o f t h e n o r m a l s . The " l e a v e - o n e - o u t method" i s an o v e r l y p e s s i m i s t i c e s t i m a t e o f t h e Bayesian Cutof f with p=1000 x M S o Normal Cost Funct ion Figure 5.1 Dlaparalon Figura 0.0350 -0.0300 -0.0250 -0.0200 -0.0150 -0.0100 -Bayasian cu to f f p = 1 0 0 0 0.1212 x X X X x_ 0. 5. T" 10. Cost Funct ion 15. x M S o Normal Figure 5.2 Olsparslon Flgura 0.0350 -0.0300 -0.0250 -0.0200 -0.0150 -0.0100 -0.0050 -0.0000 -15. Bayesian Cutof f with p=»1000 o. 1212 20. 25. — r 30. Latency of N19 i n msec x M S o Normal Figure 5.3 117. p e r f o m a n c e o f a p a t t e r n c l a s s i f i e r [ M c G i l l e m , 1 9 8 1 ] . T a b l e I V d e m o n s t r a t e s t h a t t h e n o r m a l d i s t r i b u t i o n e s t i m a t e i s n o t a v e r y r e l i a b l e o n e. To r e l i a b l y e s t i m a t e t h e d i s t r i b u t i o n o f t h e D i s p e r s i o n F i g u r e , more s a m p l e s a r e n e e d e d . 5.5) Conclusions B o t h t h e C o s t F u n c t i o n and t h e D i s p e r s i o n F i g u r e , when u s e d a l o n e , i d e n t i f i e d more MS SEPs t h a n t h e t r a d i t i o n a l l a t e n c y measurement and t h e s u b j e c t i v e j u d g m e n t o f e x p e r i e n c e d c l i n i c a l p e r s o n n e l . However, t h e D i s p e r s i o n F i g u r e c a u s e d a m i s j u d g m e n t o f one N o r m a l SEP. See t h e t a b l e f o l l o w i n g f o r t h e q u a n t i t a t i v e d e t a i l s . Table VI Features included % MS Corre c t %Normal C o r r e c t Cost f u n c t i o n 44.0 100.0 Latency of N19 12.0 100.0 D i s p e r s i o n f i g u r e 28.0 95.8 Cost and Latency 48.0 100.0 Cost and D i s p e r s i o n 52.0 95.8 Latency and D i s p e r s i o n 28.0 95.8 Cost, Latency and D i s p e r s i o n 52.0 95.8 When the Cost F u n c t i o n was used together with the l a t e n c y measurement the r e s u l t i n g y i e l d was four times that from using the l a t e n c y alone and over twice that of the c l i n i c i a n s . Thus, i t i s concluded that the Cost F u n c t i o n and l a t e n c y , when used together, are a more s e n s i t i v e and r e l i a b l e t e s t f o r M u l t i p l e S c l e r o s i s than any other known f e a t u r e of the Somatosensory Evoked P o t e n t i a l . 119. 6) C O N C L U S I O N S 1 2 0 . Using d i g i t a l f i l t e r i n g with a band-pass of 300 to 2500 Hz four negative, and the corresponding p o s i t i v e , peaks of the median SEP were c o n s i s t e n t l y detected i n r e c o r d i n g s from a group of twenty-four normal s u b j e c t s . These peaks are only r a r e l y i d e n t i f i a b l e i n u n f i l t e r e d SEPs, and t h e i r presence q u e s t i o n s the accepted t h e o r i e s of the o r i g i n of the SEP. A new form of Dynamic Time Warping was developed to be a measure the abnormality of an SEP. The Dynamic Time Warping was a p p l i e d to the peaks i s o l a t e d by d i g i t a l f i l t e r i n g to produce the Cost F u n c t i o n . The values of the Cost F u n c t i o n from a group of t w e n t y - f i v e M u l t i p l e S c l e r o s i s p a t i e n t s was s i g n i f i c a n t l y d i f f e r e n t from those of the Normal group. A measure of the d i s p e r s i o n of the SEP was d e f i n e d . The D i s p e r s i o n F i g u r e i s the sum of the energy between 1000 and 2500 Hz i n the SEP s p e c t r a s c a l e d to have a peak value of one. Seven of the M u l t i p l e S c l e r o s i s p a t i e n t s had abnormal D i s p e r s i o n F i g u r e s . A Bayesian D e c i s i o n Maker was a p p l i e d to the r e s u l t s of the Cost F u n c t i o n , the D i s p e r s i o n F i g u r e , and the t r a d i t i o n a l l a t e n c y measurement. The l a t e n c y c o r r e c t l y i d e n t i f i e d 12% of the MS p a t i e n t s and 100% of the Normals. The D i s p e r s i o n F i g u r e c o r r e c t l y i d e n t i f i e d 28% of the MS p a t i e n t s , but misjudged one of the Normals. The Cost F u n c t i o n c o r r e c t l y i d e n t i f i e d 44% of the 121. MS and 100% of the Normals. The most accurate combination of f e a t u r e s was the Cost F u n c t i o n together with l a t e n c y which judged 48% of the MS and 100% of the Normals c o r r e c t l y . For comparison, experienced c l i n i c i a n s using j u s t the SEPs c o r r e c t l y i d e n t i f i e d only 20% of the MS p a t i e n t s . Thus, the Cost F u n c t i o n when combined with the l a t e n c y measurement i s a very s e n s i t i v e t e s t f o r the a b n o r m a l i t i e s i n the Somatosensory Evoked P o t e n t i a l . Further work needs to be done to i n v e s t i g a t e what other f e a t u r e s of the SEP can be i s o l a t e d by the use of d i g i t a l f i l t e r i n g . The ongoing c l i n i c a l use of d i g i t a l f i l t e r s w i l l produce a l a r g e r pool of data to analyse than t h a t c o n s i d e r e d i n t h i s work. The Dynamic Time Warping technique presented may prove a p p l i c a b l e to s i g n a l s other than SEPs. A l a r g e r group of normal s u b j e c t s needs to be s t u d i e d to t e s t the accuracy of the Cost F u n c t i o n . The Cost F u n c t i o n should prove u s e f u l i n other n e u r o l o g i c a l d i s e a s e s b e s i d e s MS. 1 2 2 . REFERENCES Abbruzzese, M., Fav a l e , E. Leandri M., and Ratto, S., New s u b c o r t i c a l components of the c e r e b r a l somatosensory evoked p o t e n t i a l i n man. Acta N e u r o l o g i c a S c a n d i n a v i c a , 1978, 48: 325-332. Abrahamian, H.A., et a l , E f f e c t s of Theopental on Human C e r e b r a l Evoked Responses. A n a e s t h e s i o l o g y , 1963, V o l . 24:650-657. Ackmann, J . J . , E l k o , P.P., and Wu, S.J., D i g i t a l F i l t e r i n g of On-Line Evoked P o t e n t i a l s . I n t e r n . J . Bio-medical Computing, 1979, V o l 10:291-303. A l l i s o n , T., et a l , On the Neural O r i g i n of E a r l y Components of the Human Somatosensory Evoked P o t e n t i a l . In: Progress i n C l i n i c a l Neurophysiology, V o l . 7: 51-68, 1980, Ka r g e r : B a s e l . A n z i s k a , B. and Cracco, R.Q. Short l a t e n c y somatosensory evoked p o t e n t i a l s : s t u d i e s i n p a t i e n t s with f o c a l n e u r o l o g i c a l d i s e a s e s . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1980, 49:227-239. Anziska, B., et a l , Somatosensory Far F i e l d P o t e n t i a l s : S t u d i e s i n Normal Subjects and P a t i e n t s With M u l t i p l e S c l e r o s i s . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1978, V o l 45:602-610. Aunon, J . I . , Computer Techniques f o r the Pr o c e s s i n g of Evoked P o t e n t i a l s . Computer Programs i n Biomedicine, 1978, V o l 8: 243-254. Aunon, J . I . , Sencaj, R.W., Comparison of D i f f e r e n t Techniques fo r P r o c e s s i n g Evoked P o t e n t i a l s , Med. B i o l . Comput., 1978, Vol 16:642-657. A u n o n , J . I . , M c G i l l e m C D , C h i l d e r s , D . G . , S i g n a l P r o c e s s i n g i n E v o k e d P o t e n t i a l R e s e a r c h : A v e r a g i n g and M o d e l i n g . CRC C r i t i c a l R e v i e w s i n B i o e n g i n e e r i n g , J u l y 1 9 8 1 , V o l 5 : 3 2 3 - 3 6 7 . B e l l m a n , D y n a m i c P r o g r a m m i n g . P r i c e t o n N . J . , P r i n c e t o n U n i v e r s i t y P r e s s 1 9 5 7 . B o s t o n , J . R . , S p e c t r a o f A u d i t o r y B r a i n s t e m R e s p o n s e s and S p o n t a n e o u s E E G . I E E E T r a n s . B i o m e d i c a l E n g i n e e r i n g , A p r i l 1 9 8 1 , N o . 4 , V o l . B M E - 2 8 : 3 3 4 - 3 4 1 . B r a z i e r , M . A . B . , V a r i e t i e s o f C o m p u t e r A n a l y s i s o f E l e c t r o p h y s i o l o g i c a l P o t e n t i a l s . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . S u p p . 2 6 , 1 9 6 7 . B r e n n e r , N . , D i s c r e t e F o u r i e r T r a n s f o r m s a n d A p p l i c a t i o n s t o F o u r i e r S e r i e s a n d C o n v o l u t i o n I n t e g r a l s . UBC F o u r t , U n i v e r s i t y o f B r i t i s h C o l u m b i a C o m p u t e r C e n t r e , 1 9 8 0 . B r o w n , M . K . , R a b i n e r , L . R . , A n A d a p t i v e , O r d e r e d , G r a p h S e a r c h T e c h n i q u e f o r D y n a m i c T i m e W a r p i n g f o r I s o l a t e d Word R e c o g n i t i o n . I E E E T r a n s . A c o u s t i c s , S p e e c h and S i g n a l P r o c e s s i n g , v o l A S S P - 3 0 N o . 4 , A u g u s t 1 9 8 2 . B u c h t h a l , F . , R o s e n f e l e k , A . , B e h s e , F . , S e n s o r y p o t e n t i a l s o f n o r m a l and d i s e a s e d n e r v e s . P e r i p h e r a l N e u r o p a t h y , V o l 1 ( E d s ) P . J . D y c k P . K . T h o m a s E . A . L a m b e r t . W . B . S a u n d e r s C o . Pp 4 4 2 - 4 6 4 . C a m p b e l l , J . A . , L e a n d r i , M . , The E f f e c t s o f H i g h P a s s F i l t e r s on C o m p u t e r - R e c o n s t r u c t e d E v o k e d P o t e n t i a l s . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1 9 8 4 , 5 7 : 9 9 - 1 0 1 . C a r l t o n , E . H . , K a t z , S . , I s W e i n e r F i l t e r i n g an E f f e c t i v e M e t h o d o f I m p r o v i n g E v o k e d P o t e n t i a l E s t i m a t i o n ? I E E E T r a n s . B i o m e d i c a l E n g i n e e r i n g , A p r i l 1980, N o . 4 , V o l BME-27:187-192. 124. C e l e s i a , G . S o m a t o s e n s o r y e v o k e d p o t e n t i a l s r e c o r d e d d i r e c t l y f r o m human t h a l a m u s and SMI c o r t i c a l a r e a . A r c h . N e u r o l . , 1 9 7 9 , 3 6 : 3 9 9 - 4 0 5 . C h i a p p a , K . H . , and R o p p e r , A . L . , E v o k e d P o t e n t i a l s i n C l i n i c a l M e d i c i n e . P a r t I I . N. E n g l . J . M e d . , 1 9 8 2 , V o l 3 0 6 : 1 2 0 5 - 1 2 1 1 . C o o l e y , J . W. and T u k e y , J . W . An a l g o r i t h m f o r t h e m a c h i n e c a l c u l a t i o n o f c o m p l e x F o u r i e r s e r i e s . M a t h e m a t i c s o f C o m p u t a t i o n , 1 9 6 5 , 1 9 : 2 0 7 - 3 0 1 . Dawson , G . D . , I n v e s t i g a t i o n s i n a p a t i e n t s u b j e c t t o m y o c l o n i c s e i z u r e a f t e r s e n s o r y s t i m u l a t i o n . J . N e u r o l o g y N e u r o s u r g e r y P s y c h i a t r y . V o l 1 0 : 1 4 1 - 1 6 2 , 1 9 4 7 . Dawson , W.W., D o d d i n g t o n , W. , Phase D i s t o r t i o n o f B i o l o g i c a l S i g n a l s : E x t r a c t i o n o f S i g n a l F rom N o i s e W i t h o u t P h a s e D i s t o r t i o n . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1 9 7 3 , V o l 3 4 : 2 0 7 - 2 1 1 . Desmedt J . E . , B r u n k o , E . , D e b e c k e r , J . and C a r m e l i e t , J . The s y s t e m b a n d p a s s r e q u i r e d to a v o i d d i s t o r t i o n o f e a r l y c o m p o n e n t s when a v e r a g i n g s o m a t o s e n s o r y e v o k e d p o t e n t i a l s . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1 9 7 4 , 3 7 : 4 0 7 - 4 1 0 . D o n c h i n , E . , A M u l t i v a r i a t e A p p r o a c h t o t he A n a l y s i s o f A v e r a g e d E v o k e d P o t e n t i a l s . I EEE T r a n s . B i o m e d i c a l E n g i n e e r i n g , 1 9 6 6 , V o l . B M E - 1 3 : 1 3 1 - 1 3 9 . D o y l e , D . J . , H y d e , M . L . , A n a l o g u e and D i g i t a l F i l t e r i n g o f A u d i t o r y B r a i n s t e m P o t e n t i a l s . S c a n d i n a v i a n A u d i o l o g y , 1981 V o l 1 0 : 8 1 - 8 9 . D o y l e , D . J . , H y d e , M . L . , D i g i t a l I n v e r s e F i l t e r i n g M e t h o d o l o g y f o r P h y s i o l o g i c a l S i g n a l s . P s y c h o p h y s i o l o g y , 1 9 8 3 , V o l 2 0 ( 5 ) : 5 9 1 - 5 9 6 . 125. E i s e n , A . A . The s o m a t o s e n s o r y e v o k e d p o t e n t i a l . C a n . J . N e u r o l . S c i . , 1 9 8 2 a , 9 : 6 5 - 7 7 . E i s e n , A . A . , L a w r e n c e , P . D . , R o b e r t s , K . B . , H o i r c h V . M . , D i s p e r s i o n M e a s u r e m e n t s o f t h e SEP i n S u s p e c t e d M u l t i p l e S c l e r o s i s . N e u r o l o g y , 1 9 8 2 b , V o l 3 2 ( 2 ) : 1 4 4 . E i s e n , A . A . , N u d l e m a n , K . , F-wave and c e r v i c a l s o m a t o s e n s o r y r e s p o n s e c o n d u c t i o n f r o m t h e s e v e n t h c o r t i c a l s p i n o u s p r o c e s s t o c o r t e x i n m u l t i p l e s c l e r o s i s . C a n a d i a n J o u r n a l o f N e u r o l o g i c a l S c i e n c e , V o l 5 : 2 8 9 - 2 9 5 . 1 9 7 8 . E i s e n , A . A . , O d u s o t e , K . , C e n t r a l and p e r i p h e r a l c o n d u c t i o n t i m e s i n m u l t i p l e s c l e r o s i s . E l e c t r o e n c e p h a l o g r a p h y C l i n i c a l N e u r o p h y s i o l o g y . V o l 4 8 : 2 5 3 - 2 6 5 , 1 9 8 0 . E i s e n , A . A . , N e u r o p h y s i o l o g y i n M u l t i p l e S c l e r o s i s . N e u r o l o g i c C l i n i c s , V o l 1, N o . 3 : 6 1 5 - 6 2 9 , 1 9 8 3 . F u k u n a g a , K . , K r i l e , T . F . , C a l c u l a t i o n o f B a y e s R e c o g n i t o n E r r o r F o r Two M u l t i v a r i a t e G a u s s i a n D i s t r i b u t i o n s . I EEE T r a n s . C o m p . , 1 9 6 9 , V o l 1 8 , No 3 : 2 2 0 - 2 2 9 . F u k u s h i m a , T . , M a y a n a g i , Y . and B o u c h a r d G . T h a l a m i c E v o k e d P o t e n t i a l s t o S o m a t o s e n s o r y S t i m u l a t i o n In Man . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1 9 7 6 , V o l 4 0 : 4 8 1 - 4 9 0 . G i b l i n , D . R . , S o m a t o s e n s o r y E v o k e d P o t e n t i a l s i n H e a l t h y S u b j e c t s and i n P a t i e n t s w i t h L e s i o n s o f t h e N e r v o u s S y s t e m . A n n a l s o f t h e New Y o r k Academy o f S c i e n c e , V o l 1 2 2 : 9 3 - 1 4 2 . G l a s e r , E . M . , R u c h k i n , D . C , P r i n c i p l e s o f N e u r o l o g i c a l S i g n a l A n a l y s i s , A c a d e m i c P r e s s , New Y o r k , 1 9 7 6 . G o f f , W .R . , e t a l , C e r e b r a l S o m a t o s e n s o r y R e s p o n s e s D u r i n g S l e e p i n Man . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1 9 6 6 , V o l 2 1 : 1 - 9 . 126. Harmon, L.D., Lewis, E.R., Neural Modeling. Advances i n Biomedical E n g i n e e r i n g and Medical P h y s i c s , v o l 1, Wiley, New York, 1968. Hoopen, M.T., Reuver, H.A., Aspects of Average Computations by A p e r i o d i c S t i m u l a t i o n . Med. B i o l . Eng., 1972, V o l . 10:621-630. Jansen, B.H., Bourne, J.R., Ward, J.W., A u t o r e g r e s s i v e E s t i m a t i o n of Short Segment Spectra f o r Computerized EEG A n a l y s i s . IEEE Trans. Biomedical E n g i n e e r i n g , September 1981, V o l . BME-28, No 9:620-638. Jasper, H.H., The Ten Twenty e l e c t r o d e system of the I n t e r n a t i o n a l F e d e r a t i o n . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1958, V o l . 10:371-375. Kaufman, L., et a l . , On the R e l a t i o n Between Somatic Evoked P o t e n t i a l s and F i e l d s . I n t e r n . J . Neuroscience, 1981, Vol 15:223-239. Kay, S.M., Marple, S.L.Jr., Spectrum A n a l y s i s - A Modern P e r s p e c t i v e . Procedings of the IEEE, V o l . 69, No. 11:1380-1419, November 1981. Kimura, J . , Mitsudome, A., Beck, D.O., Yamadu, T., and D i c k i n s , O.S., F i e l d d i s t r i b u t i o n of a n t i d r o m i c a l l y a c t i v a t e d d i g i t a l nerve p o t e n t i a l s : model f o r f a r - f i e l d r e c o r d i n g . Neurology, 1983, 33:1164-1169. King, D.W., and Green, J.B. Short l a t e n c y somatosensory evoked P o t e n t i a l s i n Humans. E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1979, 46:702-708. K r i t c h e v s k y , M. and Wie d e r h o l t , W.C., S h o r t - l a t e n c y somatosensory evoked p o t e n t i a l s . Arch. Neurol., 1978, 35:706-711. 127. L a n d o l t , J.P., and C o r r e l a , M.J., Neuromathematical Concepts of Poi n t Process Theory. IEEE Trans. Biomedical E n g i n e e r i n g , Jan 1978, Vol BME-25:1-12. Larson, S.J., and Sances, J.A., Averaged evoked p o t e n t i a l s i n s t e r e o t a x i c surgery. J . Neurosurg., 1968, 28:227-232. Less e r , R.P., Lueders, H., Hahn, J . and Klem G. E a r l y somatosensory p o t e n t i a l s evoked by median nerve s t i m u l a t i o n : i n t r a o p e r a t i v e m o n i t o r i n g . Neurology (Minneap.), 1981, 31:1519-1523. Lueders, H., A n d r i s h , J . , Gurd, A., Weiner, G., and Klem, G. O r i g i n of f a r f i e l d s u b c o r t i c a l p o t e n t i a l s evoked by s t i m u l a t i o n of the p o s t e r i o r t i b i a l nerve. E l e c t r o e n c e p h . C l i n . N e u r o p h ysiol., 1981, 52:336-344. Lueders, H., L e s s e r , R., Hahn, J . , L i t t l e , J . and Klem G. S u b c o r t i c a l somatosensory evoked p o t e n t i a l s to median nerve s t i m u l a t i o n . B r a i n , 1983, 106:341-372. Maccabee, P.J., Pinkhasov, E.I. and Cracco, R.Q., Short l a t e n c y somatosensory evoked p o t e n t i a l s to median nerve s t i m u l a t i o n : e f f e c t of low frequency f i l t e r . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1983, 55:34-44. Mauguiere, F., Desmedt, J.E., and Courjon, J . , Neural generators of N18 and P14 f a r - f i e l d somatosensory evoked p o t e n t i a l s s t u d i e d i n p a t i e n t s with l e s i o n s of thalamus or t h a l a m o c o r t i c a l r a d i a t i o n s . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1983(a), 56:283-292. 128. Mauguiere, F., Desmedt, J.E., and Courjon, J . , A s t e r e o g n o s i s and d i s s o c i a t e d l o s s of f r o n t a l or p a r i e t a l components of somatosensory evoked p o t e n t i a l s i n hemispheric l e s i o n s : d e t a i l e d c o r r e l a t i o n s with c l i n i c a l s i g n s and computerized tomographic scanning. B r a i n , 1983(b), 106:271-311. M c G i l l , K.C., e t a l , On the Nature and E l i m i n a t i o n of Stimulus A r t i f a c t i n Nerve S i g n a l s Evoked and Recorded Using Surface E l e c t r o d e s . IEEE Trans. Biomedical E n g i n e e r i n g , Feb. 1982, No 2, V o l . BME-29:129-137. McGillem C D , Aunon, J . I . , C h i l d e r s , D.G., S i g n a l P r o c e s s i n g i n Evoked P o t e n t i a l Research: A p p l i c a t i o n s of F i l t e r i n g and P a t t e r n R e c o g n i t i o n . CRC C r i t i c a l Reviews i n B i o e n g i n e e r i n g , Oct 1981, V o l 6:225-265. M u c c i a r d i , A., Goose, E.E., A Comparison of Seven Techniques fo r Choosing Subsets of P a t t e r n R e c o g n i t i o n P r o p e r t i e s . IEEE Trans. Comp., 1971, V o l 20, No. 9:1023-1031. Myers, C.S., Rabiner, L.R., A Comparative Study of S e v e r a l Dynamic Time-Warping Algorithms f o r Connected-Word R e c o g n i t i o n . B e l l System T e c h n i c a l J o u r n a l , V o l 60, No 7, September 1981. Myers, C.S., Rabiner, L.R., Rosenberg A.E., Performance T r a d e o f f s In Dynamic Time Warping Algorithms f o r I s o l a t e d Word R e c o g n i t i o n . IEEE Trans. A c o u s t i c s , Speech, and S i g n a l P r o c e s s i n g , V o l ASSP-28, No. 6, December 1980. Nagy, G., State of the A r t i n P a t t e r n R e c o g n i t i o n . Proc. IEEE, 1968, V o l 56 No 5:836-864. Nakanishi, T., Tamaki, M., Ozaki, Y. and A r a s a k i , K. O r i g i n s of short l a t e n c y somatosensory evoked p o t e n t i a l s to median nerve s t i m u l a t i o n . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1983, 56:74-85. 129. Oppenheim, A.V. and Schafer, R.W. D i g i t a l s i g n a l p r o c e s s i n g . P r e n t i c e - H a l l Inc., Englewood C l i f f s , New J e r s e y , 1975. Pagni, C.A. Somatosensory evoked p o t e n t i a l s i n thalamus and cortex of man. E l e c t r o e n c e p h . C l i n . N e u r o p hysiol., 1967, 18:147-155. Rabiner, L.R. and Gold, B. Theory and a p p l i c a t i o n of d i g i t a l s i g n a l p r o c e s s i n g . P r e n t i c e - H a l l , Englewood C l i f f s , N.J., 1975. Rabiner, L.R., Rosenberg, A.E., L e v i s o n S.E., C o n s i d e r a t i o n s i n Dynamic Time Warping Algorithms f o r D i s c r e t e Word R e c o g n i t i o n . IEEE Trans. A c o u s t i c s , Speech, and S i g n a l P r o c e s s i n g , V o l ASSP-26, No 6, December 1978. Roberts, K.B., Lawrence P.D., E i s e n , A.A., D i s p e r s i o n of the Somatosensory Evoked P o t e n t i a l (SEP) i n M u l t i p l e S c l e r o s i s . IEEE Trans. Biomed. Eng., V o l . BME-30, No. 6:360-364. June 1983. R o s s i n i , P.M., Cracco, R.Q. Cracco, J.B., and Hanse, W.J. Short l a t e n c y somatosensory evoked p o t e n t i a l s to peroneal nerve s t i m u l a t i o n : Scalp topography and the e f f e c t of d i f f e r e n t frequency f i l t e r s . E l e c t r o e n c e p h . C l i n . N e u r o p hysiol., 1981, 52:540-542. R o s s i n i , P.M., T r e v i s o , M., D i S t e f a n o , E. Di Paolo, B. Nervous impulse propagation along p e r i p h e r a l and c e n t r a l f i b e r s i n p a t i e n t s with c h r o n i c r e n a l f a i l u r e . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1983, 56:293-303. Ruchkin, D.S., An A n a l y s i s of Average Response Computation Based Upon A p e r i o d i c S t i m u l i . IEEE Trans. Biomedical E n g i n e e r i n g , A p r i l 1965, V o l . 12:87-93. 130. R u c h k i n , D . S . , W a l t e r , D . O . , A S h o r t c o m i n g o f t h e M e d i a n E v o k e d R e s p o n s e . I EEE T r a n s B i o m e d i c a l E n g i n e e r i n g , May 1 9 7 5 , V o l BME-22 :245 S a n c e s , A . , e t a l , T h e o r e t i c a l I n v e s t i g a t i o n s and C l i n i c a l A p p l i c a t i o n o f t h e E v o k e d P o t e n t i a l . C o n f e r e n c e P r o c e e d i n g s IEEE E n g . i n Med . and B i o l . S o c . 1979. S a n t o p i e r t o , R . F . , The O r i g i n and C h a r a c t e r i z a t i o n o f t h e P r i m a r y S i g n a l N o i s e , and I n t e r f e r e n c e S o u r c e s , i n t h e H i g h F r e q u e n c y E l e c t r o c a r d i o g r a m . P r o c . I E E E , May 1 9 7 7 , V o l . 6 5 : 7 0 7 - 7 1 3 . S c h e r g , M . , D i s t o r t i o n o f t h e M i d d l e L a t e n c y A u d i t o r y R e s p o n s e P r o d u c e d by A n a l o g F i l t e r i n g . S c a n d i n a v i a n A u d i o l o g y , 1 9 8 2 , V o l 1 1 : 5 7 - 6 0 . S c h o e n f e l d , R . L . , A P r o g r a m m i n g D i s c i p l i n e f o r L a b o r a t o r y C o m p u t i n g . I EEE T r a n s . on B i o m e d i c a l E n g i n e e r i n g , May 1 9 8 3 , V o l . B M E - 3 0 : 2 5 7 - 2 7 0 . S h e r w o o d , A . S . , C h a r a c t e r i s t i c s o f S o m a t o s e n s o r y E v o k e d P o t e n t i a l s R e c o r d e d o v e r t he S p i n a l C o r d and B r a i n o f Man . I EEE T r a n s . B i o m e d i c a l E n g i n e e r i n g , J u l y 1 9 8 1 , V o l BME-28, No 7 : 4 8 1 - 4 8 5 . S i d m a n , R . D . , F i n d i n g The E x t e n d e d S o u r c e s o f E v o k e d C e r e b r a l P o t e n t i a l s : An A p p l i c a t i o n t o t h e N55 Component o f t h e S o m a t o s e n s o r y E v o k e d P o t e n t i a l . C o n f e r e n c e P r o c e e d i n g s I EEE E n g . i n Med . and B i o l . S o c . 1 9 7 9 . S u t e r , C M . , P r i c i p a l Component A n a l y s i s o f A v e r a g e E v o k e d P o t e n t i a l s . E x p . N e u r o l . 1 9 7 0 , V o l 2 9 : 3 1 7 . Tou, J . T., Gonzalez, R. C., P a t t e r n R e c o g n i t i o n P r i n c i p l e s . Addison Wesley 1974. Tsumoto, T., H i r o s e , N., Nonaka, S., Takahashi, M. A n a l y s i s of somatosensory evoked p o t e n t i a l s to l a t e r a l p o p l i t e a l nerve s t i m u l a t i o n i n man. E l e c t r o e n c e p h . C l i n . N e u r o physiol., 1972, 33:379-388. Van Rotterdam, A., L i m i t a t i o n s and D i f f i c u l t i e s i n S i g n a l P r o c e s s i n g by Means of Principle-Component A n a l y s i s . IEEE Trans Biomed. Eng., 1970 V o l BME-17:268-269. Vas, G.A., Cracco, J.B., Cracco, R.Q., S c a l p - r e c o r d e d s h o r t l a t e n c y c o r t i c a l and s u b c o r t i c a l somatosensory evoked p o t e n t i a l s to peroneal nerve s t i m u l a t i o n . E l e c t r o e n c e p h . C l i n . N e u r o p hysiol., 1981, 51:1-8. Veale, J.L., Mark, R.F. and Rees, S. D i f f e r e n t i a l s e n s i t i v i t y of motor and sensory f i b e r s i n human ulnar nerve. J . N e u r o l . Neurosurg. P s y c h i a t . , 1973, 36:75-86. W a s t e l l , D.G. The a p p l i c a t i o n of low-pass l i n e a r f i l t e r s to evoked p o t e n t i a l data: f i l t e r i n g without phase d i s t o r t i o n . E l e c t r o e n c e p h . C l i n . N e u r o p h y s i o l . , 1979, 46:355-356. Weerd, J.P.C., F a c t s and F a n c i e s About a P o s t e r i o r i "Weiner" F i l t e r i n g . IEEE Trans. Biomedical E n g i n e e r i n g , March 1981, No. 3, V o l . BME-28:252-257. 132. W h i t t l e , O p t i m i z a t i o n Over Time. C h i c h e s t e r New Y o r k , W i l e y , 1982. W o l b a r s c h t , M.L., S p e k r e i j s e , H., I n t e r f e r e n c e and N o i s e i n B i o l o g i c a l I n s t r u m e n t a t i o n . A d v a n c e s i n B i o m e d i c a l E n g i n e e r i n g and M e d i c a l P h y s i c s , v o l 2, W i l e y , New Y o r k , 1968. Woody, C D . , C h a r a c t e r i z a t i o n o f an A d a p t i v e F i l t e r f o r t h e A n a l y s i s o f V a r i a b l e L a t e n c y N e u r o e l e c t r i c S i g n a l s . Med. B i o l . Eng., 1967, V o l 5:539-553. Yamada, T., Kimura J , Young S., and Powes, M. S o m a t o s e n s o r y ev o k e d p o t e n t i a l s e l i c i t e d by b i l a t e r a l s t i m u l a t i o n o f t h e m edian n e r v e and i t s c l i n i c a l a p p l i c a t i o n . N e u r o l o g y ( M i n n e a p . ) , 1978, 28:218-223. APPENDIX 1) USER'S MANUAL FOR THE PROGRAM EMG 134. The Main Menu To r u n t h e emg program t y p e : RUN EMG <RETURN> I f a f l o p p y d i s k w i t h empty s p a c e on i t i s n o t i n p l a c e an e r r o r message w i l l be p r o d u c e d . ( J u s t f o l l o w t h e i n s t r u c t i o n s i n th e e r r o r message.) The p r o g r a m w i l l s e t up i t s f i l e s and t h e n p r e s e n t you w i t h a menu. The EMG p r o g r a m i s o r g a n i z e d i n t o l e v e l s w i t h t h i s main menu b e i n g t h e t o p l e v e l . From h e r e you ca n s e l e c t any p r o c e d u r e t h a t you want t h e computer t o e x e c u t e . When t h e computer i s f i n i s h e d e x e c u t i n g t h e p r o c e d u r e t h a t you s e l e c t e d , i t w i l l r e t u r n t o t h i s menu t o a l l o w you t o make a n o t h e r c h o i c e . Some o f t h e p r o c e d u r e s have lo w e r l e v e l menus where you can a g a i n c h o o s e what a c t i o n t h a t you want the computer t o p e r f o r m . W h i l e t h e s e lower l e v e l menus o p e r a t e i n e x a c t l y t h e same way as the main menu, t h e y o n l y l e t you c h o o s e t h e a c t i o n s a l l o w e d w i t h i n t h e g i v e n p r o c e d u r e . I f you want t o c h o o s e o t h e r a c t i o n s you have t o r e t u r n t o t h e main menu. A n y t i m e t h a t you have a c h o i c e o f a c t i o n s , i f you e n t e r t e n t i m e s t h e number c o r r e s p o n d i n g t o a c e r t a i n a c t i o n , d e t a i l e d i n f o r m a t i o n on t h a t a c t i o n w i l l be p r i n t e d on t h e s c r e e n . I f you e v e r e n t e r a r e p l y t h a t i s n o t v a l i d an e r r o r message w i l l be p r o d u c e d , and t h e n you can t r y a g a i n . To e n t e r c h a r a c t e r s o r numbers i n t o t h e computer t y p e t h e a p p r o p r i a t e k e y s and t h e n p r e s s t h e key marked RETURN or ENTER or CR or LINEFEED t o s i g n i f y t h e end o f t h e l i n e b e i n g i n p u t . T h i s k ey i s d e n o t e d <RETURN> i n t h i s m a n u a l . 135. I f y o u c h o o s e "1" y o u w i l l : Input Data from the DISA T h i s p r o c e d u r e h a s i t s own menu l e v e l s w h e r e y o u c a n c h o o s e what y o u want t h e c o m p u t e r t o d o . I f y o u e n t e r a "0" t h i s h e l p p r o c e d u r e w i l l be e x e c u t e d . A "99" w i l l s t o p t h e w h o l e p r o g r a m b y p a s s i n g t h e m a i n menu. A "9" w i l l r e t u r n y o u t o t h e m a i n menu where y o u c a n c h o o s e o t h e r a c t i o n s . To i n p u t d a t a f o r a new p a t i e n t f r o m t h e DISA e n t e r a "2". T h e n , t h e p r o g r a m w i l l p r o m p t y o u f o r t h e p a t i e n t i n f o r m a t i o n b e f o r e g e t t i n g t h e d a t a f r o m t h e D I S A . I f y o u a r e s t o r i n g more d a t a f r o m t h e same p a t i e n t y o u s h o u l d e n t e r a "1" so t h a t y o u w i l l n o t h a v e t o e n t e r t h e p a t i e n t i n f o r m a t i o n a g a i n . I f t h e r e was no l a s t p a t i e n t , t h e c o m p u t e r w i l l a sk f o r t h e i n f o r m a t i o n . E n t e r i n g t h e p a t i e n t i n f o r m a t i o n The p r o g r a m w i l l p r o m p t y o u f o r i n f o r m a t i o n r e g a r d i n g t h e p a t i e n t . PATIENT'S NAME? LAST f i r s t T y p e i n t h e p a t i e n t s name <RETURN> 136. AGE S E X Type i n age and sex (M/F) under t h e c o r e s p o n d i n g h e a d i n g s . F i n a l l y t y p e <RETURN>. I f you d o n ' t t y p e i n a r e a s o n a b l e age the program w i l l r e s p o n d w i t h an e r r o r message o f t h e form: -345 I S NOT A V A L I D A G E . TRY A G A I N . EMG NUMBER? Type i n t h i s p a t i e n t s EMG NUMBER i n t h e form 79-1234. A l e t t e r w i l l be appended t o t h i s number by t h e pr o g r a m t o g i v e e a c h r e c o r d i n g a u n i q u e l a b e l . D I S E A S E = ? i Type i n a one l i n e d e s c r i p t i o n o f t h e p a t i e n t . ANY M I S T A K E S "Y" <RETURN> i s s u f f i c i e n t f o r a "YES". Any o t h e r f i r s t l e t t e r i n c l u d i n g j u s t t y p i n g <RETURN> i s e q u i v a l e n t t o t y p i n g "NO". I f "YES" i s t y p e d t h e n a l l t h e above q u e s t i o n s a r e a s k e d a g a i n o t h e r w i s e the program c a r r i e s on. 137. The program c h e c k s t h a t i t can communicate w i t h t h e DISA i n t e r f a c e p r o p e r l y . E r r o r messages a r e p r o d u c e d i f a f a u l t i s f o u n d i n t h e s y s t e m , f o r example: ** CONNECT CABLE OR POWER ON 1500 SYSTEM ** A f t e r any e r r o r message the f o l l o w i n g prompt w i l l be t y p e d : TYPE <RETURN> WHEN THE PROBLEM HAS BEEN REMEDIED You s h o u l d c o r r e c t t h e c a u s e o f t h e e r r o r t h e n t y p e <RETURN>. I f t h e e r r o r i s n o t c o r r e c t e d t h e e r r o r message and prompt w i l l be p r i n t e d a g a i n . I f no e r r o r o c c u r s or t h e e r r o r i s c o r r e c t e d , t h e p r o g ram w i l l p r i n t t h e f o l l o w i n g prompt: CHANNEL.... (1,2,3,4) FINISHED RECORDING THIS AVERAGE? THEN TYPE A 9 w i l l be p r i n t e d . Now you can t a k e as much t i m e as i s n e c e s s a r y to r e c o r d the p a t i e n t s EMG r e s p o n s e on any o f t h e f o u r DISA c h a n n e l s . When you a r e s a t i s f i e d w i t h t h e r e s p o n s e t y p e i n t h e number o f t h e DISA c h a n n e l (1,2,3, o r 4) c o n t a i n i n g t h e p a t i e n t s EMG r e s p o n s e or a "9" i f you a r e f i n i s h e d , t h e n t y p e <RETURN>. I f you t y p e d a number o t h e r t h a n 1,2,3,4 o r 9 t h e n t h e prompt w i l l be r e p e a t e d . E n t e r i n g a "9" c a u s e s t h e p r o g ram t o go back t o t h e b e g i n n i n g . A "9" may be e n t e r e d even i f no d a t a has y e t been r e c o r d e d from t h i s p a t i e n t . 138. The f o l l o w i n g prompt w i l l now be p r i n t e d : ENTER INFORMATION ON THE WAVE Type i n where t h e measurements a r e b e i n g r e c o r d e d from and any o t h e r i n f o r m a t i o n a b o u t t h i s r e c o r d i n g . The program w i l l now r e a d i n t h e r e s p o n s e d a t a from t h e DISA c h a n n e l you s p e c i f i e d . The r o u t i n e s t h a t r e a d i n t h e d a t a from t h e DISA do some e r r o r c h e c k i n g . I f an e r r o r i s f o u n d an e r r o r message w i l l be p r i n t e d s u c h a s : ** ERROR FROM STATUS ROUTINE ** ** ERROR FROM INPUT ROUTINE ** ** ERROR FROM EMGOUT ROUTINE ** In a d d i t i o n t h e prompt: WHEN PROBLEM HAS BEEN FIXED, TYPE <RETURN> i s p r i n t e d . C o n s u l t y o u r computer programmer t o d i s c o v e r and c o r r e c t t h e c a u s e o f t h e e r r o r message t h e n t y p e <RETURN> t o c o n t i n u e e x e c u t i n g t h e p r o g r a m . 139. The program w i l l a s k : WAS THE XlO SWITCH ON FOR AMP #4 On t h e back o f t h e DISA t h e r e i s a s w i t c h f o r e a c h a m p l i f i e r t h a t i s l a b e l e d XlO and X l . E n t e r "Y" i f t h e s w i t c h f o r t h e s p e c i f i e d a m p l i f i e r was i n t h e XlO p o s i t i o n , o t h e r w i s e e n t e r "N" . I f t h e p r o g r a m d e t e c t s t h e use o f t h e d e l a y l i n e , i t w i l l c h e c k w i t h you t o c o n f i r m i t s u s e : Is a delay of 8.73 ms c o r r e c t ? (Y,N,QUIT) I f you answer 'Y' t h e d e l a y t i m e w i l l be u s e d . I f you r e p l y 'N' t h e d e l a y t i m e w i l l be i g n o r e d . I f you answer 'Q' t h e wave w i l l n o t be s t o r e d and you can r e d o i t i f you so w i s h . T h i s c o m p l e t e s th e r e c o r d i n g o f one r e s p o n s e f rom a p a t i e n t . The p r o g ram w i l l now go back and a l l o w you t o r e c o r d a n o t h e r c h a n n e l from i f you so w i s h . Compute T h i s p r o c e d u r e c o m p u t e s t h e d i s p e r s i o n i n d e x as d e s c r i b e d i n D i s p e r s i o n o f t h e S o m a t o s e n s o r y E v o k e d P o t e n t i a l (SEP) i n M u l t i p l e S c h l e r o s i s by Kim R o b e r t s , P e t e r L a w r e n c e and Andrew E i s e n . The d i s p e r s i o n i n d e x i s o n l y v a l i d when c o m p u t e d f r o m w a v e f o r m s r e c o r d e d a t C3 o r C4 and s t i m u l a t e d a t t h e m e d i a n n e r v e . I f t h e c o m p u t e r d o e s n o t f i n d t h e w o r d s " C 3 " (or "C4") and " m e d i a n " i n t h e w a v e t y p e i t w i l l d i s p l a y t h e w a v e t y p e and ask t h e u s e r : DO YOU R E A L L Y WISH TO C A L C U L A T E THE D I S P E R S I O N INDEX FOR THIS WAVEFORM? ENTER "YES" TO C O N T I N U E . Do n o t e n t e r " Y E S " u n l e s s y o u a r e s u r e t h a t t h e w a v e f o r m i s a c t u a l l y o f t h e c o r r e c t t y p e . The c o m p u t e r t a k e s a. • few s e c o n d s t o do t h e t h o u s a n d s o f c a l c u l a t i o n s i n v o l v e d i n c o m p u t i n g t h e d i s p e r s i o n i n d e x . A new d a t a f i l e i s c r e a t e d c o n t a i n i n g a l l o f t h e d a t a on t h e w a v e f o r m i n c l u d i n g t h e d i s p e r s i o n i n d e x . Read data T h i s p r o c e d u r e r e a d s a d a t a f i l e f r o m t h e d i s k s t o r a g e . A l l t h a t you have t o do i s e n t e r t h e emgnumber o f t h e f i l e t h a t you want r e a d . Remember t h a t t h e wave l e t t e r i s p a r t o f t h e emgnumber. I f t h e f i l e i s n o t a v a i l a b l e t h e p r o c e d u r e w i l l t e l l you so and you c a n t h e n t r y a g a i n w i t h t h e p r o p e r s p e l l i n g , or e l s e p u t t h e c o r r e c t f l o p p y d i s k i n p l a c e . Once t h e waveform has been r e a d i n i t i s a v a i l a b l e t o be us e d by o t h e r p r o c e d u r e s s u c h as g r a p h , s u b t r a c t , compute and expa n d . 142. G r a p h D a t a To be a b l e t o g r a p h t h e waveform you must be a t e i t h e r a V T 1 0 0 t e r m i n a l c o n t a i n i n g a S e l e n a r g r a p h i c s c a r d , or a c o m p a t a b l e c o p y . I f you t r y t o r u n t h i s p r o c e d u r e on any o t h e r k i n d o f t e r m i n a l you w i l l g e t a b s o l u t e g a r b a g e ! G r a p h d a t a w i l l p r o d u c e on t h e s c r e e n a g r a p h o f t h e c u r r e n t { i . e . t h e l a s t one r e a d in} emg waveform. I f you want t o l o o k a t a n o t h e r waveform use R e a d d a t a t o r e a d i t i n from t h e d i s k , and t h e n r e t u r n to G r a p h d a t a . The s c r e e n w i l l c l e a r and t h e wave g r a p h e d . When you have f i n i s h e d l o o k i n g a t t h e g r a p h h i t <RETURN>. The p r o c e d u r e w i l l r e s p o n d : Do you want a c u r s o r ? I f you answer 1Y' you w i l l e n t e r c u r s o r mode. See t h e n e x t page f o r d e t a i l s on t h e c u r s o r . I f you answer a n y t h i n g o t h e r t h a n 'Y' or once you have l e f t c u r s o r mode, you w i l l be a s k e d : Do you w i s h t o s a v e t h i s d i s p l a y ? I f you answer 'Y' t h e p i c t u r e w i l l r e m a i n as a b a c k d r o p as you r e t u r n t o t h e main menu. You may do a n y t h i n g t h a t you w i s h e x c e p t t e r m i n a t e t h e e x e c u t i o n o f t h e program and the g r a p h i c s w i l l s t i l l be s t o r e d . The n e x t t i m e t h a t you p i c k g r a p h , t h e program w i l l c h e c k t h a t t h e d e l a y t i m e and sweepspeed o f t h e now c u r r e n t wave a r e t h e same as t h o s e o f t h e g r a p h e d wave. The v e r t i c a l v o l t a g e s c a l e w i l l a u t o m a t i c l y be a d j u s t e d t o match. The p r o g ram w i l l ask you HOW FAR WOULD YOU LIK E THIS WAVE OFFSET ( + 1 0 t o - 1 0 ) The wave w i l l be p l o t t e d on t o p o f t h e p r e v i o u s wave(s) o f f s e t by t h e amount t h a t you r e s p o n d . + 1 . 0 i s about t h e s m a l l e s t 143. o f f s e t t h a t w i l l s e p a r a t e two waves. You may p l o t as many waves as you w i s h by r e p e a t i n g t h i s p r o c e s s . When you w i s h t o c l e a r t h e g r a p h i c s s c r e e n , answer 'N' when a s k e d i f you w i s h t o s a v e t h e d i s p l a y . CURSOR MODE In c u r s o r mode you have f o u r c u r s o r s : 1, 2 ,3 and 4. C u r s o r s 3 and 4 a r e h o r i z o n t a l and c u r s o r s 1 and 2 a r e v e r t i c a l . You c a n o n l y move one c u r s o r a t a t i m e . To s e l e c t t h e c u r r e n t c u r s o r , ( t h e one you c a n move) p r e s s "1", "2", "3", o r "4". You do n o t p r e s s <RETURN> when i n c u r s o r mode u n t i l you w i s h t o l e a v e , as <RETURN> r e t u r n s you t o GRAPH. To move t h e c u r r e n t c u r s o r p r e s s t h e a p p r o p r i a t e a r r o w k e y . To speed up t h e m o t i o n o f t h e c u r s o r p r e s s ",". To slow down t h e m o t i o n o f t h e c u r s o r p r e s s The number o f t h e c u r r e n t c u r s o r i s d i s p l a y e d on the t o p r i g h t o f t h e s c r e e n a l o n g w i t h t h e p o s i t i o n s o f t h e c u r s o r s t h a t you have u s e d . T h e s e p o s i t i o n s a r e d i s p l a y e d i n a b s o l u t e c o o r d i n a t e s ; e i t h e r t i m e i n m i l l i s e c o n d s or v o l t a g e i n m i c r o v o l t s . You may change t h e z e r o p o s i t i o n o f a p a i r o f c u r s o r s by p r e s s i n g " 0 " T h i s makes t h e p o s i t i o n o f t h e c u r r e n t c u r s o r 0 . 0 0 and a d j u s t s t h e v a l u e o f t h e o t h e r c u r s o r on t h e same a x i s t o c o r r e s p o n d . T h i s a l l o w s you t o measure d i f f e r e n c e s between two p o i n t s . Once you have f i n i s h e d w i t h t h e c u r s o r s p r e s s <RETURN>. 144. P l o t P l o t w i l l a l l o w y ou t o p l o t a wave on t h e H e w l e t t - P a c k a r d p l o t t e r . Make s u r e t h a t t h e p l o t t e r i s c o n n e c t e d , t u r n e d on, and has pens  and p a p e r b e f o r e p r e s s i n g " 4 " t o p l o t . The wave w i l l be p l o t t e d w i t h t h e l e f t p en. The a x i s w i l l be p l o t t e d w i t h t h e r i g h t pen. The program w i l l a s k : Do you w i s h t o have t h e p a t i e n t i n f o r m a t i o n p l o t t e d ? (Y/N) I f you answer "Y" t h e p a t i e n t name e t c . w i l l be p l o t t e d a t the to p o f t h e page. The program w i l l a s k : Do you w i s h t o add t o t h i s p l o t ? (Y/N) I f you answer "Y" t h e n n e x t t i m e t h a t you p l o t t h e wave w i l l be f i t t e d t o t h e a x i s a l r e a d y on the p a p e r . I f you l a t e r change y o u r mind you c a n r e s e t t h i s by c h o o s i n g RESET a t t h e main menu. Subtract T h i s p r o c e d u r e a l l o w s you t o s u b t r a c t one waveform from a n o t h e r . The program w i l l ask you f o r t h e emgnumber o f t h e wave t h a t you w i s h t o s u b t r a c t f r o m . E n t e r t h e f u l l emgnumber i n c l u d i n g t h e wave l e t t e r . Then, t h e program w i l l ask you f o r th e l e t t e r o f t h e wave t h a t you w i s h t o s u b t r a c t . The wave must be from t h e same p a t i e n t . The d i f f e r e n c e between t h e two waves w i l l become t h e c u r r e n t wave i n t h e program w h i c h you may t h e n g r a p h or expan d . 146. Average T h i s p r o c e d u r e a l l o w s you t o a v e r a g e t o g e t h e r waveforms t o compute t h e mean wave and t h e RMS e r r o r . To s t a r t an a v e r a g e s e l e c t t h e p r o c e d u r e a v e r a g e a t t h e main menu. A t t h e s e c o n d a r y menu t h a t t h e p r o c e d u r e w i l l d i s p l a y , c h o o s e 1 . The c u r r e n t waveform i s used t o s t a r t t h e a v e r a g e . A l l f u t u r e waves t h a t you w i l l i n c l u d e i n t h e a v e r a g e w i l l be t e s t e d t o make s u r e t h a t t h e y h a ve t h e same sweepspeed and d e l a y v a l u e s as t h i s t h e f i r s t one. The p r o c e d u r e w i l l ask you f o r t h e l a t e n c i e s between w h i c h you w i s h t h e RMS ERROR t o be c a l c u l a t e d . The computer w i l l compute t h e a v e r a g e r o o t mean s q u a r e e r r o r between t h e waves i n t h e r a n g e o f l a t e n c i e s s p e c i f i e d . You may now do a n y t h i n g e l s e t h a t you w i s h w i t h t h e emg program (as l o n g as you do n o t s t a r t a new a v e r a g e ) and you w i l l s t i l l be a b l e t o add a n o t h e r wave when you a r e r e a d y t o . To add a wave s e l e c t t h e a v e r a g e p r o c e d u r e a t t h e main menu and t h e n e n t e r a 2 a t t h e s e c o n d a r y menu. The c u r r e n t wave w i l l be s c a l e d to f i t t h e a v e r a g e and added t o t h e sum. The number o f waves a v e r a g e d w i l l be shown. I f you e n t e r t h e wrong wave and w i s h t o d e l e t e i t , you s h o u l d have i t as t h e c u r r e n t wave and p i c k 3 a t the s e c o n d a r y menu. The p r o g r a m w i l l t h e n d e l e t e t h e wave e n t i r e l y . When you w i s h t o c a l c u l a t e the mean wave, c h o o s e 4 . The mean wave w i l l be computed and become t h e c u r r e n t wave. The RMS ERROR w i l l be c a l c u l a t e d , between t h e b o u n d a r i e s t h a t you s p e c i f i e d , and t h e n p r i n t e d o u t . D i s P l a Y T h i s p r o c e d u r e t y p e s t h e wave i n f o r m a t i o n on the t e r m i n a l . The p r o c e d u r e w i l l ask y o u : DO YOU WANT A BRIEF OR VERBOSE DISPLAY? (B/V/S) I f you r e s p o n d w i t h 'B 1 <RETURN>, o n l y t h e main i t e m s d e s c r i b i n g t h e c u r r e n t wave w i l l be t y p e d . I f you r e s p o n d 'S' t h e s t a t u s o f t h e p r o g ram v a r i a b l e s w i l l be shown. O t h e r w i s e t h e whole d a t a h e a d e r w i l l be p r i n t e d . Expand I f you s e l e c t expand a t t h e main menu wou w i l l be a b l e t o expand t h e d e t a i l o f a p o r t i o n o f t h e c u r r e n t emg waveform. The program w i l l ask you ENTER THE LATENCIES BETWEEN WHICH YOU WISH TO EXPAND THE WAVE. Type the l a t e n c y i n m i l l i s e c o n d s a t w h i c h you w i s h t h e expanded wave t o s t a r t , t h e n l e a v e a s p a c e and t y p e t h e l a t e n c y a t w h i c h you w i s h t h e expanded wave t o s t o p . I f t h e v a l u e s t h a t you s p e c i f y a r e n o t p o s s i b l e , t h e p r o g r a m w i l l w r i t e '*** e r r o r ***' and ask f o r t h e l a t e n c i e s a g a i n . B o t h t h e t i m e and v o l t a g e s c a l e s a r e a d j u s t e d to make t h e expanded wave f i l l t h e whole s c r e e n . The expanded wave becomes t h e c u r r e n t wave i n t h e program. T h i s a l l o w s you t o t a k e a d e t a i l e d l o o k a t a p o r t i o n o f t h e wave u s i n g t h e p r o c e d u r e g r a p h d a t a . Or, you c o u l d even expand a s u b p o r t i o n even f u r t h e r by u s i n g expand a g a i n . The expanded wave i s s t o r e d i n a f i l e f o r f u t u r e a c c e s s . I t s emgnumber i s t h e same as t h a t o f t h e o r i g i n a l wave e x c e p t t h a t t h e f o u r t h c h a r a c t e r has been changed t o an 'X'. I . e . 82-1234B becomes 82-X234B. Reset T h i s p r o c e d u r e a l l o w s you t o r e s e t a l l o f t h e program v a r i a b l e s . T h i s i n c l u d e s e r r o r c h e c k s and r e s p o n c e s f r o m GRAPH, 'PLOT and AVERAGE. APPENDIX 2) THE PROGRAM FILTER CONST pi=3.141592654; syde*aultname='SY:JUNKK.EMS ' i de-faultname = ' DY: TEST. EMB'5 d i 1 a b e l = ' D i s p e r s i on Index'! ident='V06.01' f TYPE c3=ARRAY[1. . 33 OF c h a r ; c5 = ARRAYC1..53 OF c h a r ; c6=ARRAYC1..63 OF c h a r ; cB=ARRAY[1..8] OF c h a r ; c9=ARRAYCl. .93 OF c h a r ; clO=ARRAYCl..103 OF c h a r ; cll=ARRAYCl..113 OF c h a r ; cl3=ARRAY[1. .133 OF c h a r ; cl6=ARRAYC1. .163 DF c h a r ; cl7=ARRAY[ 1. , 173 OF c h a r ; cl9=ARRAYCl..193 OF c h a r ; c20=ARRAYC1. . 20 3 OF c h a r ; c28=ARRAYC1. .283 OF c h a r ; C29-ARRAYC1..293 OF c h a r ; c30=ARRAYC1. . 30 3 QF c h a r ; c32=ARRAYt1. . 323 OF c h a r ; c75 » ARRAYC1..753 OF c h a r ; c80=ARRAYC1..003 OF c h a r ! wave-f ormtype=ARRAYC 1.. 10243 QF i n t e g e r ; rl026=ARRAYCl..10263 QF r e a l ; VAR s l , s 2 , s 3 , s 4 : r e a l ; s t i tn 1, s t i m2: r e a l ; d e l a y , 1 a t e n c y , s w e e p s p e e d : r e a l ; 1 ok, s t lok, st.2ok, dok, s l ok, s2ok , s3ok, s4ok, swok : char ; wavetype : ARRAYt1.^80 3 QF c h a r ; c h a n n e l number : i n t e g e r ; K K p a n s i o n f a c t o r : i n t e g e r ; name : ARRAYE1..303 OF c h a r ; age : i n t e g e r ; sex : c6! emgnumber : ARRAYC1..103 QF c h a r ; p a t i e n t t y p e : ARRAY CI..803 QF c h a r ; d a t e : c9; d i : r e a l ; error:boolean; a s c i i f i l e : tev.t.5 asciif i1ename : c6; s i z e , i : i n t e g e r ; data:r1026; * » * QKLETTER * * * * Checks to see i f the l e t t e r passed i t i s a v a l i d l e t t e r * * for a filename. If not an 'A' i s returned. * * * # * * * * # * # # # # * * # * * * » # * » * # * » * * * * * # * # # # # « # ^ FUNCTION okletter(a:char):char; BE6IN IF <(a<='Z') AND (a > =' A')) QH <<a<='z') AND (a>='a J)) OR <<a<»'9') AND (a>='0')> THEN okletter:=a ELSE okletter:='A'i END; * * * CREATEASC11FILENAME * * # * T h i s s h o r t p r o c e d u r e c o n s t r u c t s t h e a s c i i-f i 1 ename -from t h e # * EM6 number. * » # PROCEDURE c r e a t e a s c i i - f i l e n a m e ) BEBIN { c r e a t e a s c i i+'i l i a s c i i f i 1 e n a m e C 1 D := a s c i i-f i 1 ename[2] : = a s c i i - f i l e n a m e C 3 ] : = a s c i i t i 1 e n a m e C 4 ] := a s c i i + i l e n a m e C 5 ] := a s c i x i i 1 e n a m e C 6 ] := END; •Ccreat e a s c i i f i lename> >name> ok 1etter(emgnumber C2] ) ; o k l e t t e r ( e m g n u m b e r C43); o k l e t t e r ( e m g n u m b e r C 5 ] ) ; ok 1etter(emgnumber C63); o k l e t t e r ( e m g n u m b e r C73); o k l e t t e r ( e m g n u m b e r C 8 D ) ; * * * INCREMENTNAME * * * * Increments t h e - f i l e name i n a l p h a b e t i c a l o r d e r s t a r t i n g # * a t t h e s i x t h l e t t e r . Does t h i s by i n c r e m e n t i n g t h e » * emgnumber. * * * PROCEDURE incrementnamei VAR i : i n t e g e r ; d o n e : b o o l e a n ; BEGIN i:=4; emgnumber C i ] : = o k 1 e t t e r ( s u c c ( e m g n u m b e r C i ] ) ) ; c r e a t e a s c i i f i1ename; END; * * * READFLOPPY » * * * Reads i n t h e s p e c i f i e d emg d a t a f i l e from t h e f l o p p y * * d i s k . A l l of t h e emg v a r i a b l e s a r e g l o b a l . * * # PROCEDURE r e a d f l o p p y ( V A R e r r o r : b o o l e a n i V A R d a t a : r l 0 2 6 > ; VAR a s c i i f i 1 e : t e x t ; * RDATA # * # * T h i s p r o c e d u r e i s one l a r g e r e a d s t a t e m e n t t h a t r e a d s i n an * * emg waveform from an a s c i i f i l e . T h e r e a r e many d i f f e r e n t s t y l e s * * of a s c i i f i l e s p r o d u c e d by d i f f e r e n t v e r s i o n s of t h e s o f t w a r e . * * A l l of t h e s t y l e s s i n c e May 1981 a r e c o m p a t a b l e w i t h t h i s * * p r o c e d u r e as i t u s e s d e f a u l t v a l u e s i f t h e newer f i e l d s a r e * * empty. * * # * # # * # # * * * * # * # * # # # # # • • » * * * * * * # # # * # * • » # * # * * * * * * • * # # * # * # « * # # # # * • * * # * # # # # # # * > PROCEDURE r d a t a i VAR i : i n t e g e r ; s k i p 9 : c 9 ; s k i p l O : c l O ; s k i p l 3 : c l 3 ; s k i p l 9 : c l 9 ; s k i p l 6 : c . l 6 ; s k i p 2 0 : c 2 0 ; s k i p 2 8 : c 2 8 ; s k i p32:c32; i d:c6; t m p : r e a l ; BEGIN C r d a t a ) FOR i : = 1 TO 8 DO r e a d l n < a s c i i f i 1 e > i r e a d I n ( a s c i i f i 1 e , s k i p 1 9 , n a m e ) ; r e a d l n ( a s c i i f i 1 e , p a t i e n t t y p e ) ; r e a d I n ( a s c i i f i l e , i d ) ; FOR i : = 1 TO 3 DO r e a d l n ( a s c i i f i 1 e ) ; r e a d I n ( a s c i i f i l e , s k i p 9 , e m y n u m b e r , a g e , s k i p 1 0 , s e x , s k i p 10,date)> FOR i : = 1 TO 5 DO r e a d l n ( a s c i i f i 1 e ) ; r e a d l n ( a s c i i f i 1 e , 1 a t e n c y , l o k , s t i m l , s t l o k , s t i m2, s t 2 o k , d e l a y , d o k > ; FOR i:= 1 TO 5 DO r e a d l n ( a s c i i f i 1 e ) ; r e a d l n ( a s c i i f i l e , s l , s l o k , 9 2 , s 2 o k , s 3 , s 3 a k , s 4 , s 4 o k ) ; r e a d l n ( a s c i i f i l e ) ; r e a d l n ( a s c i i-f i 1 e> ! r e a d I n ( a s c i i f i l e , s k i p l 3 , s w e e p s p e e d ) $ r e a d ( a s c i i f i l e , s k i p 3 2 , c h a n n e l number)> r e a d ( a s c i i f i l e , s k i p 3 2 ) 5 IF (skip32=* D i g i t a l e x p a n s i o n f ac:tor = ' ) .THEN r e a d I n ( a s c i i f i l e , e x p a n s i o n ^ a c t o r ) ELSE BEGIN r e a d l n ( a s c i i - f i l e ) ; e x p a n s i o n f a c t o r : =1 END; r e a d l n ( a s c i i f i 1 e,wavetype)5 r e a d l n ( a s c i i f i l e ) ; IF <id<'V06.00') OR (id>'V99.99') THEN BEGIN FOR i : = 1 TO 1000 DO BEGIN r e a d ( a s c i i f i l e , t m p ) • d atati]:=64*tmpS END END Udok> ELSE BEGIN FOR i : = 1 TO 1000 DO r e a d ( a s c i i f i l e , d a t a C i ] ) ; END; FOR i:=1001 TP 1026 DO d a t a C i 3:=0.0; IF NOT e o f ( a a c i i f i l e ) THEN r e a d l n ( a s c i i f i l e , s k i p l 6 ) ; IF ( s k i p l 6 = d i l a b e l > THEN r e a d ( a s c i i - f i l e , d i > ELSE di:=999.9; END; C r d a t a ) {*####**#***#•*•#****•######»#*••#*•»*******# BEGIN w r i t e l n ; w r i t e l n ; wr i t e l n ; w r i t e l n ( ' D I G I T A L F I L T E R ' ) ; wr i t e l n ; wri t e l n s w r i t e l n ( ' E n t e r t h e emgnumber of t h e d a t a f i l e ' ) ; r e adln(emgnumber); wri t e l n ; c r e a t e a s c i i f i1ename; " r e s e t ( a s c i i f i 1 e , a s c i i f i 1 e n a m e , d e f a u l t n a m e , s i z e ) ; e r r o r : = ( s i z e = - l ) J IF e r r o r THEN BEGIN w r i t e l n C T h e f i l e a s c i i f i 1 e n a m e , ' . E M B does not e x i s t on t h e f l o p p y d i a k ' ) J w r i t e l n ( c h r ( 0 0 7 B ) ) ; END ELSE r d a t a ; END; (>****##*##»***#*•* #**#****-*»«»*#»*#**##*«^ * CQNVERTRECQRDTOASCII * * * * Th i s long boring procedure does the actu a l work of # » converting the p a t i e n t data i n t o the f i n a l form. This r o u t i n e # * i s one la r g e w r i t e statement. * * # PROCEDURE c o n v e r t r e c o r d t o a s c i i i CONST b5=' ' ; E M G VAR datai tern:i nteger; tmp:realj BEGIN ( c o n v e r t r e c o r d t o a s c i i } wr i t e l n (asci i f i 1 e, ' * w r i t e l n ( a s c i i f i 1 e , * * w r i t e l n ( a s c i i f i l e , ' * wri t e l n ( a s c i i f i1 e, ' * w r i t e l n ( a s c i i f i l e , ' * wri t e l n ( a s c i i f i 1 e , ' * wri t e l n ( a s c i i f i 1 e , ' * w r i t e l n ( a s c i i f i1e)5 w r i t e l n(asciifi1e,'Name of p a t i e n t : wri t e l n ( a s c i i f i I e , p a t i e nttype)! w r i t e l n ( a s c i i f i l e , i d e n t ) ; wr i t e l n ( a s c i i f i 1 e ) ! wri t e l n(asc i i f i 1 e ) ; w r i t e l n ( a s c i i f i l e , ' EMGNUMBER w r i t e ( a s c i i f i 1 e , ' ',emgnumber,' w r i t e l n ( a s c i i f i l e , b 5 , b 5 , d a t e ) ; P A T I E N T D A T A , a s c i i f i1ename,'.EMG iname) AGE age:7,' **); *') i *') i *') i «' > t SEX ',sex); DATE'.) ; wr i t e i n ( a s c i i f i l e ) ; wri t e l n ( a s c i i f i 1 e ) ; w r i t e l n ( a s c i i f i l e , ' w r i t e l n ( a s c i I f i 1 e , " LATENCY seconds STIMULUS1 amps STIMULUS?, amps DELAY I I ' ) ; seconds'> 5 cn w r i t e l n ( a s c i i f i l e ) ; wr i t e (asci i f i 1 e, 1 atency: 15: 6, 1 ok, s t i m l : 15: 6, s t lok) ; w r i t e l n (asci i f i l e , s t i m 2 : 1 5 : 6 , st2ok,delay: 16:6, dok) ! wri t e l n ( a s c i i f i 1 e ) ; wri t e l n ( a s c i i f i 1 e ) j w r i t e l n ( a s c i i f i l e , ' SENSITIVITY 1 SENSITIVITY 2 SENSITIVITY 3 SENSITIVITY 4 ' ) J wri t e l n (asci i f i 1 e, * v o l t s / d i v i s i o n v/d v/d v / d ' ) J wri t e l n ( a s c i i f i 1 e) ; w r i t e l n ( a s c i i - f i l e , s l : 1 5 : 1 0 , s l o k , s 2 : 1 5 : 1 0 , s2ok, s3: 15:10, s3ok, s4:15:10,s4ok){ wri t e l n (asci i -f i I e) ; w r i t e l n ( a s c i i f i l e ) ; w r i t e l n ( a s c i i f i 1 e , ' s w e e p s p e e d = ',sweepspeed:9:6,swok,' s e c o n d s / d i v i s i o n ' ) } wr i t e (asci i f i 1 e, ' the data i s from channel number ',channel number:3); w r i t e l n ( a s c i i f i l e , ' D i g i t a l expansion f a c t o r = ' , e x p a n s i o n f a c t o r : 3 ) i w r i t e l n ( a s c i i f i l e , w a v e t y p e ) > wri t e l n ( a s c i i f i 1 e ) ; FDR datai.tem:=l TO 1000 DO BEGIN tmp:=dataCdatai tern]5 IF abs(tmp)>32750.0 THEN tmp:=32750.0#abs(tmp)/tmp; w r i t e ( a s c i i f i l e , r o u n d ( t m p >:7) ; IF dataitem MOD 10 = 0 THEN w r i t e l n ( a s c i i f i l e ) ; END; w r i t e l n ( a s c i i f i l e ) } IF abs(di)>10 THEN w r i t e l n ( a s c i i f i 1 e , ' The d i s p e r s i o n index i s not defined') ELSE w r i t e l n ( a s c i i f i 1 e , ' D i s p e r s i o n index ' , d i : 5 : l ) ; wri t e l n ( a s c i i f i1 e) ENDl /* c o n v e r t r e c a r d t o a s c i i */ * * * TQFLQPPY * * # * Writes out the new data f i l e to the fl o p p y d i s k from the * * g l o b a l v a r i a b l e s . * * * PROCEDURE t o f l o p p y ; BEGIN {flop} emgnumber C 1 ] : =' D'; emgnumber 123 : = ' F' ; emgnumber C 4 3:=*17 j c r e a t e a s e i i f i l e n a m e ; r e s e t ( a s c i i f i 1 e ,asci i f i1ename,defaultname,size); wri t e l n ; WHILE ( s i z e O - 1 ) DO BEGIN w r i t e ( ' EMGNUMBER ',emgnumber); w r i t e l n (' has already been used'); i ncrementname; r e s e t ( a s c i i f i l e , a s c i i f i1ename,defaultname,size); END I s i z e := 20; rewri te ( a s c i i f i l e , a s c i i f i1ename,defaultname,size); WHILE s i z e • - 1 DO BEGIN writ e l n ( ' T h e f l o p p y disk i s f u l l or not present. ' , chr (007B) ) ; w r i t e l n ( ' P l a c e a new data disk i n the d r i v e , then press <RETURN>. ' ) ! read l n ; rewri t e ( a s c i i f i l e , a s c i i f i l e n a m e , d e f a u l t n a m e , s i z e ) ; END; con v e r t r e c o r d t o a s c i i ; c l o s e ( a s c i i f i l e ) ; wri t e l n ; w r i t e l n (' So ',emgnumber,' w i l l be used'); wr i t e l n ; writeln('DY:',asciifi1ename,'.EMG has been c r e a t e d ' ) ; END; Cflop] » * * removedc » * * » removedc s u b t r a c t s from a l l the data the average QF the * * data between windowstart AND windowstop. * * # PROCEDURE removedc(VAR data:rl026;windowstart, wi ndowstop:i nteger)> VAR windowwidth,i:integer; sum,average:real; BEGIN sum:=0.o; wi ndowwidth:=wi ndowstop-wi ndowstart+1; FOR i := windowstart TO windowstop DO sum := sum + d a t a C i J ; average :=sum/windowwidth; FDR i := 1 TO 1024 DO dataCi] := da t a C i J - average; END; * * * blackmanwindow * * *. * t h i s PROCEDURE a p p l i e s a blackman window between * * windowstart AND windowstop, WITH a i l OF t h r r e s t OF the window * * equal TO zero. * * # * # # # # # # « * # * * » * * * * # « * # # • * # # # # * * * # # # » # * # # # # * # * * # # * # » * # # * # * * # * # « * * # * * # * # # # # • > PROCEDURE blackmanwindow(VAR data:r1026;windowstart, windowstop:integer) I VAR wi ndowwi d t h , i : i n t e g e r ; a , b : r e a l ; BEGIN wi ndowwi dth: =wi ndowstop-wi ndowstart.+ 1; FOR i:= 1 TO windowstart DO dataCi1 := 0.0; FOR i := windowstart TO windowstop DO BEGIN a := cos(2.0*pi*(i-windowstart>/(windowwidth-1)); b := cos(4.0*pi *(i-windowstart)/(windowwi dth-1))> dataCi] := dataCi3«(0.42-0.5»a+0.08*b)? END I FOR i windowstop + 1 TO 1026 DO dataCi "J :=0.0; END) c*#*•*##»##•***•**•##***###******#***#•***•» #**^  * * * CONVERT * * * * Converts a f l o a t i n g p a i n t number i n t o a cha r a c t e r * * s t r i n g . Format c o n t r o l s the number of pla c e s a f t e r the * * decimal p o i n t . A negative format means no decimal * * p o i n t . The maximum f i e l d s i z e allowed i s 30 c h a r a c t e r s . * * * » # # * * # * * * * * * * # # • * » * « # * * # # * * * * * # # # * # * # # » * * # * * * # * PROCEDURE c o n v e r t ( f : r e a l ; f o r m a t : i n t e g e r ; VAR a:c30;VAR n : i n t e g e r ) ; VAR t , i , c o u n t : i nteger; power:real; BEGIN a:=' '; count:=1; IF f<0 THEN BEGIN account]:='-'; count:=succ(count); f:=-f; END! power: = 1. 0; WHILE f>9.9999*power DO power:=10.0*power; IF format>=0 THEN f :»f+4.9*e::pl0(-l-f ormat) ; REPEAT t:=trunc(f/power); atcount ] : =i:hr (4>0B+t> ; f:=f-power*t; power:=power/10.0; count: --5UCC (count) UNTIL power<0.5; IF format>=0 THEN BEGIN aCcaunt3:=*.'; count:=succ(count >; END; power:=0.1; FOR i:= 1 TO -format DO BEGIN t:=trunc(f/power); at count]:=chr(60B+t)J f: =f -power * t ; power:=power/10.0; count:=succ(count); END; n:=count-l; END; * # * SELECT # * * * Windows the frequency spectrum using window with a •» * boxcar lower end and a one quarter width Blackman upper * * end. * * # PROCEDURE select(VAR data:r1026); VAR wi ndowwi d t h , m , n , i , s t o p , s t a r t : i nteger i a,b,df,1owerbound,upperbound:real i ok:boolean; a s t r i n g : c 3 0 | BEGIN REPEAT readln(Iowerbound,upperbound); ok:= (0.0<=1awerbound) AND (1owerbaund<upperbaund) AND (upperbaund<11000. IF NOT Dk THEN writeln(1owerbound:6:1,upperbaund:6:1,' are not v a l i d ' , c h r (7)) UNTIL ok; pat en 11 yp e C 30]: = F' pat enttypeCT'l J : = I' pat] enttypeC323:= L' pat- ien 11 yp e C 33]: = " T' pat] enttypef34 i: = . ' pat i enttype! "55 ] : = convert <1owerbound,0,astring,n) ; FOR i:=l TO n + 1 DO p a t i enttypeC i +35.1: =astr i ng r i 3 5 p a t i enttypeC37+n3 : = 'T'; patientt.ypeC38+n3:=='Q' ; patienttypeC39+n]:=' ' > convert(upperbound,0,astring,m); IF n+m<40 THEN FOR i:=l TO m+1 DO patienttypeCi+n+403:=astringIi] i y dt:=100.O/sweepspeed/1024. 0; stop:=round(1owerbound/di) ; start:=round(upperbound/df) + 1; FOR i:= 1 TO 2*stop DO dataLi 3:=0.0; windowwidth:=(start-stop) DIV 4; start:=start-(windowwidth DIV B) ; IF windowwidth>1 THEN FOR i := s t a r t TO s t a r t + windowwidth DIV 2 DO BEGIN a := cos(2.0»pi*(i-start+windowwidth DIV 2)/(windowwidth-1))S b := cos(4.0*pi*(i-start+windowwidth DIV 2)/(windowwidth-1))j dataC2*i-13 := dataC2*i-13*(0.42-0.5*a+0.08*b>» dataC2*i3 := dataC2*i3*(0.42-0.5*a+0.08*b)J END! FOR i:= 2 * ( s t a r t + windowwidth DIV 2) TO 1026 DO dataCi 3:=0.0; END; •Csel ect J-cn { * # * # # * # * * * * # # * * * « * * * * * * * * * # * # * « # * * * ^ * OPTIM * * • * Removes the f a c t o r of 1024 produced by the Inverse FFT. * * Adjusts the s c a l i n g f a c t o r and the data values so as t o * * f u l l y u t i l i z e the i n t e g e r range i n the data f i l e . Two * * s a f e t y b i t s are l e f t to prevent i n t e g e r overflow on * * a d d i t i o n . This leaves 14 b i t s t o be used. * •» * ###*#**•*»*•*»#»*•****•#•«»*#*»«•##*»*# PROCEDURE optim<VAR data:r1026)( VAR i : i nteger j max,min,s,seale:real; BEGIN max:=-9.9E20J min:=9.9E20j FOR i:= 1 TO 1024 DO BEGIN dataCi3:=dataCi 3/1024.0; IF dataCi 3 >max THEN max:=dataCi 3; IF dataCi 3<min THEN min:=dataCi 3; END; IF max=min THEN wri t e l n<*error no s i g n a l p r e s e n t c h r < 0 0 7 B ) ) ELSE BEGIN scale:=12800/(max-min); CASE channel number OF l : s : = s i ; 2: s:=s2; 3: s:=s3; 4: s:=s4; END; s:=s/scalej CASE channel number OF l : s l : = s ; 2:s2:=s; 3: s3:=s5 4:s4:=s; END; min:=min> FOR i:= 1 TO 1000 DO dataCi]:=(dataCi]-min)*scale-6400.0; ENDfelse> E N D ; cn * # * TRANSFORM * « * * Performs a r e a l to symmetr i c-comp 1 e:< Fast F o u r i e r * * Transform on the data. If i n v e r s e i s t r u e then an * * inv e r s e FFT i s c a l c u l a t e d . The i n v e r s e comes out a * * f a c t o r of 1024 too l a r g e . This f a c t o r i s removed i n * * OPTIM. F u l l d e t a i l s on FFT l i s t e d i n UBC FQURT. * * * ###*#*#**•»*••»***#•»#*•»»•*•»##**#•»*#****»***##*******#**** PROCEDURE transform(inverse:boolean; VAR d a t a : r l 0 2 6 ) ; VAR isign,ndim,nodim,iform:integer5 PROCEDURE four2(VAR data:r1026;VAR n d i m , n o d i m , i s i g n , i f o r m : i n t e g e r ) ; FORTRAN; BEGIN ndim := 1024; nodim := 1; i see f f t documentation FOR d e t a i l s } IF inverse THEN BEGIN i s i g n := 1} iform := -1; END ELSE BEGIN i s i gn := -1; iform := 0) END; four2(data,ndim,nodim,isign,iform) ; E N D ; » MAIN BLOCK * * # * T h i s program r e a d s i n t h e d a t a -from t h e -floppy d i s k f i l e * * t h a t t h e u s e r r e q u e s t s . The d a t a has t h e DC removed, i s # * windowed, and t r a n s f o r m e d . A band of t h e s p e c t r u m i s * * s e l e c t e d by t h e u s e r . The s p e c t r u m i s i n v e r s l y * * t r a n s f o r m e d and t h e s c a l i n g i s o p t i m i z e d . The r e s u l t i s * * o u t p u t i n t o a f i l e on t h e f l o p p y d i s k . If a f i l e o f t h e * * same name a l r e a d y e x i s t s t h e name i s i n c r e m e n t e d u n t i l a • * u n i q u e name i s f o u n d . * * # ***#*•###********#*##*##******#**«**#**^ BEGIN {main.} r e a d f I o p p y ( e r r o r , d a t a ) ; IF NOT e r r o r THEN BEGIN wri t e l n ; w r i t e l n j w r i t e l n ( ' E n t e r t h e lower and upper f r e q u e n c y b o u n d s . ' ) ; c l o s e ( a s c i i f i l e ) ; r e m o v e d c ( d a t a , 1 0 , 9 6 0 ) ; blackmanwi ndow(data,10,960); t r a n s f o r m ( f a l s e , d a t a ) ; s e l e c t ( d a t a ) s w r i t e l n ; t r a n s f o r m ( t r u e , d a t a ) ; wri t e l n I o p t i m ( d a t a ) ; t o f l o p p y I END; END. APPENDIX 3) THE PROGRAM WARP {#*****•*#*#*»********•»**#*#**#****##»******•»•** * * * CREATEASCI IFILENAME * * * * T h i s s h o r t p r o c e d u r e c o n s t r u c t s t h e a s c i i f i I e n a m e f r o m t h e » * EMG number . * * * *#»*#»#**##»*#***»*•»#***•#«»*#•###*»####*»***#»####»*#*##»*##»#«##***#*> PROCEDURE c r e a t e ( V A R a s c i i f i 1 e n a m e : c 1 3 5 emgnumber:cB)5 BEGIN { c r e a t e a s c i i f i 1 e n a m e } a s c i i f i 1 e n a m e : = ' * ; a s c i i f i 1 enamel 1] := emgnumberC23j a s c i i f i 1 enamel 2] := emgnumberC4] ; a s c i i f i 1 e n a m e C 3 3 := emgnumberC53; a s c i i f i 1 e n a m e t 4 ] := emgnumber [63; a s c i i f i 1 e n a m e [ 5 ] := e m g n u m b e r C 7 1 ; a s c i i f i l e n a m e C 6 3 := emgnumberC83j END; { c r e a t e a s c i i f i1ename) { * # * # # # * # * # » # # » # # # * # * * * » # # # # * » * # » « * # * * # # * ^ * ZERODC * * * * Removes any DC component from the array passed to i t . * » * PROCEDURE zerodc(VAR «:rvec); VAR sum:real ; i: i n t e g e r ; BEGIN sum:=0.0; FOR i:=l TO nsamples DO sum: =sum+:< Ci 3 ; sum:=sum/nsamples; FOR i:=l TO nsamples DO C i ]: =x C i ]-sum> END; <zerodc} {•••###»##*»****##*#»*»###*#**##«###*#»*#«#*#«^ * * * INPUTF * * » * Reads t h e s t a n d a r d EMG d a t a - f i l e whose emgnumber i s # * p a s s e d i t . The waveform i n m i c r o v o l t s i s r e t u r n e d . The * * f u n c t i o n r e t u r n s a t r u e v a l u e i f t h e . d a t a h a s been r e a d * * p r o p e r l y . * * » FUNCTION i n p u t f ( e m g n u m b e r : c 8 ; V A R d a t a : r v e c ) : b o o l e a n ; CONST d i 1 a b e l = ' D i s p e r s i o n Index's i d e n t = ' V 0 6 . 0 2 ' ; d e f a u l t n a m e = " D Y : T E S T . E M G ' j TYPE c2«=ARRAYC 1. . 23 QF c h a r ; . -c4 = A R R A Y C 1 . . 4 ] OF c h a r ; c5 = ARRAYC1 . .53 OF c h a r ; c6 = A R R A Y ! 1 . . 6 ] QF c h a r ; c9 = A R R A Y C 1 . . 9 ] QF c h a r ; c lO=ARRAYC1. .101 QF c h a r ; c l 3=ARRAYC1 . .133 OF c h a r ; c l 6 = A R R A Y C l . . 1 6 ] QF c h a r ; c l 9 = A R R A Y C l . . 193 OF c h a r ; c 2 0 = A R R A Y t l . . 2 0 3 OF c h a r ; c28=ARRAYC 1. . 2 8 3 OF c h a r ; c30=ARRAYC l . . 303 OF c h a r ; c32=ARRAYC1. .32 3 QF c h a r ; c75 = ARRAYC1 . .753 OF c h a r ! cB0=ARRAY[1 . .803 QF c h a r ; c82=ARRAYC1. .82 3 QF c h a r ; r 5 1 2 = A R R A Y C l . . 5 1 2 3 OF r e a l ; wave fo rmtype=ARRAY t1 . . 10003 QF i n t e g e r ! { N O T E 1 0 0 0 NOT 1 0 2 4 s t a t u s t y p e = RECORD s:ARRAYS 1 . .43 QF r e a l ; {MODIFIED NOV 19833 s t i m l , s t i m 2 : r e a l ; d e l a y , 1 a t e n c y , s w e e p s p e e d : r e a l j 1 o k , s t l o k , s t 2 o k , d o k , swok: c h a r ; s o k : c 4 ; {MODIFIED NOV 1983} END; VAR wavetype : ARRAY[1 . .BOH O F c h a r ; s t a t u s : s t a t u s t y p e ; channe lnumber : i n t e g e r ; e x p a n s i o n - f a c t o r : i n t e g e r ; name : c 3 0 ; age : i n t e g e r ; sex : c 6 ; p a t i e n t t y p e : cBO; d a t e : c 9 ; waveform : w a v e f o r m t y p e ; d i : r e a l ; i : i n t e g e r ; s e a l e : r e a l ; a s c i i f i 1 e : t e x t ; a s c i i f i 1 e n a m e : c 1 3 ; s i z e : i n t e g e r ; * * * RDATA • * # * Does t h e a c t u a l r e a d i n g o f t h e d a t a f i l e . * * * PROCEDURE rda t a S VAR t m p , i : i n t e g e r ; i d : c 6 ; 5 k i p 9 : c 9 ; s k i p l O : c l O ; s k i p 1 3 : c l 3 ; s k i p l 9 : c l 9 ; s k i p 16: c 16>; s k i p 2 0 : c 2 0 ; s k i p 2 B : c 2 B ; s k i p 3 2 : c 3 2 ; OO BEGIN <rdata> FDR i : = 1 TO 8 DO r e a d l n ( a s c i i f i 1 e ) j r e a d l n ( a s c i i f i l e , s k i p l 9 , name) > r e a d l n ( a s c i i-f i 1 e, p a t i e n t t y p e ) I r e a d l n ( a s c i i f i l e , i d ) i FOR i : = 1 TO 3 DO r e a d l n ( a s c i i f i 1 e ) ; r e a d l n ( a s c i i f i l e , s k i p 9 , emgnumber , a g e , s k i p l O , sex , s k i p l O , d a t e ) ; FOR i : = 1 TO 5 DO r e a d l n ( a s c i i f i 1 e ) ! WITH s t a t u s DO BEGIN r e a d l n ( a s c i i f i 1 e , 1 a t e n c y , 1 o k , s t i m l , s t l o k , s t i m 2 , s t 2 o k , d e l a y , d o k ) ; FOR i : = 1 TO 5 DO r e a d l n ( a s c i i f i 1 e ) J r e a d l n ( a s c i i + i 1 e , s C U , s o k C U , s C 2 ] , sokC23 , sC33 , s o k C 3 3 , s C 4 3 , s o k C 4 3 ) r e a d l n ( a s c i i f i 1 e ) ; r e a d l n ( a s c i i f i 1 e > ; r e a d l n ( a s c i i f i l e , s k i . p l 3 , s w e e p s p e e d ) ! r e a d ( a s c i i f i 1 e , s k i p 3 2 , c h a n n e l n u m b e r ) > r e a d ( a s c i i f i l e , s k i p 3 2 ) J IF ( s k i p 3 2 " ' D i g i t a l e x p a n s i o n f a c t o r = ) THEN r e a d l n ( a s c i i f i l e , e x p a n s i o n f a c t o r ) ELSE BEGIN r e a d l n ( a s c i i f i l e ) ! e x p a n s ! o n f a c t o r : = 1 END | r e a d l n ( a s c i i f i l e , w a v e t y p e ) % END! Cwith s t a t u s ) r ead I n ( a s c i i f i l e ) ; IF < i d < ' v 0 6 . 0 0 ' ) OR <id>'V99.99*) THEN BEGIN FOR i : = 1 TO 1000 DO BEGIN r e a d ( a s c i i f i I e , t m p ) ; waveform! i]:=64*tmpl END END t i d o k ) ELSE BEGIN FOR i : = 1 TO 1000 DO r e a d ( a s c i i f i 1 e , w a v e f o r m C i 1 ) l END; IF NOT e o f ( a s c i i f i l e ) THEN r e a d I n ( a s c i i f i l e , s k i p l 6 ) ! IF ( s k i p l 6 = d i l a b e l ) THEN r e a d ( a s c i i f i l e , d i > ELSE d i:=999.9; c l o a e ( a s c i x f i I e ) ; END; C rda ta J BEGIN c r e a t e ( a s c i i f i l e n a m e , e m g n u m b e r ) ; r e e e t ( a s c i i f i 1 e, a s c i i f i 1 ename, de f a u l tname, s i z e ) ; IF ( s i z e = - l > THEN BEGIN w r i t e l n ( ' T h e f i l e a s c i i f i 1 e n a m e , ' . E M G d o e s n o t e x i s t on t h e f l o p p y d i s k ' wr i t e l n ; i n p u t f : = f a l s e ; END ELSE BEGIN r d a t a j s c a l e : = s t a t u s . s i c h a n n e l number ] /e:< pans i on f actor-* 1. 0 E 6 / 3 2 . 0 / 6 4 . 0 ; FDR i : = 1 TO n s a m p l e s DO d a t a C i ] : = w a v e f o r m C ( i - 1 ) * e v e r y + s t a r t 3 * s c a l e J z e r a d c ( d a t a ) ; i n p u t f : = t r u e j END; END; •Cinputf > * FETCHSTANDARDWAVE * * # * F e t c h e d s t h e s t a n d a r d wave -from t h e f i l e TMPLT.WRP. * * * #*«*•»##*«»***#»*##***#***»#•**##•*•***#*## » * # # # * # * * * * * * * # » • » # * » » # * # * • » # * * » * # # } FUNCTION f e t c h s t a n d a r d w a v e ( V A R ;: : r v e c >: b o o l ean i VAR s i z e : i n t e g e r ; s w f i l e : F I L E OF r v e c i BEGIN f e t c h s t a n d a r d w a v e : = f a l s e ; r e s e t ( s w f i 1 e , sw f i1 e n a m e , d e f a u l t n a m e , s i z e ) j IF s i z e = - l THEN w r i t e l n C * * * * * * ERROR * * * * * * s t a n d a r d wave f i l e r e s e t p r o b l e m ' ) ELSE BEGIN x : =swf i 1 e "'"» c l o se (swf i 1 e) ; f e t c h s t a n d a r d w a v e : = t r u e i END I { s ize } END! { f e t ch } •c #****#*»***## •**##***#»#*»**#**#»*#+**##^ * W A R P • * » * From t h e two waves a and b warp -f inds t h e o p t i m a l * * w a r p i n g - func t ion w and t h e m i n i m a l c o s t - f u n c t i o n . » * * * * #**#*##***»#*##*#«*****«•»#####*»#***«#«****«#»*##*#*»#»#***#***»•##*»*##**> <!*A-> I C o m p i l e r S w i t c h e s t o t u r n of-f a r r a y bounds and s t a c k c h e c k i n g } {*T-> PROCEDURE w a r p ( a , b : r v e c ; VAR w : i v e c ; VAR c o s t l r e a l ) ; TYPE precord=RECORD p n t : i vec i END; VAR p a y l , l a s t , t h i s : r v e c j e n t e r , t m p , c o u n t , i , s i z e : i n t e g e r » payof-f, t2: r e a l j n O i n a r o w , p o i n t e r s : i v e c ; p o i n t - f i l e : F I L E OF p r e c o r d ; { # * # # « # # « # » # * # # # * * * * » # » # » * * * # » « * * » * « « # # * # # * * ^ * # * # * MAX » * * * This f u n c t i o n r e t u r n s the maximum between i and stop of • * the vector t and i t s p o s i t i o n p. * * * F U N C T I O N max(VAR p : i n t e g e r i i , s t o p : i n t e g e r ; t : r v e c > : r e a l ! { t h i s f u n c t i o n r e t u r n s the maximum between i and stop of the v e c t o r t and i t s p o s i t i o n p> V A R j : i nteger; t j , t m p : r e a l ; B E G I N t m p : = - 9 . 9 9 9 9 9 E 2 0 ; F D R j:= i TO stop DO B E G I N t j : = t C j l ; I F tj>tmp T H E N B E G I N p:=j» tmp:=tji E N D ; E N D ; max:=tmp; ENDI {max) * # * FINDTHEMAX + * * * T h i s p r o c e d u r e -f inds t h e maximum p a y o f f p o s s i b l e -from * * p o s i t i o n C c o u n t , i 3 and r e t u r n s themax and p t h e p o i n t e r * * t o i t s l o c a t i o n . i f t h e maximum p a y o f f i s n e g a t i v e and * * i i s an edge p o s i t i o n t h e n p and themax a r e z e r o e d t o * * i n d i c a t e a p a t h o u t s i d e t h e a r r a y . * * » »•#*»#»*#»»#»***»#*•»***#*•«*•*##***###****#»#*** PROCEDURE f i n d t h e m a x ( b c o u n t : r e a l ; i : i n t e g e r ; a , 1 a s t : r v e c ; VAR n O i n a r o w : i n t e g e r ; VAR t h e m a x : r e a l ; V A R p : i n t e g e r ) ; VAR t m p , i p l u s 4 , j , s t o p : i n t e g e r ; s u m : r e a l ; t : r v e c ; BEGIN {The p a y o f f f u n c t i o n i s s y m m e t r i c a l between a and b. * * If w ( t ) O w ( t + l> * t h e n * payo f f=sum i=w(t> t o w ( t+ l ) b C t 3 * a C i 3 * - a l p h a * ( w ( t ) - w ( t + l ) - l ) * (w( t )-w( t+1>-1) * e l s e * p a y o f f = b C t a * a C w ( t ) 3 - a l p h a « ( 2 * n u m b e r o f z e r o s i n a row + 1 ) * » 2 * * T h i s makes t h e p e n a l t y f o r k z e r o s i n a row t h e same a s f o r a jump of k+1 * wh i ch p r e s e r v e s t h e d e s i r e d symmet ry . 3-nOi na row :=succ (nO ina row )> s u m : = b c o u n t * a C i I ; t C i 3 : = s u m - a l p h a * ( 2 * n 0 i n a r o w - l ) + 1 a s t C i 3; { 2 n 0 + l = n 0 » n 0 - ( n O - 1 ) * ( n O - 1 ) > Oo O { look o n l y at :i and above as m o n o t o n i c " path} { look o n l y 4 up f o r speed} i p i u s 4 : = i +4; IF i p i u s4<nsamp les THEN s t o p : = i p l u s 4 ELSE s t o p : = n s a m p l e s ; tmp :=0 ; FOR j : = s u c c ( i ) TO s t o p DO BEBIN t C j ] : = s u m - ( t m p * t m p ) * a l p h a + l a s t C j1 i t m p : = s u c c ( t m p ) ; s u m : = s u m + b c o u n t * a C j ] ; END; t h e m a x : = m a x ( p , i , s t o p , t ) ; {check i f g o i n g out t h e t op i s b e t t e r } IF ( i p l u s 4 > n s a m p l e s ) AND (thema:<<0.0) THEN BEGIN t h e m a x : = 0 , 0 ; p : = 0 » { a 0 p o i n t e r means o u t t h e top} END; IF p O i THEN n 0 i n a r o w : = 0 ; END; {f i ndthemax} BEGIN FOR i : = l TO n s a m p l e s DO BEGIN l a s t t i ] : = 0 . 0 ; nOi narowC i3 :=05 END; { z e r o i n g l o o p ) s i z e : =nsam.pl e s+1 ; r e w r i t e ( p o i n t - f i l e , p - f i l ename, de-f a u l tname, s i z e ) ! IF s i z e < l THEN wr i t e l n (* * * * p o i n t - f i l e r e w r i t e e r r o r * « * ' , c h r (7) > ELSE BEGIN w r i t e l n ( ' W a r p i n g b e g i n s . Co lumns d o n e : ' ) ; FOR c o u n t : = n s a m p l e s D0WNT0 1 DO BEGIN IF c o u n t MOD 10 = 0 THEN w r i t e l n ; w r i t e ( c o u n t : 5 ) ; { d i s p l a y c o u n t t o show a c t i v i t y > FOR i : = l TO n s a m p l e s DO fi n d t h e m a x ( b C c o u n t D , i , a , 1 a s t , n O i n a r o w C i 3 , t h i a C i 3 , p o i n t e r s C i ] ) ! l a s t : = t h i s ; point-f i l e " . p n t : = p o i n t e r s ; pu t ( p o i n t f i l e ) i p a y lC c o u n t J:=thisC1]; END | {•for c o u n t ) w r i t e l n ; co {Find the best payoff i n the column C1, * J } . payoff:=max(wC1],1,nsamples,1ast)! { f i n d the best payoff i n the row [*,13 i f t h i s i s b e t t e r then the optimal path s t a r t s below 1 and comes up partway} t2: =ma:< (enter, 1, nsamples, payl) ; writeln('Column 1 payoff=',payoff:12:6,' t2 =',t2:12:6)S IF payoff<t2 THEN BEGIN payoff:=t2; { a p o i n t e r of -1 i n d i c a t e s a path below the array} FOR count: =1 TO enter-1 DO wCcount ~i : =-1S •fEnter the Array at the optimal p o s i t i o n } wCenter]: =15 END ELSE enter:=15 { s t a r t from the column that the path enters the ar r a y and t r a c k the path to the f a r s i de} count:=enter; w r i t e l n ( ' s e e k i n g p o i n t e r number: ' ) j WHILE count<nsamples DO BEGIN seek(poi ntf i1e,nsamples-count + 1)5 tmp: »poi ntf i 1 e'". pnt CwCcount 3 3 j { a 0 p o i n t e r means that the optimal path went out the top} IF tmp>0 THEN wCcount+13:=tmp ELSE WHILE count<nsamples DO BEGIN wCcount+13:=tmp! count:=succ(count)5 ENDS count:=succ(count); END; {whi1e} co co IF payoff<=G.G THEN c o s t : = 1 . 0 E 2 0 ELSE cost:=1.O/payoff ; c l o s e ( p o i n t f i l e ) ; END; f r e w r i t e f i l e ok> END; twarp) CA+} <T+} { Compiler Switches t o turn on array bounds and stack checking} * * * OIJTF'UTF # * # * Writes out the warping f u n c t i o n and cost f u n c t i o n i n t o * * the o u t f i l e WARPED.DAT. * * - * PROCEDURE outputf(aemgnumber:c85wtime:ivec;VAR c o s t : r e a l ) } VAR i , diff,nOinarow,count: i n t e g e r ; o u t f i l e : t e x t 5 BEGIN write(aemgnumber,' compared to the Standard wave: Cost Factor <= J,cost:7:3) rewri t e ( o u t f i 1 e , outf i 1 ename) ; wr i t e l n ( o u t f i l e ) ; w r i t e ( o u t f i 1 e , ' ALPHA = ',alpha:12:8,'nsamples =*,nsamples:5)! w r i t e l n ( o u t f i l e , ' s t a r t = ' , s t a r t : 5 , ' every = ',every:5>; write(outfile,aemgnumber,' compared to the Standard. Cost = ',cost:7:3); w r i t e l n ( o u t f i l e ) ; FDR c o u n t : = 1 TO n s a m p l e s DD BEGIN w r i t e ( o u t f i 1 e , w t i me[count 1:5)> w r i t e ( w t i m e C c o u n t l : 5 ) ! IF c o u n t MOD 10 = 0 THEN BEGIN w r i t e l n ( o u t f i l e ) j wr i t e l n ; END! END! w r i t e l n ( o u t f i l e ) > c l o s e ( o u t f i 1 e ) ; END; t o u t f > { # # # # # # # # # * * » * * # * » * * # # - * # # « * * # # « « # » # * # * * * * « * * * # ^ # • # MAIN BLOCK * » * # * * A s k s t h e u s e r f o r t h e emgnumber of t h e wave t o be * * wa rped . Reads i n t h a t wave and t h e s t a n d a r d wave u s i n g * * INPUTF. Warps t h e s e waves u s i n g WARP and o u t p u t s the * * r e s u l t s u s i n g OUTPUTF. * * * BEGIN w r i t e l n C DYNAMIC TIME WARPING TO STANDARD WAVE ' ) } w r i t e l n l I F f e t c h s t a n d a r d w a v e ( b d a t a ) THEN BEGIN wri t e l n ! w r i t e l n ( ' E n t e r t h e emgnumber o f t h e wave t h a t you w i s h t o w a r p . ' ) } r e a d l n ( a e m g n u m b e r ) ; IF i n p u t f ( aemgnumber ,ada ta ) THEN BEGIN w a r p ( a d a t a , b d a t a , w t i m e , c o s t ) ; o u t p u t f ( a e m g n u m b e r , w t i m e , c o s t ) > END; C i n p u t aJ END; { f e t ch } END. APPENDIX 4) THE PROGRAM WEFT CONST maxnsamples=300 ; warp-f i 1 ename=' DL : warp . d a t ' ; syde-f a u l t n a m e = ' S Y : J U N K K . E M G ' ; de-f a u l tname = ' DY: TEST . EMG ' i d i l a b e l = ' D i s p e r s i o n I n d e x ' J i d e n t = ' V 0 6 . 0 1 ' ; TYPE c 3 = A R R A Y C l . . 3 3 OF c h a r ; c5 = ARRAYC1. .53 OF c h a r ; c 6 = A R R A Y C l . . 6 3 OF c h a r ; c 8 = A R R A Y C l . . 8 3 OF c h a r ; c 9 = A R R A Y C l . . 9 3 OF c h a r ; c lO=ARRAYC1 . . 103 OF c h a r ; c l l = A R R A Y C l . . 1 1 3 OF c h a r ; c l 3 = A R R A Y C 1 . . 1 3 3 OF c h a r ; c l 6 = A R R A Y C 1 . . 1 6 3 OF c h a r ; c l 7 = A R R A Y C 1 . . 1 7 3 OF c h a r ; c l 9 = A R R A Y C l . . 1 9 3 OF c h a r ; c20=ARRAYC1 . .20 3 OF c h a r ; c 2 8 = A R R A Y C I . . 2 8 3 OF c h a r ; c 2 9 = A R R A Y C I . . 2 9 3 OF c h a r ) c 3 0 = A R R A Y C l . . 3 0 3 OF c h a r ; C 3 2 - A R R A Y C 1 . . 3 2 3 OF c h a r t c33=ARRAYC1. .333 OF c h a r ; c 7 5 = ARRAYC1. .753 OF c h a r ; c B O - A R R A Y C l . . 8 0 3 OF c h a r ; wave-formtype=ARRAYC 1.. 10243 OF i n t e g e r ; w a r p t y p e = A R R A Y C 1 . . m a x n s a m p l e s 3 OF i n t e g e r ; i 1 0 0 0 - A R R A Y C I . . 1 0 0 0 3 OF i n t e g e r ; VAR s i , s 2 , s 3 , s 4 : r e a l > s t i m l , s t i m 2 : r e a l j d e l a y , 1 a t e n c y , s w e e p s p e e d : r e a l ; l o k , s t l o k , s t 2 o k , d o k , s i o k , s 2 o k , s 3 o k , s 4 o k , s w o k : c h a r ; wave t ype : ARRAYC1. .803 OF c h a r ; c h a n n e l n u m b e r : i n t e g e r ! e x p a n s i o n f a c t o r : i n t e g e r ) name : c 3 0 ; age : i n t e g e r ; sex : c6[ emgnumber : c l O ; m e s s a g e , p a t l e n t t y p e : c 8 0 ; Co d a t e : c 9 ; d i : r e a l ; e r r o r : b o o 1 e a n ; a s c i i f i l e : t e x t ; a s c i i f i 1 e n a m e : c 6 ; n s a m p 1 e s , s t a r t , e v e r y , s i z e , i : i n t e g e r ; d a t a : i 1 0 0 0 ; w a r p : w a r p t y p e ; { > # # # • * « * # * # * * * * # # # * # » • * * * # # # » * # * * * # * • • # # # * * * * * * * * OKLETTER * # * # C h e c k s t o s e e i f t h e l e t t e r p a s s e d i t i s a v a l i d l e t t e r * • f o r a f i l e n a m e . I f no t an ' A ' i s r e t u r n e d . * * * * # # * # # # # * » # * # # • # * * * * # » * # • * * * * # * # • * » » # » * * * « * * * # * * * # * » # # FUNCTION o k l e t t e r ( a : c h a r ) : c h a r j BEGIN IF <<a<="Z'> AND <a>='A ' ) ) OR <<a<='z ' ) AND <a>='a' )> OR <<a<=*9') AND <a>='0'>) THEN o k l e t t e r : = a ELSE o k l e t t e r : = * A ' ; E N D ; •» # * CREATEASCI I FILENAME * * # * T h i s s h o r t p r o c e d u r e c o n s t r u c t s t h e a s c i i f i 1 ename -from t h e * * EMG number . * * * PROCEDURE c r e a t e a s c i i - f i l e n a m e ; BEGIN C c r e a t e a s c i i i i l i a s c i i i i 1 e n a m e C 1 3 := a s c i i f i 1 e n a m e C 2 J : = a s c i i f i 1 e n a m e [ 3 3 := a s c i i i i 1 e n a m e C 4 3 := a s c i i f i 1 e n a m e C 5 3 := a s c i i-f i lenameC63 : = END) { c r e a t e a s c i i f i1 enamel m a m e ) o k l e t t e r ( e m g n u m b e r C 2 3 ) ; o k l e t t e r ( e m g n u m b e r C 4 3 ) ; o k l e t t e r ( e m g n u m b e r 1 5 3 ) ! o k l e t t e r ( e m g n u m b e r C 6 3 > ; o k l e t t e r ( e m g n u m b e r C 7 3 ) ) o k l e t t e r ( e m g n u m b e r C 8 3 ) ; { # # # # * * * * # # * # # * » » » « # * * » * * * - * # * * * * # * # » # # * # # # » # * ^ * INCREMENTNAME * * * * I n c r e m e n t s t h e f i l e name i n a l p h a b e t i c a l o r d e r s t a r t i n g • * a t t h e s i x t h l e t t e r . Does t h i s by i n c r e m e n t i n g t h e * * emgnumber. * * * PROCEDURE i n c r e m e n t n a m e ; VAR i : i n t e g e r ; d o n e : b o o l e a n ; BEGIN I :=4 ; emgnumber C i 3 :=ok1e t t e r ( suc c ( emgnumber C i 3 ) > ; c r e a t e a s e i i f i l e n a m e ; END; {#*#*#«##*****##*****#**#***##****#*******###*#**^ * READFLOPPY # * * * Reads i n t h e s p e c i f i e d emg d a t a f i l e f r om t h e f l o p p y * * d i s k . A l l of t h e emg v a r i a b l e s a r e g l o b a l . * * * #*##*#********#*******###******#*#*##**#*#**#«*^ PROCEDURE r e a d f l o p p y ( V A R e r r o r : b o o l e a n i V A R d a t a : i l O O O ) ; VAR a s c i i f i l e : t e x t ; {#**####*###•****•»*#**#*###*###*###•»##***#*•***•**#»####*###**##»**•##«#* * * * RDATA » * • » T h i s p r o c e d u r e i s one l a r g e r e a d s t a t e m e n t t h a t r e a d s i n an # * emg waveform f rom an a s c i i f i l e . T h e r e a r e many d i f f e r e n t s t y l e s * * o f a s c i i f i l e s p r o d u c e d by d i f f e r e n t v e r s i o n s o f t h e s o f t w a r e . * * A l1 o f t h e s t y l e s s i n c e May 19B1 a r e c o m p a t a b l e w i t h t h i s * * p r o c e d u r e as i t u s e s d e f a u l t v a l u e s i f t h e newer f i e l d s a r e * * empty . * * # PROCEDURE r d a t a ; VAR i : i n t e g e r ; s k i p 9 : c 9 j s k i p l O : c l O ; s k i p 1 3 : c 1 3 ; s k i p l 9 : c l 9 ; s k i p l 6 : c l 6 ; s k i p 2 0 : c 2 0 ; s k i p 2 8 : c 2 8 ; s k i p 3 2 : c 3 2 ; i d : c 6 : t m p : i n t e g e r ; BEGIN O d a t a } FDR i : = 1 TO 8 DG r e a d l n ( a s c i i f i 1 e) ; r e a d l n ( a s c i i f i 1 e , s k i p 1 9 , n a m e ) ; r e a d l n ( a s c i i f i 1 e , p a t i e n t t y p e ) ; r e a d l n < a s c i i f i l e , i d ) ; FOR i : = 1 TO 3 DO r e a d l n ( a s c i i f i 1 e ) ; r e a d l n ( a s c i i f i l e , s k i p 9 , e m g n u m b e r , a g e , sk i p 1 0 , sex , s k i p l O , d a t e ) J FDR i : = 1 TO 5 DO r e a d l n < a s c i i f i 1 e ) ; r e a d l n ( a s c i i f i 1 e, 1 a t e n c y , 1 ok , s t i ml,, s t t o k , s t i m2, s t 2 o k , d e l a y , dok ) FOR i : = 1 TO 5 DO r e a d l n ( a s c i i f i 1 e ) ; r e a d l n ( a s c i i f i l e , s l , s l o k , s 2 , s 2 o k , s 3 , s 3 o k , s 4 , s 4 o k ) ; r e a d l n ( a s c i i f i l e ) ; r e a d l n ( a s c i i f i 1 e ) j r e a d l n ( a s c i i f i 1 e , s k i p 1 3 , s w e e p s p e e d ) ; r e a d ( a s c i i f i l e , s k i p 3 2 , c h a n n e l n u m b e r ) ; r e a d ( a s c i i f i 1 e , s k i p 3 2 ) ; IF ( s k i p 3 2 = ' D i g i t a l e x p a n s i o n f a c t o r 3 ' ) THEN r e a d l n ( a s c i i f i 1 e , e x p a n s i o n f a c t o r ) ELSE BEGIN r e a d l n ( a s c i i f i 1 e ) ; e x p a n s i o n f a c t o r : = 1 END; r e a d l n ( a s c i i f i l e , w a v e t y p e ) ; r e a d l n ( a s c i i f i 1 e ) j IF < i d < ' V 0 6 . 0 0 ' ) OR < i d > ' V 9 9 . 9 9 ' ) THEN BEGIN FDR i : = 1 TD 1000 DO BEGIN r e a d ( a s c i i f i 1 e , t m p ) ; d a t a l i ] : = 6 4 * t m p ; END END { idok> ELSE BEGIN FDR i : = 1 TD 1000 DO r e a d ( a s c i i f i l e , d a t a C i T ) ! END; IF NOT eo-f ( a s c i i-f i l e ) THEN r e a d l n ( a s c i i - f i l e , s k i p l 6 ) ; IF < s k i p l 6 = d i l a b e l > THEN r e a d ( a s c i i-f i l e , d i ) ELSE d i : = 9 9 9 . 9 ; BESIN c r e a t e a s c i i f i 1 e n a m e ; r e s e t ( a s c i i f i l e , a s c i i f i 1 e n a m e , d e f a u l t n a m e , s i z e ) ; e r r p r : = < s i z e = - l ) ; IF e r r o r THEN BEGIN w r i t e l n ( ' The - f i l e ' , a s c i i f i 1 ename, ' . EMG does n o t e x i s t on t h e f l o p p y d i s k ) ; w r i t e l n ( c h r ( 0 0 7 B ) ) ; END ELSE r d a t a ; END; { rdata } END; ro {*#*#**#*#*###*#»«#•**•*«#*##**#*»*#**»##-**^ * CONVERTRECORDTOASCII * * * * T h i s l o n g b o r i n g p r o c e d u r e does t h e a c t u a l work o-f * * c o n v e r t i n g t h e p a t i e n t d a t a i n t o t h e f i n a l f o r m . T h i s r o u t i n e * * i s one l a r g e w r i t e s t a t e m e n t . * * # PROCEDURE c o n v e r t r e c o r d t o a s c i i ; CONST b 5 = ' VAR d a t a i t e m : i n t e g e r ; t m p : r e a l ; BESIN { c o n v e r t r e c o r d t o a s c i i } wr wr wr w r i t e l n ( a s c i i f i l e f i l e , f i l e , ' * f i l e , '# E M G P A T I E N T D A T A f i l e , * * f i l e , f i l e , ' , a s c i i f i 1 e n a m e , * . E M G f i l e , ' * f i l e ) ; f i l e , 'Name of p a t i e n t : ' name)• f i l e , p a t i e n t t y p e ) ; f i l e , 1 d e n t ) ; f i l e ) ; f i l e ) ; f i l e , EMGNUMBER AGE SEX l e , ' ' , e m g n u m b e r , ' ' , a g e : 7, ' ' , se:< f i l e , b 5 , b 5 , d a t e ) ; f i l e ) f i l e ) ; f i l e , LATENCY STIMULUS1 STIMULUS2 f i l e , ' s e c o n d s amps amps «'); #') i * ' ) ; #*); #') i » ' ) ; D A T E ' ) ; DELAY I I ' ) ; s e c o n d s ' ) > ) 8 to CO wr i t e l n ( a s c i i f i 1 e ) ; w r i t e ( a s c i i f i 1 e , 1 a t e n c y : 1 5 : 6 , 1 o k , s t i m l : 1 5 : 6 , s t l o k ) ; w r i t e l n ( a s c i i f i 1 e, s t i m2: 15: 6, s t 2 o k , d e l a y : 1 6 : 6 , d o k > ; w r i t e l n ( a s c i i f i l e ) ; wr i t e l n ( a s c i i f i 1 e) i w r i t e l n ( a s c i i f i l e , ' SENS IT IV ITY 1 SENS IT IV ITY 2 SENS IT IV ITY 3 SENS IT IV ITY 4 * ) J wr i t e l n ( a s c i i f i 1 e, ' v o l t s / d i v i s i o n v/d v/d v / d ' ) ; wr i t e l n ( a s c i i f i 1 e ) ; w r i t e l n ( a s c i i f i l e , s l : 1 5 : 1 0 , s l o k , s 2 : 15: 1 0 , s 2 o k , s 3 : 15: 1 0 , s 3 o k , s 4 : 1 5 : 1 0 , s 4 o k ) ; w r i t e l n ( a s c i i f i l e ) i w r i t e l n ( a s c i i f i 1 e ) j w r i t e l n ( a s c i i f i 1 e , ' s w e e p s p e e d = ' , s w e e p s p e e d : 9 : 6 , s w o k , ' s e c o n d s / d i v i s i o n * ) ! w r i t e ( a s c i i f i l e , ' t h e d a t a i s f r o m c h a n n e l number ' , c h a n n e l n u m b e r : 3 ) ; w r i t e l n ( a s c i i f i 1 e , ' D i g i t a l e x p a n s i o n f a c t o r ^ ' , e x p a n s i o n f a c t o r : 3 ) f w r i t e l n ( a s c i i f i 1 e , w a v e t y p e ) j wr i t e l n ( a s c i i f i 1 e ) > FOR d a t a i t e m : = l TO 1000 DO BEGIN t m p : = d a t a C d a t a i t e r n ] ; IF a b s ( t m p ) > 3 2 7 5 0 . 0 THEN t m p : = 3 2 7 5 0 . 0 » a b s ( t m p ) / t m p 5 w r i t e ( a s c i i f i l e , r o u n d ( t m p ) : 7) ; IF d a t a i t e m MOD 10 = 0 THEN wr i t e l n ( a s c i I f i 1 e) ; END; w r i t e l n ( a s c i i f i l e ) ! IF a b s ( d i ) > 1 0 THEN w r i t e l n ( a s c i i f i 1 e , ' The d i s p e r s i o n index i s not d e f i n e d ' ) E LSE w r i t e l n ( a s c i i f i 1 e , ' D i s p e r s i o n index ' , d i : 5 : l ) ; w r i t e l n ( a s c i i f i i e ) END; / * c o n v e r t r e c o r d t o a s c i i •/ -p. * * * T O F L O P P Y » * * * W r i t e s ou t t h e new d a t a - f i l e t o t h e -f loppy d i s k -from t h e * * g l o b a l v a r i a b l e s . * * # »•**####***#•*« • • « # # * # # » * » * # » # # » « # • # # • # # # # # • « * * * • * * » * # # » # * # # # # # » # • # # * # • # * • # # # > PROCEDURE t o f l o p p y ; BEGIN { f lop } e m g n u m b e r [ 1 ] : = ' T ' ; emgnumber C2.1 := 'W' ; emgnumberC4H:= '1 * ; c r e a t e a s c i i f i 1ename ; r e s e t ( a s c i i f i l e , a s c i i f i l e n a m e , d e f a u l t n a m e , s i z e ) ; w r i t e l n ! WHILE ( s i z e < > - l ) DO BEGIN w r i t e r EMGNUMBER ' . e m g n u m b e r ) ; w r i t e l n ( ' has a l r e a d y been u s e d ' ) ; i nc rementname; r e s e t ( a s c i i f i 1 e , a s c i i f i I e n a m e , d e f a u l t n a m e , s i z e ) ; END! s i z e := 2 0 ; r e w r i t e ( a s c i i f i 1 e , a s c i i f i 1 e n a m e , d e f a u l t n a m e , s i z e ) ; WHILE s i z e - -1 DO BEGIN w r i t e l n C T h e f l o p p y d i s k i s f u l l o r no t p r e s e n t . ' , c h r (007B) ) ; wri t e l n (' PI a ce a new d a t a d i s k i n t h e d r i v e , t h e n p r e s s <RETUF(N>. ' ) ; r e a d l n ; r e w r i t e ( a s c i i f i l e , a s c i i f i l e n a m e , d e f a u l t n a m e , s i z e ) ; END; C Q n v e r t r e c o r d t o a s c i i ; c l o s e ( a s c i i f i l e ) ; wr i t e l n j w r i t e l n * ' So ' , e m g n u m b e r , ' w i l l be u s e d ' ) ; wr i t e l n ; w r i t e l n C D Y : ' , a s c i i f i 1 e n a m e , ' . E M G has been c r e a t e d ' ) ; END; { f l op } * # * READWARP # * • * Reads t h e - f i l e WARP. DAT t h a t c o n t a i n s t h e r e s u l t o-f t h e » * l a s t w a r p i n g . * * # PROCEDURE readwarp (VAR e r r o r : b o o l e a n ; V A R emgnumber : c10 ;VAR m e s s a g e r c B O ; VAR n s a m p l e s , s t a r t , e v e r y : i n t e g e r ; VAR w a r p : w a r p t y p e ) J VAR warpf i 1 e : t e x t ; s i z e , i , l i n e : i n t e g e r ; -found: b o o l e a n ; s k i p 9 : c 9 ; s k i p 1 0 : c 1 0 ! s k i p 3 3 : c 3 3 ; b u f f e r : cBO; BEGIN r e s e t ( w a r p f i 1 e , w a r p f i 1 e n a m e , d e f a u l t n a m e , s i z e ) ; e r r o r : = s i ze<05 IF NOT e r r o r THEN BEGIN REPEAT r e a d ( w a r p f i 1 e , s k i p 3 3 ) ; f o u n d : = ( s k i p 3 3 [ 3 H = ' A ' ) AND ( sk ip33C4 : i = ' L' ) ; IF no t f o u n d THEN r e a d l n ( w a r p f i l e ) UNTIL f o u n d ! e r r o r : = e a f ( w a r p f i l e ) 5 IF e r r o r THEN w r i t e l n ( ' R E C O R D NOT F O U N D ' , c h r ( 7 ) ) ELSE BEGIN r e a d l n ( w a r p f i 1 e , n s a m p l e s , s k i p 9 , s t a r t , s k i p 9 , e v e r y ) ; r e a d 1 n ( w a r p f i I e , e m g n u m b e r , s k i p 1 0 , b u f f e r ) ; message := 'WARPED TO FOR i : = 12 TO 80 DO m e s s a g e ! ! i ] : = b u f f e r C i - 1 1 ] ; 197. * * * * * * * * * * * * * * * * * * * * * * * * at * * rf u * 3 * XI * * a . * * . V. E * * E a L * * >« a * * k. 0 * o * CP +J fli * H * 0 > * * k_ * n * a C 2 * * 0 * U J * • rf tD * a * -M E * u * U LU * m * 0 c * 3 * £ 3 3 OJ * £ * * m * 4-> * a * * OJ £ cn o * * Ul * •U C +l * k. ai * •rf * Hi r—* * 4- a u * M- a * 1- a k. - i * *4- e * LL m * 3 q * LU OJ 2 ui * a Ul * 3 k. 01 * c * c 01 - r f * o n X u £ * -< o « ' * •u a * a Q U J |)l E * 01 a * a 4> * £ ifl * in a * Ul * in ai >o a o t- * Ol c * » rf 2 e II * +J OJ * L. a . ifl * in tl £ * ai E QJ tfl n + n t * -rf rf -P * X) ifl r-4 C H Ul *~ • 0 * e ui •rf A . i_J 01 OJ * 01 a xi * 3 C + " a rf * k. l. c * c a - L a •rf oi ifl * cn a L U J ro e >4- i-H * 12 * e ^- is a 2 (S a XI * 01 c ui * ai 3 i. U! i- C * U -rf Qj * -— rf « * 2 c m 3 * 0 3 * C II T3 2 Ul II 3 a 0 k. > _, * •• z U I • • '— *4- * a rf IQ Qi -rf w 01 U. H tl UJ a * I- > * +j CD Ul XI r * k. * IT) * rf CC LU z cc 0 V. •rf ns * in 01 O * L a as LU a rf c 2 * -rf C O * 3 U. Li- u a u U J XI * £ •rf o * z LU OJ L. s-» a z LU (fl 01 k. Q z * * * * * * * * t- * * * * * * * * * LU * * * * * * * * * in 01 rf a E L IB 01 in o> a*. c 01 >: •P iB c — E - r f u II • > u V 3 n L. m •rf ai 1! U i > .* a 01 — iH u * . IB o 2 I- o « O a -M ^  a Q in 2 <X m m rf 01 -P V n o a n - r f e i i n * o: a rf U5 a L 1 c > •B a II 1- 2 L . • c a ai T) n n a. o> 2 •rf 01 > 01 a UJ - i -u 4J z r-j o a c <i a a a L. •rf z L J3 IB • • <i •B 2 Ul 2 V. . . IS 01 ^ o a -rf rf m a L. L » a 01 a k. IB c rf OJ 2 <8 a o i—i Ul E o cc ex. •» c ifl o <L <r o a Ul .» rf •> > O IB c -•rf 4J E X rf • 4-1 « H m — H u- V E u •« 01 a-u -rf "* V U rf rf 3 i . c —- rf rf 3 i i« 3 1 — in •rf II LU 2 0 - r f II u • • CC U • r. LU » ui . . •• -rf ZJ !M rf _ l •• _ i a a ifl Z II 1—4 C • LC hi 4-" Ul J—1 • • I (8 i a 4J a u IB a 3 -4 3 a Ul a AC XI X I UJ c o u n t : = s t a r t + l a g * e v e r y + l > FOR i : = lag+1 TO s top-1 DD BEGIN { l i n e a r i n t e r p o l a t i o n o-f warp - func t i on ) b a s e : = (warpt i 3 - D # e v e r y + s t a r t > FOR j : = l TO e v e r y DO BEGIN w a r p 2 C c o u n t ] : = b a s e + ( w a r p ! i +13-warpCi 3 ) * ( j - 1 ) ! c o u n t : = s u c c ( c o u n t ) i END ! { j ) END ;< i ) warp2Ccount 3 :=warpCstop 3 * e v e r y + s t a r t ; FOR i : = l TO 1000 DO BEGIN IF ( w a r p 2 C i 3 < l ) OR (warp2Ci3>1000) THEN d a t a 2 C i 3:=0 ELSE d a t a 2 C i 3 : = d a t a C w a r p 2 C i 3 3} END; d a t a : = d a t a 2 j END} {warp) trr\ * # * MAIN BLOCK # * * * T h i s p rog ram r e a d s t h e w a r p f i l e u s i n g READWARP and t h e n * * t h e emgdata f i l e u s i n g READFLOPPY. The w a r p i n g f u n c t i o n * * i s a p p l i e d by WEFT and t h e r e s u l t w r i t t e n o u t by * * TOFLOPPY. The r e s u l t i n g f i l e can be g r a p h e d o r p l o t t e d * * by t h e p rog ram EMG. * * * BEGIN -Cmain> w r i t e l n C EXECUTION B E G I N S ' ) ; r e a d w a r p ( e r r o r , e m g n u m b e r , m e s s a g e , n s a m p l e s , s t a r t , e v e r y , w a r p ) ; IF NOT e r r o r THEN BEGIN w r i t e l n ( ' W a r p f i 1 e r e a d o k ' , n s a m p l e s , s t a r t , e v e r y ) ; r e a d f l o p p y ( e r r o r , d a t a ) ; w r i t e l n ( ' F I o p p y r e a d o k ' ) ; p a t i e n t t y p e : = m e s s a g e ; IF NOT e r r o r THEN BEGIN w e f t ( e r r o r , n s a m p l e s , s t a r t , e v e r y , w a r p , d a t a ) ; IF NOT e r r o r THEN t o f l o p p y ; END; END; END. APPENDIX 5) DESIGN OF RESEARCH F A C I L I T I E S I n t r o d u c t i o n New r e s e a r c h f a c i l i t i e s f o r t h e V a n c o u v e r G e n e r a l H o s p i t a l ' s N e u r o m u s c u l a r D i s e a s e s U n i t were d e s i g n e d , i m p l e m e n t e d , and e v a l u a t e d . The N e u r o m u s c u l a r D i s e a s e s U n i t (EMG L a b o r a t o r y ) i s a d i a g n o s t i c l a b o r a t o r y f o r t h e t h e t e s t i n g o f p a t i e n t s , t h e t r a i n i n g o f n e u r o l o g y r e s i d e n t s , and r e s e a r c h i n Evoked P o t e n t i a l s , N erve A c t i o n P o t e n t i a l s , and E l e c t r o m y o g r a p h y . R e s e a r c h F u n c t i o n s R e q u i r e d f o r t h e N e u r o m u s c u l a r D i s e a s e s U n i t - S t o r e waveforms from t h e two DISA D i g i t a l S ystems w i t h r e l e v a n t p a t i e n t d a t a . -Graph the s t o r e d waves on a CRT, and p r o d u c e h i g h - q u a l i t y h a r d c o p y . -Expand s e c t i o n s o f a s t o r e d wave. - S u b t r a c t and a v e r a g e waves. -I n d e x , n u m e r i c a l l y and a l p h a b e t i c a l l y , t h e s t o r e d waves. - C a l c u l a t e v e r y i n v o l v e d f o r m u l a s q u i c k l y . - P r e v e n t a c c i d e n t a l l o s s o f i n f o r m a t i o n . -Word p r o c e s s i n g . - P r i n t l a r g e p r o g ram and d a t a f i l e s . - E f f i c i e n t programming manpower u t i l i z a t i o n . -Accommodate p o s s i b l e f u t u r e r e q u i r e m e n t s . 202. Assessment of Requirements Computer and Other Hardware Requirements -Minimum 16 b i t word l e n g t h . - F l o a t i n g p o i n t a r i t h i m e t i c h a r d w a r e . - S i x Megabytes o f o n - l i n e s y s t e m s t o r a g e . - F i v e Megabytes per month o f a r c h i v a l s t o r a g e . - F a s t p a r a l l e l I/O and m u l t i l i n e s e r i a l I/O. - C o n s o l e t e r m i n a l s - G r a p h i c CRT and P l o t t e r . -Two p r i n t e r s Q u i c k p r i n t e r . L e t t e r q u a l i t y p r i n t e r . - f l e x i b i l i t y t o expand or a d a p t . The computer s y s t e m was t o be used f o r r e s e a r c h . I t was n o t to form an i n t e g r a l p a r t o f t h e p a t i e n t - c a r e p r o v i d e d by t h e N e u r o m u s c u l a r D i s e a s e s U n i t . T h i s meant t h a t t h e p r i m a r y e m p h a s i s i n s e l e c t i o n o f t h e s y s t e m was t o be on t h e s e r v i c e s o f f e r e d , r a t h e r t h a n on r e l i a b i l i t y t h r o u g h r e d u n d a n c y and e x p e n s i v e " i n s t a n t " s e r v i c e c o n t r a c t s . The s y s t e m was t o be m a i n t a i n e d by t h e U n i t ' s e n g i n e e r . A week's down-time would d e l a y r e s e a r c h , b u t would n o t p a r a l y z e t h e whole N e u r o m u s c u l a r D i s e a s e s U n i t . 203. Computer Software Requirements -A g e n e r a l p u r p o s e o p e r a t i n g s y s t e m . - S t r u c t u r e d h i g h l e v e l l a n g u a g e c o m p i l e r s . E n a b l i n g m a i n t a i n a b l e code t o be e f f i c i e n t l y w r i t t e n . - G e n e r a l p u r p o s e s o f t w a r e . To a l l o w t h e n o n t e c h n i c a l l a b o r a t o r y p e r s o n n e l t o work w i t h waveforms. -A r e l i a b l e method o f b a c k i n g up f i l e s . - D e v i c e d r i v e r s and i n t e r f a c e s . -Word p r o c e s s i n g . - S o f t w a r e t o o l s . To s u p p o r t t h e w r i t i n g o f s p e c i a l p u r p o s e c o d e . - D o c u m e n t a t i o n s t a n d a r d s . F o r e f f i c i e n t m a i n t e n a n c e o f c o d e w r i t t e n . B u i l d i n g Services - I n d i v i d u a l t e m p e r a t u r e c o n t r o l s f o r each room. -The l a b s needed an e l e c t r i c a l l y and a c o u s t i c a l l y q u i e t e n v i r o m e n t . . A c o u s t i c n o i s e comes from i n t e r i o r e c h o e s or i s t r a n s m i t t e d f r o m o u t s i d e t h e l a b s . - F a s t p a r a l l e l I/O between t h e computer and e a c h l a b . 1 ft WAITING RECEPTION OFFICE LAB 1 8' OFFICE OFFICE 1 COMPUTER LAB 2 ro o 205. -Access to t e r m i n a l s , p r i n t e r s and p l o t t e r s i n each room. - F l e x i b l e communications w i r i n g system . S p e c i f i c access needs c o u l d change every s i x months. - E x t e r n a l communications would be needed i n the f u t u r e . Design Computer and Other Hardware S e l e c t e d -LSI-11/23 CPU, with memory management and f l o a t i n g p o i n t hardware. The PDP-11 f a m i l y was chosen, d e s p i t e i t s 16 b i t address l i m i t a t i o n , because a l l of the l a b ' s e x i s t i n g software was w r i t t e n f o r a PDP-11/20, and because of the abundance of o p t i o n a l boards a v a i l a b l e f o r the Q-bus. -MSV11LK board provided 256 k i l o b y t e s of p a r i t y memory. -Data Systems Design 880-8 c o n t a i n i n g a 7.8 Megabyte Winchester d i s k and a d o u b l e - d e n s i t y double-sided 8" f l o p p y d i s k d r i v e . The DSD880-8 was chosen because of i t s p r i c e advantage over an RL02-RX02 combination. -DRVll 16 b i t p a r a l l e l I/O board l i n k e d the computer system to the DISA 1500 EMG u n i t . - I B V l l IEEE 488 bus c o n t r o l l e r to connect the DISA Neuromatic 2000 EMG system to the computer system. -Two D L V l l - J s provided e i g h t s e r i a l RS232 l i n e s . -Two CIT101 t e r m i n a l s , one with a Selenar 201 g r a p h i c s c a r d . DISA 2000 CIT 101 HP 7470A Diablo 630 DISA 1500 PDP-11/23 CPU DSD880-8 Solonar Graphics CIT 101 207. - D i a b l o 630 d a i s y - w h e e l p r i n t e r . - Epson MX100 d o t - m a t r i x p r i n t e r . -HP 7470 two pen p l o t t e r . Software Implemented The s o f t w a r e used i n the N e u r o m u s c u l a r D i s e a s e s U n i t c o n s i s t e d o f t h r e e b a s i c g r o u p s : System S o f t w a r e -RT11FB o p e r a t i n g s y s t e m w i t h m u l t i p l e t e r m i n a l and s y s t e m j o b s u p p o r t . - F o r t r a n , P a s c a l and C c o m p i l e r s -A backup u t i l i t y was w r i t t e n . To i n c r e m e n t a l l y d u p l i c a t e t h e c o n t e n t s o f t h e W i n c h e s t e r d i s k and o f t h e d a t a f l o p p y d i s k s . . Done w e e k l y and augmented by b i a n n u a l t o t a l f i l e s a v e - P a s c a l t o H e w l e t t - P a c k a r d p l o t t e r i n t e r f a c e r o u t i n e s . W r i t t e n t o use t h e minimum o f memory w h i l e g e n e r a t i n g and q u e u e i n g th e HP-GL i n s t r u c t i o n s f o r the p l o t t e r . -DISA I n t e r p a c k l i b r a r y . Communicated w i t h t h e DISA 1500. . M o d i f i e d t o p r o d u c e s m a l l e r o v e r l a y s o f t h e a s s e m b l e r c o d e . 208. - C o n s o l e c o n t r o l u t i l i t y . W r i t t e n t o move t h e c o n t r o l o f t h e c o n s o l e t e r m i n a l between f o u r d i f f e r e n t u s e r s . -QUEUE . Run as a s y s t e m j o b t o a l l o w f i l e s t o be queued t o t h e p r i n t e r . U ser S o f t w a r e The u s e r s o f t w a r e t h a t was d e s i g n e d t o be f a i l - s a f e and u s e r - f r i e n d l y . The u s e r s o f t w a r e c o n s i s t e d o f t h r e e m a j o r s y s t e m s and some m i s c e l l a n e o u s p r o g r a m s . - C o n t r o l f i l e s were w r i t t e n to s u p p o r t t h e QTEXT word p r o c e s s i n g p rogram. QTEXT a l l o w e d t h e u s e r t o c r e a t e , e d i t and p r i n t l e t t e r - q u a l i t y d o cuments. -The waveform m a n i p u l a t i o n s y s t e m c o n t a i n e d s e v e n p r o g r a m s . The programs EMG and OVER a l l o w e d t h e u s e r t o i n d e x and s t o r e , p l o t , and m a n i p u l a t e p a t i e n t waveforms f r o m t h e DISA 1500. D u p l i c a t e c o p i e s o f t h e waves and a s s o c i a t e d p a t i e n t d a t a were a r c h i v e d s e p a r a t e l y . The waveforms c o u l d be s u b t r a c t e d , a v e r a g e d , o r expanded, and d i s p l a y e d on t h e g r a p h i c s s c r e e n or p l o t t e d on p a p e r . The programs FILTER and F I L T 2 d i g i t a l l y f i l t e r e d the waveforms, w h i l e WARP and WEFT p r o v i d e d a dynamic t i m e w a r p i n g c a p a b i l i t y . T h e s e programs a r e documented i n t h e a p p e n d i c e s . -The E n t r a p s y s t e m composed o f ENTRAP, ENREAD, and ENPLOT was w r i t t e n as a g r a p h i c s b a s e d a i d f o r t h e d i a g n o s i s o f e n t r a p m e n t n e u r o p a t h i e s . -The m i s c e l l a n e o u s user software that was w r i t t e n i n c l u d e d DRAFT; a d r a f t i n g program f o r the HP p l o t t e r , and DRAW; a program that produced very quick hardcopy graphs of the waveforms from the DISA 1500. RANDOM was a very s m a l l , very f a s t (<40 microseconds) i n t e r r u p t d r i v e n program t h a t produced randomly timed t r i g g e r i n g p u l s e s f o r the DISA 1500 S t i m u l a t o r . Research Software The r e s e a r c h programs were for the use of the engineer rather than l a b o r a t o r y p e r s o n n e l , and t h e r e f o r e u s e r - f r i e n d l y f e a t u r e s were s a c r i f i c e d f o r f l e x i b i l i t y . A l s o i n c l u d e d i n t h i s category were the t e s t programs t h a t were w r i t t e n to t e s t the o p e r a t i o n and r e l i a b i l i t y of the hardware and to a s s i s t i n i t s r e p a i r . The r e s e a r c h programs evolved through many v e r s i o n s . When a r e s e a r c h program proved u s e f u l to the work being done i n the l a b o r a t o r y , i t was r e w r i t t e n as a user program and f u l l y documented. B u i l d i n g S e r v i c e s Designed Communications Wiring - S t a r - t o p o l o g y s e r i a l RS232 communication . Centered at a l a r g e wall-mounted patch panel i n the computer room. . Twelve i n d i v i d u a l l y s h i e l d e d t w i s t e d - p a i r s ran i n conduit from the patch panel to three D25 sockets mounted on a w a l l panel i n every room. . Allowed f a s t and f l e x i b l e w i r i n g changes. - P a r a l l e l c o m m u n i c a t i o n . F o r t y s h i e l d e d t w i s t e d - p a i r s t o e a c h l a b o r a t o r y . T e r m i n a t e d a t i n - w a l l 2' t e l e p h o n e b o x e s . - T e l e p h o n e c o n n e c t i o n s . In e a c h l a b and o f f i c e by d e s k s . . In computer room t o be us e d w i t h a modem. - E x t r a p a i r o f w i r e s t o e a c h p e r i p h e r a l . To a l l o w a c e n t r a l s e c u r i t y a l a r m s y s t e m t o be b u i l t i n t h e f u t u r e . G r o u n d i n g -One common room g r o u n d f o r ea c h l a b . F o r p a t i e n t s a f e t y . - I s o l a t e d g r o u n d f o r t h e computer . To p r e v e n t g r o u n d c u r r e n t p r o b l e m s . - S t a r - c o n n e c t i o n s o f a l l g r o u n d w i r e s and s h i e l d i n g . To p r e v e n t g r o u n d l o o p s . L i g h t i n g -The two l a b s and t h e e n g i n e e r ' s o f f i c e were p r o v i d e d w i t h two s e p a r a t e l y s w i t c h e d l i g h t i n g c i r c u i t s . . S t a n d a r d f l u o r e s c e n t l i g h t f i x t u r e s were u s e d t o p r o d u c e b r i g h t and u n i f o r m l i g h t i n g . . D i m m e r - c o n t r o l e d i n c a n d e s c e n t t r a c k l i g h t s were i n s t a l l e d t o a l l o w s o f t and n o n u n i f o r m l i g h t i n g . . Low l e v e l i n c a n d e s c e n t l i g h t i n g i m p r oved t h e v i s i b i l i t y o f c a t h o d e r a y t u b e s c r e e n s . 2 1 1 . 2.6) E v a l u a t i o n and Di s c u s s i o n Computer and Other Equipment The computer system f u l f i l l s i t s f u n c t i o n adequately. Had a l l of the money f o r hardware been a v a i l a b l e sooner, a 30 Megabyte Winchester should have been purchased i n s t e a d of the 7.8 Megabyte one. For an e x t r a two thousand d o l l a r s four times the d i s k space would have been a v a i l a b l e . T h i s e x t r a d i s k space w i l l soon be needed. Two f u r t h e r items should be purchased. -The DSD 880-30 30 Megabyte Winchester d i s k and streaming 1 / 4 " tape d r i v e combination would g r e a t l y expand the storage c a p a c i t y and s i m p l i f y backup procedures. Having a second d i s k d r i v e would improve the system r e l i a b i l i t y by a l l o w i n g one d i s k to be removed f o r r e p a i r without p a r a l y s i n g the e n t i r e system. -A second g r a p h i c s t e r m i n a l should be aquired to be used by the r e s e a r c h engineer. This would allow the engineer to work more e f f i c i e n t l y . Software The QTEXT word-processing system i s u n r e l i a b l e . I t needs to be f i x e d or r e p l a c e d . The s i n g l e user o p e r a t i n g R T l l system causes problems as o f t e n s e v e r a l users d e s i r e concurrent access to the computer. 2 1 2 . There i s 256 k i l o b y t e s of memory i n the computer, but R T l l allows easy access to only one f i f t h of i t . The o p e r a t i n g system should be changed to UNIX. T h i s would allow m u l t i p l e users to share the resources and would ease the memory management b o t t l e n e c k . Minor m o d i f i c a t i o n s w i l l have to be made to a l l of the programs to r e f l e c t the change i n f i l e systems. I n t e r f a c e s should be w r i t t e n so that the user programs can be used with the Neuromatic 2000. I t would be u s e f u l to have the Michegan Communications P r o t o c o l implemented to connect the EMG system to UBC NET. B u i l d i n g S e r v i c e s The e x t r a ten f e e t of i n - w a l l wire proved too much f o r the new DISA p a r a l l e l Interpack. A hole was punched through the w a l l between the computer room and Lab #1 and the wires run d i r e c t l y . T h i s r e s u l t e d i n a l o s s of long term f l e x i b i l i t y and r e l i a b i l i t y , but solved the short term problem. -The s e r i a l l i n e s have worked w e l l . -There has been no grounding problems. -The l i g h t i n g o p tions g r e a t l y improved the comfort of the people o p e r a t i n g the Laboratory's equipment. 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0096283/manifest

Comment

Related Items