170 likes | 300 Views
Optical simulation system for brain waves detection & measurements. Performed by: Yevgeny Safovich Pilnick Nadav. Mid-term presentation. Supervised by: Hen Broodney. Problem Definition. Measure eye vision quality objectively
E N D
Optical simulation system for brain waves detection & measurements Performed by: Yevgeny Safovich Pilnick Nadav Mid-term presentation Supervised by: Hen Broodney
Problem Definition • Measure eye vision quality objectively • The vision should be measured (almost) without cooperation of the person being examined
Solution • Use PC to transmit series of images of different colors at certain frequencies in front of the patient (as a stimulation) • Use Electronic device to measure brain waves caused by change of vision • Conclude regarding to the patient’s vision abilities
Requirements • Images • 3 pairs of colors: • Blue, Yellow • Green, Red • Black, White • Each pair has its own “blank” color: the average of the colors in the pair • Steps frequency: 0.5Hz – 10Hz, resolution 1Hz • dx = The delta between the Monitor output and the electrical pulse output. 0.5ms < dx < 1.5ms
End Begin Definitions • Screen Refresh Rate • Vertical Blank Interval (VBI) • DirectDraw • Primary Surface • Front Buffer • Back Buffers • Flip • Performance counter
Solution Algorithm Operator Computer Video Card Brain Waves meter Monitor Human * The red interfaces should be synchronized
Timing Operator Computer Video Card Monitor Human Brain Waves meter t t1a t1b t2 t3 t4 t5 • 0.5ms < |t5 – t3| < 1.5ms • |t4 – t3| - We suppose this time does not matter and is taken care of by the “Brain Waves meter” • |t3 – t2| - We suppose this interval is negligible • |t2 – t1b| - The major problem of the project, discussed below • |t5 – t1a| - A problem discussed below
Timing: focus Time • Ta = VBI begin • Tb = Flip • Tc = Flip Critical time • Td = Flip End • Te =t1a = Out pulse sent • Tf = t5 = Out pulse received (~ t1d) • Tg = t2 = VBI end Ta Tc Td Te Tf Tg Tb Screen Front Buffer
Feasibility Testing • Testing Screen Sync.: • The goal is to ensure that the new image is shown at the screen ‘at the moment’ the Pulse is sent to the parallel port. • Testing Pulse delay: • The goal is to ensure that the time between sending the pulse and receiving (Tf – Te), is negligible Roundtrip delay testing
Synchronization Solution • Build two Surfaces in DirectDraw • Front (Primary Surface) • Back (Attached Surface) • Use windows priority mechanism to give maximum priority to the process (Real-Time) and worker thread (Critical) • Use DirectDraw to determine VBI begin(t1b) • Use DirectDraw to Flip the Surfaces • Use Parallel port in order to send output Pulse • Use performance counter to ensure we did not miss the Flip critical time (t1f)
Parallel port Interface Video Interface Parallel port Wrapper (DLPortIO) Video Interface Wrapper (DirectDraw) Run-time Module Database Module Configuration module Main application Module Project Blocks Diagram
Statistics • The next run assumed pulse delay is 5 ms.The application collects maximum and minimum times • Implicitly neglected the time it takes for the pulse to be received (Tf-Te). Experiments showed Maximum time of ~0.04 ms RoundTrip. • Conclusions: • We did not miss a single sync. • Most Extreme results show 32.7 microsecond difference (~5.05 ms , ~5.08 ms). Way below requirements
Application screens • Main screen
Application screens • Menu options • Colors pairs • Element type • Page layout
Application screens • Page configuration
Application screens • Options
Appendix 1DirectDraw • Interface IDirectDraw7 • ::WaitForVerticalBlank(…) • Interface IDirectDrawSurface7 • ::Flip(…)