MatVis will soon include many new features not described in this users manual:

Most manual pages describing the commands are now available using the index on the left frame of this page. Below we describe the MatVis system, its motivation, goals and limitations. 

Contents:
Introductory comments
PC Hardware Issues - generic vs. special purpose hardware
Structure of MatVis
Minimum System Requirements
Installation
Future Directions


Introduction
Members of the Neurometrics Institute have been working on an elaborate software platform for psychophysical testing called WinVis. While much remains to be done on the project, it has come to our attention that many users of MATLAB on the PC platform would like tools like those available to MATLAB users on the Macintosh. MatVis is our initial solution to this problem.

MatVis provides MATLAB programmers a method of accurate screen control that is needed for psychophysical testing. Under the users control, MatVis, using a DirectX back end, adjusts the video screen resolution and framerate. Other processes are prevented from writing to the monitor and the user's processes achieve the highest operating system priority to prevent disruption of a timed video presentation. Before describing the basic design of MatVis, PC hardware considerations and limitations are reviewed.


PC Platform under Windows95/98/2000/NT4.0
For many years the primary method of doing psychophysics on the PC platform has been to use specialized video hardware designed for Vision Science. Advances in off-the-shelf PC hardware are such that the majority of visual psychophysical testing can now be performed without exotic video hardware.
Two Major PC Advances: (1) The main reason users of PC's have had to resort to expensive hardware specifically designed for vision science has been the limited graphics throughput of the ISA video bus and the limited bit depths and resolution of early graphics cards (6 bits/gun). Things have changed considerably with the coming of the dedicated AGP graphics bus plus modern high speed video cards (8 bits/gun) which support multiple screen resolutions and framerates. Full screen graphics images can now be updated at normal video frame rates using generic video graphics cards. Along with this increase in bus speed has been a parallel improvement in CPU performance. (2) The second advance which has occurred is Microsoft's release of a high speed graphics library designed for video game developers, which runs under for Windows95(98,2000) and NT. DirectDraw offers fast graphics screen updates with direct access to bitmap memory with a common API across PC video hardware platforms. Moreover, all the advantages of a modern operating system such as a GUI, flat memory space, virtual memory, multi-tasking, multi-threads offer additional advantages over specialized add-in graphics coprocessor boards with limited onboard memory.
Resolution:
As an example of the resolutions available, this document is being written on a PC with a generic graphics card that supports 27 display resolutions under NT 4.0 with DirectDraw, from 320 by 200 to 1600 by 1200 pixels. Most modes support 8, 16, 24 and 32 bits/pixel depths. The range of frame rates supported ranges from 43 to 200 Hz., though not all modes support all frame rates. This range of video modes is adequate for the majority of psychophysical studies (MatVis only supports 8 bits/pixel but will soon be upgraded).
Video Bus Performance:
For several years we have been touting the performance specifications of the AGP bus which has finally arrived. The common PCI video bus runs at 33 MHz for a maximum throughput of 133MBps (Million Bytes/second). The AGP2 bus, which is a dedicated graphics bus can operate at 528MBps. AGP2 mode 4, which is just starting to become available, supports over 1000MBps. The common 640 x 480 pixel 8 bit display refreshed at 528MBps would have an effective frame rate of 1719 Hz, far beyond present monitor capabilities. So much for theory. Using optimized assembly code we have measured data throughput from system memory to video memory (without synchronizing to the video frame) on our AGP bus machine and found rates as high as 203Mbps. At 640 x 480 pixels that's still an effective 661 Hz frame rate. The 203MBps rate is actually close to the maximum of 264 MBps for the standard 66 MHz memory bus using EDO DRAM chips. We expect the new PCs with a 100-133 Mhz memory bus to have a much higher throughput. Intel Corp. has announced that chipsets supporting DirectDRAM with a throughput of 1600MBps. The theoretical video throughput (~1600MBps) could reach an effective 277 Hz frame rate for 1600 x 1200 pixel displays with a 24 bit pixel depth. If the hardware is not fast enough today, it soon will be.
MatVis uses a double buffer technique to completely change the active display buffer during the vertical retrace period to avoid screen tearing artifacts. On our Pentium II (300 MHz) system, MatVis can move a sequence of 640 x 480 pixel images from system memory to video memory, while respecting video synchronization, at the highest frame rate supported, 200 Hz. In 1024 x 768 video mode, synchronization was still achieved without dropping frames at the 90 Hz frame rate. These rates correspond to about 70MBps. Given that video synchronization should add little overhead, once we convert to optimized assembly code (which attained a throughput of 203Mbps) MatVis throughput should significantly increase.
Not everyone will upgrade to the AGP bus system immediately. Fortunately, PCI bus systems offer respectable performance and will be suitable for the majority of psychophysical studies. Even our 120MHz Pentium computers with PCI bus achieved synchronized 640 x 480 pixel x 8 bit full screen update at normal video rates. This system is what we consider to be the minimum hardware requirement for MatVis. Does the modern PC constitute an adequate video hardware platform for performing the majority of psychophysical studies? The answer is yes.
The Pixel Depth Problem:
One area where specialized hardware for vision science excels is available pixel depths of 10-15 bits/gun. Most generic PC graphics cards offer 8 bits/gun (currently MatVis supports only 8 bits total/pixel using a 24 bit LUT). This limited bit depth is a problem, especially when performing tasks such as contrast sensitivity where fine gray scale control is critical. Fortunately, methods exist that effectively extend the bit depth beyond 8 bit using external resister circuits (Pelli & Zhang, 1991). Other methods include splitting the luminance information for one pixel across 2 pixels, one for the coarse color level of each gun and one for fine steps in color space by taking advantage of the strong gamma function nonlinearity of video card output voltage to display luminance. This method has the limitation of doubling the viewer distance to achieve a desired pixel size and possibly lowering the maximum luminance. These methods of compensating for limited bit depth are annoying but quite adequate for most applications.
In summary:
The hardware capabilities of today's PC meets the requirements of most psychophysical studies. The arrival of the AGP bus and increased memory bus speeds has eliminated the need for specialized graphics cards for most psychophysical experimentation. The advantage of using generic components is low cost and rapid upgrades as the technology improves. MatVis automatically scales to take advantage of the system's graphics capabilities. The special purpose proprietary hardware boards found in many of today's vision testing systems are very costly due to limited demand. They don't offer the rapidly increasing capabilities that is exhibited by main stream video cards. The use of generic video hardware offers many advantages over the proprietary approach. The main area that proprietary systems have the advantage is in lookup table (LUT) depth for luminance/color control. The 10 to 15 bit lookup tables of the specialized graphics cards offer an advantage in terms of gray scale linearization for contrast sensitivity measurements and fine color control. Alternative methods of linearization exist which can be utilized (Tyler et. al, 1992; Pelli & Zhang, 1991; Klein & Carney, 1990; 1991; Carney & Klein, 1998) to effectively extend the bit depth of generic graphics cards. Off-the-shelf PC video hardware of is capable of providing the necessary display resolutions and frame rates needed for the vast majority of visual psychophysics experiments. The hardware is only going to get better as faster CPU and memory systems are released and the new AGP graphics bus standard is in general use. MatVis automatically scales to take advantage of new hardware. The need for an expensive graphics system specially designed for vision science will become increasingly rare as the technology advances.


Structure of MatVis

MatVis is particularly well suited to performing psychophysical experiments using the method of constant stimuli. The basic setup of an experiment involves initialization of MatVis, declaring the number of stimulus conditions (trials), building the stimuli and loading them into MatVis, setting up LUTs if needed and finally presenting the stimuli using the "run" command. We have written a wrapper program in MATLAB which makes it particularly easy to setup an experiment (provided with the purchase of MatVis). The user just writes a simple module for generating the desired patterns and the wrapper code takes care of stimulus presentation, data collection, subject feedback and final data and parameter storage for later examination. The MatVis system is not limited to method of constant stimuli, it is just the procedure that we most commonly use.
The following discussion assumes the user is familiar with MATLAB programming conventions. MatVis commands can be called from the MATLAB command line or contained in MATLAB "m" files. Using the MatVis "flip" function the user can move back and forth between the standard Windows interface (the MATLAB command window) and the MatVis display screen. Besides using predefined trials the user can use the "flashImage" command to present arbitrary images without using the "run" command. If errors occur during the operation of MatVis messages are sent either to the MATLAB command window or to a file called 'errors.log' in the working directory. If you have any problems be sure to examine the error.log text file. Also, if MatVis detects missed video frames, the information is logged in the text file 'trial_fps.log' in the working directory.
Below is a simple example program for a spatial frequency discrimination experiment that demonstrates some of the basic commands. Five spatial frequencies (trials) are presented in random order. Each spatial frequency (5, 5.2, 5.4, 5.6, 5.8 c/screen) grating are presented for a total of 20 times and the subjects response is collected after each presentation. After the data are collected control returns to the MATLAB command window and the results are stored on disk. As you can see an entire experiment may require only a few lines of MATLAB code. Details about the individual commands available using the command index in the frame to the left of the screen.

clear all;
MatVis ('init', 500, 640, 480); % initialize MatVis, 640 x 480 pixel mode.
for i = 1:5, % build the 5 trials (conditions).
MatVis('trial', i, 1, [1 1], [480 640]); % define condition i, 1 full screen image each
image = repmat(100.*sin(2*pi*(5+i/5)*[(1:640)./640]) + 128, 480, 1); %make a sinewave grating
MatVis('spatial',i,1,image); % load the image for the ith trial
MatVis('temporal',i,100,[1 1]); % presentation duration will be 100 video frames
end;
fix = zeros(5,5); fix(3,:) = ones(1,5)* 200; fix(:,3) = fix(3,:)'; % make a fixation cross
MatVis('fixation', [237 317 ], fix); %position a fixation cross near the center of each trial
npresentations = 100; % number of stimulus presentations
results=zeros(npresentations,2); % subject response array
order=randperm(npresentations); % random presentation order
for i=1:npresentations; % 100 trials
nexttrial=mod(order(i),5)+1; %select the next trial level
MatVis('run',nexttrial,0); % present the the stimulus
results(i,1) = nexttrial; % save the current condition number
results(i,2) = input(' '); % save the subjects response
end;
MatVis('flip'); % flip to the command line window
save 'junk' results; % save the data
MatVis('exit'); % exit MatVis


Minimum Requirements:

MatVis scales to the available system hardware. The better the hardware the more flexible and capable MatVis becomes. Even the minimum system (below) is able to provide full frame updates (640 x 480 x 8) at over 60 Hz. but considerably more memory is required for more than a few frames at this rate.

Minimum System

Pentium 120+ MHz
PCI bus graphics card
32+ meg memory
MATLAB version 6.0+
Windows95
The latest Direct X drivers (www.microsoft.com).

Ideal System for displaying video sequences

Pentium II 300+ MHz
AGP bus graphics card
100 MHz system bus
128+ meg memory
MATLAB version 6.0+
Microsoft NT4.0
The latest Direct X drivers (www.microsoft.com).


Installation of MatVis

Insert the disk into your computer drive A. From the task bar select "start", then "run". In the box enter: " A:setup.bat c:\matlab\bin" (or the proper path to your MATLAB bin directory). The setup program will install two files into the bin directory. Assuming you have already installed DirectX (free from www.microsoft.com), you should now be able to start using MatVis. In the MATLAB command window type, MatVis('help'). The command window should then contain a list of the available MatVis commands, if not, something has gone wrong with the setup.
If the setup failed and you don't see the files, matvis.dll and splash.bmp, in the MATLAB bin directory you should copy them manually from the A: drive and then try envoking MatVis from MATLAB once again. If problems persist send us email thom@neurometrics.com or call us at 510-644-3112 (9AM to 6PM Pacific Coast Time). We will get you up and running right away.


Future Plans
When we have time to contemplate plans we will pass them on to you. We expect users will suggest many modifications to the system which will certainly keep us busy.