Stimulus presentation using Matlab and Visage

Similar documents
Lecture 14: Computer Peripherals

Introduction to Computer Graphics

Reading. 1. Displays and framebuffers. History. Modern graphics systems. Required

VGA Port. Chapter 5. Pin 5 Pin 10. Pin 1. Pin 6. Pin 11. Pin 15. DB15 VGA Connector (front view) DB15 Connector. Red (R12) Green (T12) Blue (R11)

EECS150 - Digital Design Lecture 12 - Video Interfacing. Recap and Outline

SPATIAL LIGHT MODULATORS

2.4.1 Graphics. Graphics Principles: Example Screen Format IMAGE REPRESNTATION

Reading. Displays and framebuffers. Modern graphics systems. History. Required. Angel, section 1.2, chapter 2 through 2.5. Related

Spatial Light Modulators XY Series

Scanning For Photonics Applications

Comp 410/510. Computer Graphics Spring Introduction to Graphics Systems

Design of VGA Controller using VHDL for LCD Display using FPGA

Spatial Light Modulators

Computer Graphics: Overview of Graphics Systems

4. ANALOG TV SIGNALS MEASUREMENT

Part 1: Introduction to computer graphics 1. Describe Each of the following: a. Computer Graphics. b. Computer Graphics API. c. CG s can be used in

Lab Determining the Screen Resolution of a Computer

Rec. ITU-R BT RECOMMENDATION ITU-R BT PARAMETER VALUES FOR THE HDTV STANDARDS FOR PRODUCTION AND INTERNATIONAL PROGRAMME EXCHANGE

Chapter 3 Fundamental Concepts in Video. 3.1 Types of Video Signals 3.2 Analog Video 3.3 Digital Video

Ensemble QLAB. Stand-Alone, 1-4 Axes Piezo Motion Controller. Control 1 to 4 axes of piezo nanopositioning stages in open- or closed-loop operation

Oculomatic Pro. Setup and User Guide. 4/19/ rev

VGA Configuration Algorithm using VHDL

Communication Theory and Engineering

Types of CRT Display Devices. DVST-Direct View Storage Tube

V9A01 Solution Specification V0.1

VP2780-4K. Best for CAD/CAM, photography, architecture and video editing.

Part 1: Introduction to Computer Graphics

CATHODE RAY OSCILLOSCOPE. Basic block diagrams Principle of operation Measurement of voltage, current and frequency

1. Introduction. 1.1 Graphics Areas. Modeling: building specification of shape and appearance properties that can be stored in computer

3. Displays and framebuffers

Objectives: Topics covered: Basic terminology Important Definitions Display Processor Raster and Vector Graphics Coordinate Systems Graphics Standards

Time-stamping computer events to report.1-msec accuracy of events in the Micro Experimental Laboratory

An Alternative Architecture for High Performance Display R. W. Corrigan, B. R. Lang, D.A. LeHoty, P.A. Alioshin Silicon Light Machines, Sunnyvale, CA

DT3162. Ideal Applications Machine Vision Medical Imaging/Diagnostics Scientific Imaging

CS 4451A: Computer Graphics. Why Computer Graphics?

Spatial Light Modulators

SigPlay User s Guide

Computer Graphics. Introduction

Statement SmartLCT User s Manual Welcome to use the product from Xi an NovaStar Tech Co., Ltd. (hereinafter referred to as NovaStar ). It is our great

Sapera LT 8.0 Acquisition Parameters Reference Manual

Displays. History. Cathode ray tubes (CRTs) Modern graphics systems. CSE 457, Autumn 2003 Graphics. » Whirlwind Computer - MIT, 1950

Computer Graphics. Raster Scan Display System, Rasterization, Refresh Rate, Video Basics and Scan Conversion

What is sync? Why is sync important? How can sync signals be compromised within an A/V system?... 3

Operating Instructions

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Introductory Digital Systems Laboratory

Ch. 1: Audio/Image/Video Fundamentals Multimedia Systems. School of Electrical Engineering and Computer Science Oregon State University

How to Match the Color Brightness of Automotive TFT-LCD Panels

Brief Description of Circuit Functions. The brief ckt. description of V20 107E5 17 Monitor

Spatial Light Modulators

Essentials of the AV Industry Welcome Introduction How to Take This Course Quizzes, Section Tests, and Course Completion A Digital and Analog World

This guide gives a brief description of the ims4 functions, how to use this GUI and concludes with a number of examples.

VGA 8-bit VGA Controller

An FPGA Based Solution for Testing Legacy Video Displays

Video Graphics Array (VGA)

DCI Requirements Image - Dynamics

Building Video and Audio Test Systems. NI Technical Symposium 2008

Reading. Display Devices. Light Gathering. The human retina

What is the history and background of the auto cal feature?

ISOMET. Compensation look-up-table (LUT) and Scan Uniformity

AmbDec User Manual. Fons Adriaensen

AE16 DIGITAL AUDIO WORKSTATIONS

PRELIMINARY INFORMATION. Professional Signal Generation and Monitoring Options for RIFEforLIFE Research Equipment

980 HDMI 2.0 Video Generator Module. Application Note UHD Alliance Compliance Testing with the UHDA Test Pattern Pack

2.2. VIDEO DISPLAY DEVICES

LCD and Plasma display technologies are promising solutions for large-format

Agilent 5345A Universal Counter, 500 MHz

4 x 4 VGA Matrix Switch

ERP recording with stimulus delivery and experimental control (SDEC) software

Camera Interface Guide

ECE 4220 Real Time Embedded Systems Final Project Spectrum Analyzer

Design and Implementation of SOC VGA Controller Using Spartan-3E FPGA

An Efficient SOC approach to Design CRT controller on CPLD s

THE CAPABILITY to display a large number of gray

ZONE PLATE SIGNALS 525 Lines Standard M/NTSC

Hitachi Europe Ltd. ISSUE : app084/1.0 APPLICATION NOTE DATE : 28/04/99

Design and Implementation of an AHB VGA Peripheral

Major Differences Between the DT9847 Series Modules

CHARACTERIZATION OF END-TO-END DELAYS IN HEAD-MOUNTED DISPLAY SYSTEMS

TV Synchronism Generation with PIC Microcontroller

CONTENTS. Section 1 Document Descriptions Purpose of this Document... 2

2G Video Wall Guide Just Add Power HD over IP Page1 2G VIDEO WALL GUIDE. Revised

MEMS Mirror: A8L AU-TINY48.4

specification MSE series MSE and MSE+ colorimeter

Chrontel CH7015 SDTV / HDTV Encoder

Please feel free to download the Demo application software from analogarts.com to help you follow this seminar.

From Synchronous to Asynchronous Design

PROTOTYPING AN AMBIENT LIGHT SYSTEM - A CASE STUDY

MX215. Your advantages. 2MP Medical-Display

Spatial-frequency masking with briefly pulsed patterns

VID_OVERLAY. Digital Video Overlay Module Rev Key Design Features. Block Diagram. Applications. Pin-out Description

Design of VGA and Implementing On FPGA

Lab 3: VGA Bouncing Ball I

EBU Digital AV Sync and Operational Test Pattern

Electrical and Electronic Laboratory Faculty of Engineering Chulalongkorn University. Cathode-Ray Oscilloscope (CRO)

Section 4. Display Connector

User manual mermaid ventura 150/170/181/190 TFT Video

CS2401-COMPUTER GRAPHICS QUESTION BANK

4 MHz Lock-In Amplifier

S I N E V I B E S FRACTION AUDIO SLICING WORKSTATION

VectorVGA Tempest User Manual

Transcription:

Stimulus presentation using Matlab and Visage

Cambridge Research Systems Visual Stimulus Generator ViSaGe Programmable hardware and software system to present calibrated stimuli using a PC running Windows Accurate frame-based timing e.g. at 130Hz framerate: present stimuli for exactly 7 ms. Enhanced dynamic range 14 bit DAC: 2 14 = 64 times more luminance levels compared to typical 8-bit VGA systems Optimal use of available dynamic range through LUT cycling Gamma correction automatically applied CRS toolbox for Matlab

How does it work? Host PC running Windows controls the external VSG hardware unit (via Matlab or via C/python using win32 API) VSG controls the CRT stimulus display VSG periodically sends a stimulus image to the CRT = refresh cycle One single period of the refresh cycle = frame Rate at which the image is updated = framerate

Refresh cycle Start pixel Horizontal scan line Horizontal retrace Vertical retrace Electron beam High speed exposure snapshot: the electron beam at work in the middle of the screen Horizontal scanning frequency of 96 khz at a resolution of 1280 1024 results in a frame rate of 96,000 / (1024 1.05) 89 Hz time of vertical retrace

Video memory The image sent to the CRT on each refresh is taken from the video memory of the VSG Video memory is subdivided in to video pages

Stimulus representation Each stimulus is represented as a matrix of luminance values Example: the fixation cross Luminance of 1 pixel Video page M = 12 8 12 8 12 8 12 8 12 8 12 8 12 8 1 12 8 12 8 12 8 1 1 1 12 8 812 bit: from 12 black 1 12 to white 12 in 2^8 8 = 256 8 steps 8 8

Drawing stimuli onto the video pages crsclearpage(index, luminance) Clear page and set background luminance crssetdrawpage(index) Choose the video page you want to draw onto crsdrawmatrixpalettised(m) Copy matrix to the video page

global CRS; vsginit; Video page crsclearpage(1,128); crssetdrawpage(1); M = ones(30,30)*128; M(1:30,14:16) = 1; M(14:16,1:30) = 1; Video page crsdrawmatrixpalettised(m);

Predefined drawing functions crsdrawgabor and crsdrawgrating crsdrawline, crsdrawoval, crsdrawstring Other useful functions crspixelstodegrees crspixelstomm crsgetframerate

Help using crs functions crs + [TAB] on the command line for complete overview help command_name

Displaying stimuli Directly using Matlab via crssetdisplaypage: crssetdisplaypage(1); pause(.5) crsclearpage(1,128); Use of this method should be avoided in a multi-tasking OS like windows: many background processes use the CPU This leads to scheduling jitter and dropped frames Inaccurate timing Same problem when using PsychToolbox in Windows

Page cycling Provides accurate timing First, write all your stimuli to the video pages using previously described commands Second, define a page cycle Specify a page number vector denoting sequence of the video page numbers you want to display successively Specify a page frame vector, indicating the number of frames each page has to be presented, indices correspond to indices of the page number vector

Draw stimuli on the video pages 1

Draw stimuli on the video pages 1 2

Draw stimuli on the video pages 1 2 3

Draw stimuli on the video pages 1 2 3 4

Draw stimuli on the video pages 1 2 3 4 5 Press left or right

Define page number vector for 2AFC experiment 1 2 3 4 5 Press left or right Page number vector 1 2 1 3 Present a blank screen Fixation cross Blank again Stimulus 1 1 ISI 4 Stimulus 2 1 Blank 5 Response screen

Define page frame vector 1 2 3 4 5 Press left or right Page 3 will be presented during 2 frames. At 130Hz, presentation time equals 15.4ms Page number vector 1 2 1 3 1 4 1 5 Page frame vector 130 65 130 2 130 2 130 260

Start cycling crspagecyclingsetup(page_number_vector,, page_frame_vector, ) Creates the page cycle, provide page number and frame vectors, along with some additional parameters crssetcommand(crs.cyclepageenable) Executes the cycle At this point, control is transferred to the VSG unit which handles the execution of the cycle stimulus presentation independent of windows accurate timing

Registering subjects responses Accurate RT measurement (1ms precision) using Cedrus RB-530 response box Some useful commands crsresettimer Reset the RT timer crsresponseboxcheck Read from the response box

crsresettimer; [change,state,counter,thestatus] = crsresponseboxcheck; while thestatus==crs.respempty end [change,state,counter,thestatus] = crsresponseboxcheck; ReactionTime = counter/1000000; if state(1)==crs.respdown; end Again, this method leads to inaccurate results in Windows Solution: low-level RTS programming

Real Time Sequencer (RTS) Core of the Visage system Developed to bypass timing issues on multitasking operating systems Scripting engine able to run sequences of operations (i.e., streams ) that are video-frame synchronous Page cycling commands in CRS toolbox for Matlab: highlevel front-end to create, compile and execute an RTS stream that cycles through a series of video pages Reaction time measurement: manual RTS programming is required

How to program the RTS to measure reaction times You can do this easily from within your Matlab experiment code CRS toolbox for Matlab: crsrts-commands First, write all your stimuli to the video pages using previously described commands Second, create and compile and RTS stream (replacing the previous Page Cycling commands) Can be done from within your Matlab experiment code Start the stream

Prepare the draw pages: pg1 = int32(1); pg2 = int32(2); pg3 = int32(3); %---DRAW PAGE 1 : BLANK--- crsclearpage(pg1,127); crssetdrawpage(pg1); %---DRAW PAGE 2 : FIXATION CROSS--- crsclearpage(pg2,127); crssetdrawpage(pg2); M = ones(30,30)*127; M(1:30,14:16) = 256; M(14:16,1:30) = 256; crsdrawmatrixpalettised(m); %---DRAW PAGE 3 : STIMULUS--- crsclearpage(pg3,127); crssetdrawpage(pg3); M = stimulus_matrix(:,:,i); crsdrawmatrixpalettised(m);

RTS_SCRIPT = crsrtscreatestream(0);

RTS_SCRIPT = crsrtscreatestream(0); crsrtsaddstring(rts_script, ' PROGRAM(CyclePages);');

RTS_SCRIPT = crsrtscreatestream(0); crsrtsaddstring(rts_script, ' PROGRAM(CyclePages);'); Predefine variables in the local RTS environment: crsrtsaddstring(rts_script, ' EXTERNAL long pg1 = 0;'); crsrtsaddstring(rts_script, ' EXTERNAL long pg2 = 0;'); crsrtsaddstring(rts_script, ' EXTERNAL long pg3 = 0;'); crsrtsaddstring(rts_script, ' EXTERNAL long prestime1 = 0;'); crsrtsaddstring(rts_script, ' EXTERNAL long prestime2 = 0;'); crsrtsaddstring(rts_script, ' EXTERNAL long prestime3 = 0;'); crsrtsaddstring(rts_script, ' EXTERNAL long resp = 255;'); crsrtsaddstring(rts_script, ' EXTERNAL long ready = 0;'); crsrtsaddstring(rts_script, ' EXTERNAL long frcount = 0;'); crsrtsaddstring(rts_script, ' EXTERNAL long RT = 0;');

Present page 1, presentation time = prestime1(in frames): ' SET_VIDEO_WINDOW(pg1,0,0);' ' FOR frcount = 0 TO prestime1 DO' ' BEGIN' ' SUSPEND(SUS_FRAMECOUNT,1);' ' END;'

Present page 1, presentation time = prestime1(in frames): ' SET_VIDEO_WINDOW(pg1,0,0);' ' FOR frcount = 0 TO prestime1 DO' ' BEGIN' ' SUSPEND(SUS_FRAMECOUNT,1);' ' END;' Present page 2, presentation time = prestime2(in frames): ' SET_VIDEO_WINDOW(pg2,0,0);' ' FOR frcount = 0 TO prestime2 DO' ' BEGIN' ' SUSPEND(SUS_FRAMECOUNT,1);' ' END;'

Present page 3 and measure RT: ' SET_VIDEO_WINDOW(pg3,0,0); ' ' FOR frcount = 0 TO prestime3 DO ' ' BEGIN ' ' resp = GET_RESOURCE_VALUE(RT_DIGITAL_INPUTS, 0);' ' ADD(RT, 1); ' ' IF (resp<>255) THEN ' ' ready = 1; ' ' SUSPEND(SUS_FRAMECOUNT,1); ' ' END; ' ' ready = 1;

Present page 3 and measure RT: ' SET_VIDEO_WINDOW(pg3,0,0); ' ' FOR frcount = 0 TO prestime3 DO ' ' BEGIN ' ' resp = GET_RESOURCE_VALUE(RT_DIGITAL_INPUTS, 0);' ' ADD(RT, 1); ' ' IF (resp<>255) THEN ' ' ready = 1; ' ' SUSPEND(SUS_FRAMECOUNT,1); ' ' END; ' ' ready = 1; Compile the stream: crsrtscompilestream(rts_script, 0);

Before executing the stream, we need fill up the predefined variables: crsrtssetstreamvariable('cyclepages', 'prestime1', nr_frames_1, CRS.SS_IMMEDIATE); crsrtssetstreamvariable('cyclepages', 'prestime2', nr_frames_2, CRS.SS_IMMEDIATE); crsrtssetstreamvariable('cyclepages', 'prestime3', nr_frames_3, CRS.SS_IMMEDIATE); crsrtssetstreamvariable('cyclepages', 'pg1', pg1-1, CRS.SS_IMMEDIATE); crsrtssetstreamvariable('cyclepages', 'pg2', pg2-1, CRS.SS_IMMEDIATE); crsrtssetstreamvariable('cyclepages', 'pg3', pg3-1, CRS.SS_IMMEDIATE);

Execute the stream crsrtsstartstream(rts_script, CRS.SS_IMMEDIATE);

Execute the stream crsrtsstartstream(rts_script, CRS.SS_IMMEDIATE); Read values from RTS variables response = int32(0); RT = int32(0); ready = int32(0); while ready == 0 ready = crsrtsgetstreamvariable('cyclepages', 'ready'); end response = crsrtsgetstreamvariable('cyclepages', 'resp'); RT = crsrtsgetstreamvariable('cyclepages', 'RT'); crsrtsdestroystream(rts_script);

Gamma non-linearity Luminance output of most CRT s is not proportional to the voltage of the applied signal but follows a power law L = k (V V 0 ) γ Exact relationship differs between monitors

1 Luminance 0.8 0.6 0.4 0.2 0 Pixel index 1 Luminance 0.8 0.6 0.4 0.2 Pixel index

Power

Gamma correction Ensures accurate reproduction of stimulus contrast or absolute luminance Reproducing images with the same luminance on different monitors and configurations reproduction of experimental data

Gamma correction

Gamma correction using Visage Gamma correction is automatically applied when presenting stimuli using Visage The Gamma nonlinearity is measured using OptiCal in vsgdesktop For color calibration, the ColorCal calibration device is required

Digital-to-analogue conversion Stimuli are generated digitally with very high precision CRT s are analogue devices: luminance controlled by voltage level Typical 8-bit VGA system: 2^8 = 256 luminance levels Effect of limited resolution Again leading to harmonic distortion, especially at low contrasts The smallest luminance step an 8 bit DAC can render is 0.3922% of its nominal range At best, a sine wave grating of.4 -.5% contrast becomes a square wave grating or even a uniform field

Power

White Black 1 2 : 126 127 128 : : 256 Luminance 1 2 3 4 5 6 7 256 DAC value

White Black 1 2 : 126 127 128 : : 256 Luminance 1 2 3 4 5 6 7 256 DAC value

Palette rescaling Ligh t gray Dark gray 126 126. 1 126. 2 : 127 : 127. 8 127. Luminance 9 (Palette) 128 1 2 3 4 5 6 7 256 DAC value

Palette rescaling 25 6 DAC value 1 1 12 8 Luminance 256

6DAC value Combining palette rescaling and gamma correction Actual luminance 50 40 30 20 10 0 Desired luminance 25 1 1 12 8 Luminance 256

Palette rescaling on Visage: LUT cycling L = 0 0. 5 1

Palette rescaling on Visage: LUT cycling L = 0 0. 5 0 0. 5 1 1

Palette rescaling on Visage: LUT cycling L = 0 0. 5 0 0. 5 0. 4 0. 5 1 1 0. 6

Palette rescaling on Visage: LUT cycling L = 0 0. 5 0 0. 5 0. 4 L(:,1) = linspace(0,1,256); L(:,2) = linspace(0,1,256); L(:,3) = linspace(.4,.6,256); 0. 5 1 1 0. 6

Palette rescaling on Visage: LUT cycling L = 0 0. 5 0 0. 5 0. 4 L(:,1) = linspace(0,1,256); L(:,2) = linspace(0,1,256); L(:,3) = linspace(.4,.6,256); 0. 5 1 1 0. 6 Row index indicates page index in the page cycle Element at column i of N denotes the (scaled) voltage level linked to a luminance value i. In case of 8-bit DAC: N = 256

Palette rescaling: LUT cycling crslutbufferwrite Write palette matrix to LUT buffer crslutbuffercyclingsetup Set up the LUT cycle crssetcommand(crs.cyclelutenable + CRS.CYCLEPAGEENABLE); Execute Page cycle and LUT cycle simultaneously