Use OPI to present stimulus.

Description

Generic function for presentation of stimulus stim. Depending on your choice of OPI implementation set using chooseOpi(), different parameters are available for opiPresent.

Usage

1
opiPresent(stim, nextStim=NULL, ...)

Arguments

stim

A list of class opiStaticStimulus, opiKineticStimulus, or opiTemporalStimulus.

nextStim

As for stim, but the next presentation to be made. This might be useful on some machines, particularly projector based systems, where preparations for the next presentation can be made while waiting for a response to the current.

...

Parameters specific to your chosen opi implementation.

Details

opiPresent is blocking in that it will not return until either a response is obtained, or at least the responseWindow milliseconds has expired. (Note that more time might have expired.) Specifying nextStim allows the implementing machine to use the time waiting for a response to stim to make preparations for the next stimuli. (For example retargeting the projector or moving aperture and/or filter wheels.) There is no guarantee that the next call to opiPresent will have nextStim as the first argument; this could be checked by the machine specific implementations (but currently is not, I think).

Also note that to allow for different parameters depending on the implementation chosen with chooseOpi, every parameter MUST be named in a call to opiPresent.

SimHenson

opiPresent(stim, nextStim=NULL, fpr=0.03, fnr=0.01, tt=30)

If the chosen OPI implementation is SimHenson, then the response to a stimuli is determined by sampling from a Frequency-of-Seeing (FoS) curve (also known as the psychometric function) with formula

\code{fpr+(1-fpr-fnr)*(1-pnorm(x, tt, pxVar))},

where \code{x} is the stimulus value in Humphrey dB, and pxVar is

\code{min(simH.cap, exp(A*tt + B))}.

The ceiling simH.global.cap is set with the call to opiInitialize, and A and B are from Table 1 in Henson et al (2000). Which values are used is determined by simH.type which is also set in the call to opiInitialize.

Note that if the stimulus value is less than zero, then the Henson formula is not used. The probability of seeing is fpr.

SimHensonRT

opiPresent(stim, nextStim=NULL, fpr=0.03, fnr=0.01, tt=30, dist=stim$level - tt)

This presentation is the same as for SimHenson, but reaction times are determined by sampling from rtData as passed to opiInitialize. The dist parameter is the distance of the stimulus level from the true threshold, and should be in the same units as the Dist column of rtData. The default is just the straight difference between the stimulus level and the true threshold, but you might want it scaled somehow to match rtData.

SimGaussian

opiPresent(stim, nextStim=NULL, fpr=0.03, fnr=0.01, tt=30)

If the chosen OPI implementation is SimGaussian, then the response to a stimuli is determined by sampling from a Frequency-of-Seeing (FoS) curve (also known as the psychometric function) with formula fpr+(1-fpr-fnr)*(1-pnorm(x, tt, simG.global.sd)), where x is the stimulus value in Humphrey dB, and simG.global.sd is set with opiInitialize.

SimYes

opiPresent(stim, nextStim=NULL)

If the chosen OPI implementation is SimYes, then the response to a stimuli is always yes, hence opiPresent always returns err=NULL, seen=TRUE, and time=0.

SimNo

opiPresent(stim, nextStim=NULL)

If the chosen OPI implementation is SimNo, then the response to a stimuli is always no, hence opiPresent always returns err=NULL, seen=FALSE, and time=0.

Octopus900F310

opiPresent(stim, nextStim=NULL)

This functions as for the Octopus900, but responses are taken from the F310 Controller. If the L button is pressed, seen is set to 1. If the R button is pressed, seen is set to 2. If no button is pressed within responseWindow, then seen is set to 0.

Octopus600

opiPresent(stim, nextStim=NULL)

If the chosen OPI implementation is Octopus600, then nextStim is ignored. If eyeControl is non-zero, as set in opiInitialize, answer codes describing patient state may arise (see answer field in the Value section).

KowaAP7000

opiPresent(stim, nextStim=NULL) If the chosen OPI implementation is KowaAP7000, then nextStim is ignored.

Value

A list containing

err

NULL if no error occurred, otherwise a machine specific error message. This should include errors when the specified size cannot be achieved by the device (for example, in a projection system with an aperture wheel of predefined sizes.) If stim is NULL, then err contains the status of the machine.

seen

TRUE if a response was detected in the allowed responseWindow, FALSE otherwise. (Note, see Octopus900F310 above).

time

The time in milliseconds from the onset (or offset, machine specific) of the presentation until the response from the subject if seen is TRUE. If seen is FALSE, this value is undefined.

frames

Only returned for Octopus 900. An array of integer 0..255 for gaze image. In version 1.5, only a single frame is returned. See the parameter gazeFeed for opiInitialize to control what frames are returned.

numFrames

Only returned for Octopus 900. The number of frames in frames.

width

Only returned for Octopus 900. Width of frame in frames.

height

Only returned for Octopus 900. Height of frame in frames.

answer

Only returned for Octopus600. Can be the following values:

  • 0 = stimulus not seen;

  • 1 = stimulus seen;

  • 132 = Response button was pressed before stimulus presentation (Patient needs a break - hold on examination);

  • 36 = Eye is closed before stimulus presentation;

  • 68 = Fixation lost before stimulus presentation (pupil center is out of green window in video image);

  • 260 = Forehead rest lost before stimulus presentation;

  • 516 = Fast Eye movements before stimulus presentation;

  • 258 = Forehead rest lost during stimulus presentation;

  • 66 = Fixation lost during stimulus presentation (pupil center is out of green window in video image);

  • 34 = Eye was closed during stimulus presentation;

  • 18 = Patient answer was too early (<=100ms after stimulus presentation) - lucky punch;

  • 514 = Fast Eye movements during stimulus presentation

pupilX

Only returned for KowaAP7000 and an opiStaticStimulus. x-coordinate of centre of pupil in pixels during presentation.

pupilY

Only returned for KowaAP7000 and an opiStaticStimulus. y-coordinate of centre of pupil in pixels during presentation.

purkinjeX

Only returned for KowaAP7000 and an opiStaticStimulus. x-coordinate of centre of Purkinje Image in pixels during presentation.

purkinjeY

Only returned for KowaAP7000 and an opiStaticStimulus. y-coordinate of centre of Purkinje Image in pixels during presentation.

x

Only returned for KowaAP7000 or Octopus900 and an opiKineticStimulus. x coordinate of stimuli when button is pressed.

y

Only returned for KowaAP7000 or Octopus900 and an opiKineticStimulus. y coordinate of stimuli when button is pressed.

Author(s)

Andrew Tuprin <aturpin@unimelb.edu.au>

References

Please cite: A. Turpin, P.H. Artes and A.M. McKendrick "The Open Perimetry Interface: An enabling tool for clinical visual psychophysics", Journal of Vision 12(11) 2012.

http://perimetry.org/OPI

David B. Henson, Shaila Chaudry, Paul H. Artes, E. Brian Faragher, and Alec Ansons. Response Variability in the Visual Field: Comparison of Optic Neuritis, Glaucoma, Ocular Hypertension, and Normal Eyes. Investigative Ophthalmology & Visual Science, February 2000, Vol. 41(2).

See Also

opiStaticStimulus, opiKineticStimulus, opiTemporalStimulus, chooseOpi

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    # Stimulus is Size III white-on-white as in the HFA
makeStim <- function(db, n) { 
    s <- list(x=9, y=9, level=dbTocd(db, 10000/pi), size=0.43, color="white",
             duration=200, responseWindow=1500)
    class(s) <- "opiStaticStimulus"

    return(s)
}
chooseOpi("SimHenson")
if (!is.null(opiInitialize(type="C", cap=6)))
    stop("opiInitialize failed")

result <- opiPresent(stim=makeStim(10,0), tt=30, fpr=0.15, fnr=0.01)

    # Will not work as 'stim' is not named
#result <- opiPresent(makeStim(10,0), tt=30, fpr=0.15, fnr=0.01)

if (!is.null(opiClose()))
    warning("opiClose() failed")

    # Same but with simulated reaction times
chooseOpi("SimHensonRT")
data(RtSigmaUnits)
if (!is.null(opiInitialize(type="C", cap=6, rtData=RtSigmaUnits)))
    stop("opiInitialize failed")

dist <- (10 - 30)/min(exp(-0.098 * 30 + 3.62), 6)
result <- opiPresent(stim=makeStim(10,0), tt=30, fpr=0.15, fnr=0.01, dist=dist)

if (!is.null(opiClose()))
    warning("opiClose() failed")