Contrast Sensitivity Testing Program Specification



Contrast Sensitivity Testing Program Specification

Principal Investigator: Dr. Princi Palin Vestigator

Author: Gradu A Testudent

Developer: Gradu A Testudent

Date: February 15, 2008

Introduction 1

Terminology 2

Hardware Environment 2

Software Development Tools 2

User Interface 2

Main Window 2

Experiment Window 3

Experiment Parameters 3

Typical Sequence 6

Computations 7

Stimulus Computation 7

Weibull Psychometric Function 9

Graphic Results 9

File Formats 9

Parameter Files 9

Result Files 10

References 12

Resources 12

Introduction

This specification describes a program for performing psychophysical testing of contrast sensitivity. The stimulus is a Gabor patch (a sinusoid windowed with a Gaussian) on a mean luminance background, presented in one of two temporal intervals during the trial. The subject indicates whether the Gabor was seen in the first or second interval. A tone is presented during each of the two intervals to cue the subject. The subject must choose one of the intervals, even if neither interval appeared to have any stimulus. This strategy is termed the “two-alternative forced-choice” (2AFC) method.

The stimulus spatial frequency and contrast varies in the user-specified range in a randomly shuffled order. The experiment designer is responsible for selecting appropriate contrast ranges so that the subject will have some trials where the stimulus cannot be easily detected and others where it is very clearly detected for all spatial frequencies. (A separate program, using a faster staircase approach, may be used to identify the best ranges to test, prior to using this program).

For each spatial frequency, the number of correctly identified trials per number of presented trials (i.e. the percent correct), at each contrast are fit to a Weibull psychometric function to determine the contrast threshold. The corresponding contrast sensitivity (reciprocal of the threshold) is plotted versus spatial frequency.

Terminology

Gabor: a two-dimensional luminance pattern comprised of a sinusoidal function multiplied by a two-dimensional Gaussian function (see Computations section).

Contrast Sensitivity: The reciprocal of Contrast Threshold.

Contrast Threshold: The minimum contrast at which the presence of the Gabor can be detected at a given spatial frequency.

Subject: the person who views the stimulus screen and responds during the experiment

User: the operator of the experiment who enters the experiment parameters. The program is designed so that the user may also act as the subject, if desired.

Hardware Environment

The software is expected to be run on a Windows XP computer with two displays. The primary display is used to present the main window of the program to the operator. The secondary display is used to present the stimulus to the subject. The stimulus display must be calibrated for spatial and luminance characteristics. It may be necessary to use a neutral density filter between the subject and the stimulus display to provide sufficiently low contrast conditions.

Software Development Tools

This program is written in MATLAB version R2007b and uses Psychophysics Toolbox Version 3 (PTB3) to provide control of the stimulus monitor and timing (Brainard, 1997; Pelli, 1997). Curve Fitting Toolbox may used to fit the psychometric function.

User Interface

The user interfaces consists of a main window that sets up the experiment and a testing window that shows the progress of the experiment.

Main Window

The main window provides edit boxes, checkboxes, list-boxes and pushbuttons. The various box controls are used to enter the experiment parameters. The pushbuttons are used to start the experiment (“Run” button) or display a sample stimulus for evaluation (“Sample” button). A menu bar provides operations for accessing parameter files and exiting the program and setting preferences, as follows.

File Menu

File: Open: Opens a text file that stores a set of previously stored parameters.

File: Save As: Saves the current set of parameters as a text file.

File: Exit: Exits the main window of the program.

Preferences Menu:

TBA

Experiment Window

The experiment window shows the progress of the experiment and provides a pushbutton with the caption “Cancel” so that the user may abort the experiment if the subject needs to leave or if the experiment is progressing badly. A text box indicates the current trial number with the message “Testing trial n of N”, so that the user can get an idea of how quickly the experiment is progressing

Experiment Parameters

Most of the experiment parameters are used to control the visual stimulus characteristics. The stimulus is displayed as a two-alternative forced choice, with two temporal intervals. The stimulus is a Gabor patch with the specified spatial frequency, contrast, phase, and duration. See the “Computations” section for details regarding the relationship between the stimulus parameters and the stimulus image.

Temporal Limitations

Note that the temporal parameters are limited by the frame timing of the stimulus display. The typical frame rate of a CRT or LCD display is 70 to 85 Hz. A single frame is therefore on the order of 12 – 15 ms. The user specifies time intervals in milliseconds and the software converts these values to the nearest available number of frames. PTB3 provides functions for determining the frame rate of the display. For example, consider a display running at 85 Hz. In this case, a 500-millisecond stimulus is presented as 43 frames or 506 milliseconds.

Spatial Limitations

The highest spatial frequency that can be presented is limited by the resolution of the monitor (two pixels per cycle) and the viewing distance. Likewise, the largest stimulus is limited by the extent of the monitor. The spatial resolution of a typical display monitors is about 0.22 to 0.28 mm per pixel.

The experiment conditions are entered on the main window, including the subject information and the stimulus characteristics. These fields include:

Subject Identifier: A three character subject identifier is entered. This identifier is typically the subject’s initials or a number. The default setting is blank. The user must enter at least one character, or the experiment will not start.

Date: The date is automatically generated from the system clock and displayed on the form. The user may not edit this field.

Eye: The options “no selection”, “OD” (right eye), “OS” (left eye) and “OU” (both eyes) are provided in a pull-down list box. The “no selection” option is the default, indicating that the user must select one of the other settings. The experiment will not begin if the user has not selected a valid eye designation.

Condition: This field provides for the user to enter a specific condition related to the experiment, such as dark-adaptation or pathology. This field may be left blank. It is the responsibility of the user to enter consistent keywords in this field so that the same conditions are expressed the same way throughout a study.

Viewing Distance: The subject views the stimulus from a specified distance. This distance, in cm, is used to calculate the number of pixels per degree of viewing angle. This value is required for converting the spatial frequency from cycles per degree (cpd) to the spatial period in pixels per spatial cycle.

Filter Attenuation: If a neutral density filter is used to attenuate the luminance that the subject sees, this field records the percent transmittance of the filter.

Mean Luminance: The mean luminance of the Gabor patch must be greater than zero and less than or equal to one half the maximum luminance of the monitor. The maximum luminance of the monitor is read from a separate file that is generated during calibration of the monitor. The user enters the value in candelas per square meter (cd/m2). The default value is half the maximum luminance of the monitor.

Stimulus Duration: Each of the two intervals of the trial is presented for this amount of time in milliseconds. One interval contains the stimulus and the other contains a blank (uniform mean-luminance screen). The order is randomly selected to be equally probably. The program selects the nearest available milliseconds given the frame rate of the stimulus display.

Repetitions: This value specifies how many times to show each combination of spatial frequency and contrast during the entire experiment session.

Phase: A list-box provides two choices for phase: 0 and 90 degrees. The default value is 0 degrees.

Sigma: The standard deviation of the Gaussian envelope of the Gabor function is set as a number of spatial cycles. Hence, the same number of cycles will appear in each of the interleaved trials, no matter what the spatial frequency.

The contrast values are entered in units of percent, where 100% contrast means that the darkest point of a 90 degree phase Gabor patch is zero, and the maximum is nearly twice the mean luminance (as windowed by the Gaussian).

Contrast Minimum: The minimum contrast to test is entered as percent, where 100

Contrast Maximum: The maximum contrast level to test.

Number of Contrast Levels: The number of contrast levels to test.

Spatial Frequencies: This set of checkboxes allows the user to select up to 10 spatial frequency levels to test during the experiment. The spatial frequencies include two groups based on doubling the lowest value {0.25, 0.5, 1, 2, 4, 8, 16, 32} and {0.35, 0.7, 1.41, 2.82, 5.64, 11.28, 22.56} cycles per degree. At least one spatial frequency must be selected for the experiment to start. The default condition is to have no boxes checked so that the user must make a selection.

The table below summarizes the parameter names, the units (where applicable) and the minimum and maximum ranges accepted by the user interface. For parameters that are selected from a list of options, the options are listed in curly brackets {}. Some of the maximum values are much larger than the expected maximum to be used. They are set large enough to include any desirable value and small enough that if the user accidentally types extra characters, the excessive order of magnitude would flag the error. Some conditions, such as a long duration or 100% contrast, can be of use for testing the program. The default setting of each parameter is indicated, where applicable. Some fields are blank or not selected. All parameters are required to be selected unless indicated as [optional] in the “Default” column. Note that the contrast values may be entered as any value between 0 or 100% when editing the fields on the form, but when the “Run” button is pressed to start the experiment, the program confirms that the minimum is not larger than the maximum. They may be set to the same value, with the number of contrast levels equal to 1, to allow for a quick test at one contrast level (for instance to verify the spatial characteristics of the stimulus).

|Parameter |Units/Options |Minimum |Default |Maximum |

|Subject Identifier |n/a |n/a |blank |n/a |

|Date |n/a |n/a |Automatically set to the |n/a |

| | | |current date | |

|Eye |{“OS”, “OD”, “OU”} | |Not selected | |

|Condition |n/a |n/a |Blank [optional] |n/a |

|Viewing Distance |Centimeters (cm) |0 |100 |500 |

|Filter Attenuation |Percent |0 |0 |100 |

|Mean Luminance |Candelas per square meter|1 |Automatically set to half|500 |

| | | |the available luminance | |

| | | |range | |

|Stimulus Duration |Ms |10 ms |200 ms |10000 ms |

|Repetitions |n/a |1 |10 |100 |

|Phase |{0, 90} |n/a |0 |n/a |

|Sigma |Spatial cycles |0 |1 |10 |

|Contrast Minimum |percent |0% |0.05% |100% |

|Contrast Maximum |Percent |0% |5% |100% |

|Number of Contrast Levels|Percent |1 |5 |20 |

|Spatial Frequencies |{0.25, 0.5, 1, 2, 4, 8, |One checkbox must be |No checkboxes are |All checkboxes may be |

| |16, 32; 0.35, 0.7, 1.41, |selected |selected |selected |

| |2.82, 5.64, 11.28, 22.56}| | | |

Typical Sequence

During a typical experiment session, the operator selects the experiment parameters, either by selecting them on the form, or loading a previously saved parameter file. The user must enter the subject ID and select the eye setting as OS, OD or OU, even if reloading the other parameters from a file. The operator clicks the “Run” button to begin the experiment. The software confirms that all parameters pass the error checking conditions, and proceeds if so. If any error condition fails, then a warning message is displayed, describing the error condition. After the user presses “ok” in response to this message, the main window continues to be shown so that the operator can remedy the error.

The program creates a complete list of all the conditions to be tested, (i.e. every spatial frequency and contrast), and replicates the list as many times as the repetitions values. For example, if the user enters a value of 10 repetitions, 4 contrast levels, and checks 3 spatial frequencies, then the total number of trials is 20x4x3=240. These 240 conditions are then shuffled (using a uniform random distribution) to determine the presentation order.

For each trial, the program selects the next condition from the shuffled list and prepares the stimulus in memory, ready for presentation. The stimulus display shows a blank, mean-luminance screen. The program selects with equal probability whether to show the stimulus in the first or second interval. For the first trial, the subject presses the spacebar to begin. A 100 ms blank interval follows. The first interval is presented with a simultaneous tone. A blank screen appears during a silent interval of half the stimulus duration following the first interval, providing a gap between intervals. The second interval with a simultaneous tone follows the silent interval. The subject may respond during or after the stimulus is displayed. If the subject sees the stimulus in the first interval, the response may occur during the first interval, but both intervals are shown. The subject has an indefinite amount of time to respond. No feedback (correct or incorrect) is given to the subject.

The following list outlines the order or a typical experiment session.

1. User selects Run button

2. Program prepares and shuffles the list of all conditions (spatial frequency and contrast pairs) to test during the session

3. Program prepares the stimulus in memory while showing a blank screen

4. Subject presses the space bar to initiate the first trial

5. Program displays a blank screen for 100 ms

6. Program displays Interval 1 for stimulus duration ms, with a concurrent tone

7. Program displays a blank screen for ½ the stimulus duration, with no sound

8. Program displays Interval 2 for stimulus duration ms, with a concurrent tone

9. Program waits for subject response, if the subject has not already responded.

10. Subject responds by pressing 1 or 2 on the numeric keypad (may happen as early as during step 6)

11. Program records the contrast, spatial frequency and “correct” or “incorrect” for this trial in memory.

12. If all trials are complete, proceed to 13, otherwise, repeat from 5.

13. Present a file selection window with a suggested file name and folder location, based on the previously selected folder and the subject identifier and date. Record result file as described in the File Formats section.

14. Compute the psychometric function fits.

15. Display the plot of the psychometric function fits and contrast sensitivity versus spatial frequency. (User may close these windows at any time afterward).

16. Return to main window.

Computations

Stimulus Computation

The stimulus is a sinusoidal grating windowed by a Gaussian envelope. A grating is a two-dimensional luminance pattern that varies in one direction and is constant in the perpendicular direction. One simple example is a square-wave grating consisting of regularly spaced stripes of two different colors. In this experiment, the grating luminance varies as a sinusoid horizontally with respect to the direction perpendicular to the vertical stripes. The grayscale intensity varies from a minimum dark gray or black color to a maximum bright gray or white intensity. The background is the mid-level gray that is half the maximum luminance. The sinusoid luminance variation gives the visual effect of soft edges between the dark and bright bands.

Consider the peak and valley of only a sine wave in one dimension. The zero-crossing of the sine wave can be considered to be the mean-luminance or background level of the stimulus. Stripes that are of greater intensity are the positive peaks and stripes that are of lower intensity are the negative valleys. The contrast of the grating is the difference between the background and the peak (or valley) and the background. One way to express this is:

[pic]

where Lmax is the maximum luminance of the peak and Lmin is the minimum luminance of the valley. Note that (Lmax - Lmin)/2 is the difference between the peak (or valley) and the mean level. (Lmax + Lmin)/2 is the mean level, Lmean.

In this experiment, the origin of the Gaussian envelope of the Gabor is the center of the stimulus display. If zero phase is selected, then the zero crossing of the sine wave is located at the center of the circularly symmetric Gaussian envelope (and the center of the display). At 90 degrees of phase, the minimum of the sine wave is located at the Gaussian center. As the radial distance from the center of the Gaussian increases, the contrast decreases to effectively zero around the edges, falling off according to the standard deviation of the Gaussian.

The equation is given as:

Where, in Cartesian coordinates, for the pixel area of the stimulus display

Lmean is the mean luminance (cd/m2)

x is the horizontal pixel position

y is the vertical pixel position

(xc, yc) is the center of the Gabor patch

p is the spatial period (1/frequency) of the grating component in pixels

σ is the standard deviation of the Gaussian distribution, in pixels

( is the phase of the sine wave, converted to radians

In the above equation, spatial frequency has been converted to spatial period (p) in pixels, x and y are in pixels and 2( is the extent of a single cycle of the sine wave. The Gaussian component is expressed by the exponential function, with standard deviation σ, in pixels. Note that the sigma value specified by the user must first be converted from the number of cycles to pixels for each spatial frequency. For example, consider the following conditions:

spatial frequency = 2 cpd

spatial period = 1/spatial frequency = ½ degree per cycle

viewing distance = 57 cm (1 cm = 1 degree at this distance)

sigma = 1.5 cycles

display pixel size = 0.22 mm

1 degree = 1 cm = 45 .45 pixels

1 spatial period = 0.5 degree = 22.73 pixels

Sigma = 1.5 cycles = 34.1 pixels

Weibull Psychometric Function

The subject’s performance is fit to a Weibull psychometric function, W(a,b), that is given by:

[pic]

Where

Parameters a and b are adjusted to minimize the difference between the model and the measured data.

U is the upper asymptote of the subject’s performance

L is the lower asymptote of the subject’s performance (such as the guess rate)

A is (U-L)

s is the vector of stimulus levels presented to the subject.

The contrast threshold is taken as the stimulus level where W(a,b) evaluates to 0.75 (75%) when the lower asymptote is 0.5 (50 % guess rate). The upper asymptote is the maximum percent correct performed during the session, which will typically be 100%.

Graphic Results

After the testing is complete, the following plots are produced. First, the measured percent correct versus contrast level is plotted for each spatial frequency tested. Each spatial frequency is plotted with a different marker shape and color. The Weibull fit for each spatial frequency curve plotted as a solid line in a color matching that of the corresponding marker.

A second plot shows contrast sensitivity threshold versus spatial frequency for the entire session.

File Formats

Parameter Files

The parameter files, that the user may save and reuse, store as plain text the following parameters that correspond with the user interface. The user selects the file name and folder using a file selector window. The file extension is “.prm”. The file is stored as tab-delimited text, with the parameter label in the first column and the parameter value as the second column, as shown in the table below. For the checkbox fields, a value of 0 or 1 in the parameter file represents an unchecked or checked box, respectively

|Condition |user-entered value |

|Viewing Distance |user-entered value |

|Filter Attenuation |user-entered value |

|Mean Luminance |user-entered value |

|Stimulus Duration |user-entered value |

|Repetitions |user-entered value |

|Phase |0 or 90 |

|Sigma |user-entered value |

|Contrast Minimum |user-entered value |

|Contrast Maximum |user-entered value |

|Number of Contrast Levels |user-entered value |

|Spatial Frequency(cpd): 0.25 |0 or 1 |

|Spatial Frequency(cpd): 0.5 |0 or 1 |

|Spatial Frequency(cpd): 1 |0 or 1 |

|Spatial Frequency(cpd): 2 |0 or 1 |

|Spatial Frequency(cpd): 4 |0 or 1 |

|Spatial Frequency(cpd): 8 |0 or 1 |

|Spatial Frequency(cpd): 16 |0 or 1 |

|Spatial Frequency(cpd): 32 |0 or 1 |

|Spatial Frequency(cpd): 0.35 |0 or 1 |

|Spatial Frequency(cpd): 0.7 |0 or 1 |

|Spatial Frequency(cpd): 1.41 |0 or 1 |

|Spatial Frequency(cpd): 2.82 |0 or 1 |

|Spatial Frequency(cpd): 5.64 |0 or 1 |

|Spatial Frequency(cpd): 11.28 |0 or 1 |

|Spatial Frequency(cpd): 22.56 |0 or 1 |

Result Files

The results of the experiment are stored in a tab delimited text file. The name of the file suggested to the user is based on the subject ID characters with the date appended with the format “yyyymmdd”. The extension is “.dat”. The folder location is based on the location most recently selected by the user.

The result file is organized with the following captions and values, as shown in the table. Captions are displayed in plain text and data entered or supplied by the user, subject or program calculations are shown in italic. The first part of the file summarizes the experiment conditions and computed contrast sensitivity versus spatial frequency. The latter section gives the details of the subject’s performance at each spatial frequency and contrast, so other psychometric functions may be used to fit the data at a later time.

The spatial frequencies and contrast values are represented by the symbols f(1), f(2), … f(n) and c(1), c(2)…c(m), respectively. The number of trials is generally equal to the repetitions parameters, but if the session is terminated early, then the trials that were tested are stored in the file. This value is represented as R in the format below. The number of correct trials, #, (not the percent correct) is stored in the last column. The value will depend on the subject’s response and is represented by a pound sign in the table below.

|Subject Identifier |user-entered value | | |

|Date |automatically generated date | | |

| |formatted as mm/dd/yyyy | | |

|Eye |OD, OS or OU | | |

|Condition |user-entered value | | |

|Viewing Distance (cm) |user-entered value | | |

|Filter Attenuation (%) |user-entered value | | |

|Mean Luminance (cd/sq-m) |user-entered value | | |

|Stimulus Duration (ms) |user-entered value | | |

|Repetitions |user-entered value | | |

|Phase (degrees) |0 or 90 | | |

|Sigma (cycles) |user-entered value | | |

| | | | |

|Spatial Frequency |Contrast Sensitivity | | |

|f(1) |s(1) | | |

|f(2) |s(2) | | |

|… |… | | |

|f(n) |s(n) | | |

| | | | |

|Spatial Frequency |Contrast |Trials |Correct |

|f(1) |c(1) |R |# |

|f(1) |c(2) |R |# |

|f(1) |… |R |# |

|f(1) |c(m) |R |# |

|f(2) |c(1) |R |# |

|f(2) |c(2) |R |# |

|f(2) |… |R |# |

|f(2) |c(m) |R |# |

|… |c(1) |R |# |

|… |c(2) |R |# |

|… |… |R |# |

|… |c(m) |R |# |

|f(n) |c(1) |R |# |

|f(n) |c(2) |R |# |

|f(n) |… |R |# |

|f(n) |c(m) |R |# |

References

Brainard, David H. (1997) The Psychophysics Toolbox, Spatial Vision 10:433-436

Pelli, Denis. G. (1997) The VideoToolbox software for visual psychophysics: Transforming numbers into movies, Spatial Vision 10:437-442.

Watson, Andrew B, (1979) Probability Summation Over Time, Vision Research 19:515-522

Watson, Andrew. B. and Pelli, Denis G. (1983) QUEST: a Bayesian adaptive psychometric method. Perception and Psychophysics 33:113-20.

Resources

Psychophysics Toolbox:



MATLAB



[pic]

-----------------------

[pic]

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download