opiInitialize: Initialize OPI

View source: R/opi.r

opiInitializeR Documentation

Initialize OPI

Description

Generic function for initialization of the chosen OPI implementation that is set with chooseOpi()

Usage

opiInitialize(...)

opiInitialise(...)

compass.opiInitialize(ip = "192.168.1.2", port = 44965)

display.opiInitialize(
  width,
  height,
  ppi,
  viewdist,
  lut = seq(0, 400, length.out = 256)
)

daydream.opiInitialize(
  ip = "127.0.0.1",
  port = 50008,
  lut = seq(0, 400, length.out = 256),
  fovy = 90
)

imo.opiInitialize(
  ip = "localhost",
  port = 1234,
  ppd = 16,
  tracking = FALSE,
  tracktol = 2
)

kowaAP7000.opiInitialize(ip = "192.168.1.2", port = 44965)

octo600.opiInitialize(
  ipAddress = "",
  eye = "",
  pupilTracking = FALSE,
  pulsar = FALSE,
  eyeControl = 0
)

octo900.opiInitialize(
  serverPort = 50001,
  eyeSuiteSettingsLocation = "C:/ProgramData/Haag-Streit/EyeSuite/",
  eye = "",
  gazeFeed = "",
  bigWheel = FALSE,
  pres_buzzer = 0,
  resp_buzzer = 0,
  zero_dB_is_10000_asb = TRUE
)

PhoneHMD.opiInitialize(ip, port = 50008, lut = seq(0, 400, length.out = 256))

simG.opiInitialize(sd = 2, display = NA, maxStim = 10000/pi)

simH.opiInitialize(
  type = "C",
  A = -0.081,
  B = 3.27,
  cap = 6,
  display = NA,
  maxStim = 10000/pi
)

simH_RT.opiInitialize(
  type = "C",
  cap = 6,
  A = -0.081,
  B = 3.27,
  display = NA,
  maxStim = 10000/pi,
  rtData = NULL,
  rtFP = 1:1600
)

Arguments

...

Implementation specific parameters. See details.

ip

IP address on which server is listening for PhoneHMD

port

Port number on which server is listening for PhoneHMD. Default is 50008

width

Width of the screen in pixels

height

Height of the screen in pixels

ppi

Pixels per inch of the display

viewdist

Viewing distance in cm

lut

Look up table mapping pixel values to cd/m2

fovy

Field of view in degrees in the y-axis. It is different depending on the device. For Daydream view, it is 90 degrees, for, Daydream view 2 is 100 degrees. Default is 90.

ppd

pixels size as in pixels per degree

tracking

tracking on or off

tracktol

tolerance during tracking in degrees of visual angle

ipAddress

IP address of Octopus 600 machine

eye

eye; "right" or "left" for "Octopus900", "Octopus600"

pupilTracking

pupil tracking

pulsar

DETAILS

eyeControl

DETAILS

serverPort

port number on which server is listening for "Octopus900"

eyeSuiteSettingsLocation

dir name containing EyeSuite settings for "Octopus900"

gazeFeed

NA or a folder name for "Octopus900"

bigWheel

FALSE (standard machine), TRUE for modified apeture wheel for "Octopus900"

pres_buzzer

0 (no buzzer),1, 2, 3 (max volume) for "Octopus900"

resp_buzzer

0 (no buzzer),1, 2, 3 (max volume) for "Octopus900"

zero_dB_is_10000_asb

Is 0 dB 10000 apostilb (TRUE) or or 4000 (FALSE) for "Octopus900"

sd

standard deviation for the Gaussian

display

Dimensions of plot area (-x,+x,-y,+y) to display stim. No display if NULL. For "SimHenson", "SimHensonRT", "SimGaussian", "SimNo", "SimYes"

maxStim

Maximum stimulus value in cd/m^2 used for db <-> cd/m^2 conversions for "SimHenson", "SimHensonRT", "SimGaussian"

type

N|G|C for the three Henson params for "SimHenson", "SimHensonRT". Type 'X' to specify your own A and B values (eg different dB scale)

A

parameter A for "SimHenson", "SimHensonRT"

B

parameter B for "SimHenson", "SimHensonRT"

cap

dB value for capping stdev form Henson formula for "SimHenson", "SimHensonRT"

rtData

data.frame with colnames == "Rt", "Dist", "Person" for "SimHensonRT"

rtFP

response time for false positives ??? for "SimHensonRT"

Details

Compass

opiInitialize(ip, port)

If the chosen OPI implementation is Compass, then you must specify the IP address and port of the Compass server.

  • ip is the IP address of the Compass server as a string.

  • port is the TCP/IP port of the Compass server as a number. Warning: this returns a list, not a single error code.

Display

opiInitialize((width, height, ppi, viewdist, lut = .OpiEnv$Display$LUT) )

If the chosen OPI implementation is Display, then you can specify the limits of the plot area and the background color of the plot area. Note that this assumes link{X11()} is available on the platform.

We need to know the physical dimensions of the screen and the window generated in order to calculate stimulus position and size in degrees of visual angle. The physical dimensions in inches are calculated from width, height, and ppi. The pixel size pix per degree is then obtained using viewdist. A gamma function for the screen should be obtained and its lut passed to convert from luminance in cd/m2 to 8-bit pixel value (256 levels).

Value

Returns NULL if initialization succeeded, otherwise an implementation-dependent error.

Compass

Returns a list with elements: * err NULL if successful, not otherwise. * prl a pair giving the (x,y) in degrees of the Preferred Retinal Locus detected in the initial alignment. * onh a pair giving the (x,y) in degrees of the ONH as selected by the user. * image raw bytes being the JPEG compressed infra-red image acquired during alignment.

Display

Always returns NULL.

Daydream

Always returns NULL.

imo

Always returns NULL. Will stop if there is an error.

Kowa AP-7000

Always returns NULL.

Octopus600

Returns NULL if successful, or an Octopus 600 error code. The default background and stimulus setup is to white-on-white perimetry.

Octopus900

Returns NULL if successful, 1 if Octopus900 is already initialised by a previous call to opiInitialize, and 2 if some error occurred that prevented initialisation. The default background and stimulus setup is to white-on-white perimetry. Use opiSetBackground to change the background and stimulus colors.

PhoneHMD

Returns NULL if connection is made, otherwise, it returns a text with the error.

Daydream

opiInitialize(ip="127.0.0.1", port=50008, lut= seq(0, 400, length.out = 256), fovy = 90)

If the chosen OPI implementation is Daydream, then you must specify the IP address of the Android phone that is in the Daydream, and the port on which the server running on the phone is listening.

  • ip is the IP address of the Daydream server as a string

  • port is the TCP/IP port of the Daydream server as a number

  • lut is a vector of 256 luminance values, with lut[i] being the cd/\mbox{m}^2 value for grey level i. Default is seq(0, 4000, length.out = 256)

  • fovy Field of view in degrees in the y-axis. It is different depending on the device. For Daydream view, it is 90 degrees, for, Daydream view 2 is 100 degrees. Default is 90.

imo

opiInitialize(ip, port, ppd = 16, tracking = FALSE, tracktol = 2)

If the chosen OPI implementation is imo, then you must specify the IP address and port of the imo server.

* \code{ip} is the IP address of the imo server as a string.
* \code{port} is the TCP/IP port of the imo server as a number.
* \code{ppd} Pixel size in pixels per degree. Default is 16 ppd.
* \code{tracking} Whether to use tracking during stimulus presentation. Default is FALSE.
* \code{tracktol} Tolerance during tracking in degrees of visual angle.  The system does not show any stimulus if eye is not within \code{tracktol} degrees of visual angle from fixation point. Default is 2 degrees.

KowaAP7000

opiInitialize(ip, port)

If the chosen OPI implementation is KowaAP7000, then you must specify the IP address and port of the AP-7000 server.

  • ipAddress is the IP address of the AP-7000 server as a string.

  • port is the TCP/IP port of the AP-7000 server as a number.

Octopus600

opiInitialize(ipAddress, eye, pupilTracking=FALSE, pulsar=FALSE, eyeControl=0)

If the chosen OPI implementation is Octopus600, then you must specify the IP address of the Octopus 600 and the eye to test.

ipAddress is the IP address of the Octopus 600 as a string.

eye must be either "left" or "right".

pupilTracking is TRUE to turn on IR illumination and set pupil black level (which happens at the first stimulus presentation).

pulsar is TRUE for pulsar stimulus, FALSE for size III white-on-white.

eyeControl * 0 is off * 1 is eye blink * 2 is eye blink, forehead rest, fixation control * 3 is eye blink, forehead rest, fixation control, fast eye movements

Octopus900

opiInitialize(serverPort=50001,eyeSuiteSettingsLocation, eye, gazeFeed=NA, bigWheel=FALSE,pres_buzzer=0, resp_buzzer=0, zero_dB_is_10000_asb=TRUE)

If the chosen OPI implementation is Octopus900, then you must specify a directory and the eye to be tested.

serverPort is the TCP/IP port on which the server is listening (on localhost).

eyeSuiteSettingsLocation is the folder name containing the EyeSuite setting files, and should include the trailing slash.

eye must be either "left" or "right".

gazeFeed is the name of an existing folder into which the video frames of eye tracker are recorded. Set to NA for no recording.

bigWheel is FALSE for a standard Octopus 900 machine. Some research machines are fitted with an alternate aperture wheel that has 24 sizes, which are accessed with bigWheel is TRUE. The mapping from size to 'hole on wheel' is hard coded; see code for details.

If pres_buzzer is greater than zero, a buzzer will sound with each stimuli presented.

If resp_buzzer is greater than zero, a buzzer will sound with each button press (response). The volume can be one of 0 (no buzzer), 1, 2, or 3 (max volume). If both buzzers are more than zero, the maximum of the two will be used as the volume.

If zero_dB_is_10000_asb is TRUE then 0 dB is taken as 10000 apostilbs, otherwise 0 dB is taken as 4000 apostilbs.

PhoneHMD

opiInitialize(serverPort, port = 50008, lut = seq(0, 400, length.out = 256)) If the chosen OPI implementation is PhoneHMD, then you must specify the IP address of the Android PhoneHMD that is in the PhoneHMD, and the port on which the server running on the PhoneHMD is listening.

  • ip is the IP address of the PhoneHMD server as a string

  • port is the TCP/IP port of the PhoneHMD server as a number

  • lut is a vector of 256 luminance values, with lut[i] being the cd/\mbox{m}^2 value for grey level i. Default is seq(0, 4000, length.out = 256)

SimGaussian

opiInitialize(sd, display=NA, maxStim=10000/pi)

If the chosen OPI implementation is SimGaussian, then sd is the standard deviation value that the simulator will use for the slope/spread of the psychometric function.

display and maxStim is as for SimHenson.

SimHenson

opiInitialize(type="C", A=NA, B=NA, cap=6, maxStim=10000/pi)

If the chosen OPI implementation is SimHenson, then type can be one of: "N", for normal patients; "G", for POAG patients; and "C", for a combination. See Table 1 in Henson et al (2000).

If type is "X" then A and B should be specified and are used in place of one of the three A/B combinations as in Henson et al (2000). cap is the maximum standard deviation value that the simulator will use for the slope/spread of the psychometric function.

If display is a vector of four numbers c(xlow, xhi, ylow, yhi), then a plot area is created of dimension xlim=range(xlow, xhi) and ylim=range(ylow, yhi) and each call to opiPresent will display a point on the area. The color of the plot area can be set with opiSetBackground, and the color of the displayed point is determined by the stimulus passed to opiPresent.

maxStim is the maximum stimuls value in cd/\mbox{m}^2. This is used in converting cd/\mbox{m}^2 to dB values, and vice versa.

SimHensonRT

opiInitialize(type="C", A=NA, B=NA, cap=6, display=NA, maxStim=10000/pi, rtData, rtFP=1:1600)

If the chosen OPI implementation is SimHensonRT, then the first six parameters are as in SimHenson, and rtData is a data frame with at least 2 columns: "Rt", reponse time; and "Dist", signifying that distance between assumed threshold and stimulus value in your units.

This package contains RtSigmaUnits or RtDbUnits that can be loaded with the commands data(RtSigmaUnits) or data(RtDbUnits), and are suitable to pass as values for rtData.

rtFp gives the vector of values in milliseconds from which a response time for a false positive response is randomly sampled.

References

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

chooseOpi, opiSetBackground, opiClose, opiPresent

Examples

## Not run: 
  # Set up the Compass
  chooseOpi("Compass")
  result <- opiInitialize(ip="192.168.1.7", port=44965)
  if (is.null(result$err))
    print(result$prl)

## End(Not run)
## Not run: 
  # Set up a Display and wait for a key press in it.
  chooseOpi("Display")
  if (!is.null(opiInitialize(width = 1680, height = 1050, ppi = 128, viewdist = 25)))
    stop("opiInitialize failed")

  opiSetBackground(lum = 100, color = "white", fixation = "Circle")

  opiClose()

## End(Not run)
## Not run: 
  # Set up the imo
  chooseOpi("imo")
  opiInitialize(ip = "192.168.1.7", port = 1234)

## End(Not run)
## Not run: 
  # Set up the Kowa AP-7000
  chooseOpi("KowaAP7000")
  opiInitialize(ip="192.168.1.7", port=44965)

## End(Not run)
## Not run: 
  # Set up the Octopus 900
  chooseOpi("Octopus900")
  if (!is.null(opiInitialize(
       eyeSuiteSettingsLocation="C:/ProgramData/Haag-Streit/EyeSuite/",
       eye="left")))
    stop("opiInitialize failed")

## End(Not run)
# Set up a simulation using a psychometric function that is
# a cumulative gaussian of standard deviation 2
chooseOpi("SimGaussian")
if (!is.null(opiInitialize(sd=2)))
  stop("opiInitialize failed")
# Set up a simple simulation for white-on-white perimetry
chooseOpi("SimHenson")
if (!is.null(opiInitialize(type="C", cap=6)))
  stop("opiInitialize failed")

# Set up a simple simulation for white-on-white perimetry
# and display the stimuli in a plot region
chooseOpi("SimHenson")
if (!is.null(opiInitialize(type="C", cap=6)))
  stop("opiInitialize failed")
# Set up a simple simulation for white-on-white perimetry
# and display the stimuli in a plot region and simulate response times
chooseOpi("SimHensonRT")
data(RtSigmaUnits)
oi <- opiInitialize(type="C", cap=6, display=NA, rtData=RtSigmaUnits, rtFP=1:100)
if (!is.null(oi))
  stop("opiInitialize failed")

OPI documentation built on Nov. 7, 2023, 9:06 a.m.