makeROIs: Create regions of interest (ROIs) for itrackR object

Description Usage Arguments Value See Also Examples

Description

Create regions of interest (ROIs) for an itrackR object. ROIs can be circular, elliptical, or polygons. After creating ROIs, you use calcHits to determine whether each fixation/saccade fell within each ROI. The helper functions radialCoords and roiFlower can be used to generate coordinates around some set of coordinates.

Usage

1
2
3
makeROIs(obj, coords = data.frame(x = c(0), y = c(0)), shapes = "circle",
  radius = 0, xradius = 0, yradius = 0, angles = NULL, names = NULL,
  polygon = data.frame(x = c(), y = c()), append = F)

Arguments

obj

an itrackR object

coords

data frame or matrix specifying x and y coordinates for the center of each ROI (default = (0,0), upper-left corner)

shapes

shape for each ROI listed, can be 'circle', 'ellipse', or 'polygon'

radius

for circular ROIs, radius of the circle (in pixels)

xradius

for elliptical ROIs, radius along the x dimension

yradius

for elliptical ROIs, radius along the y dimension

angles

for elliptical ROIs, rotation for each ROI in degrees.

names

optional, name for each ROI. Defaults to 1 to number of ROIs listed. ROIs should not have duplicate names!

polygon

for polygonal ROIS, data frame or matrix specifying corners of polygon

append

whether we're adding to our list of ROIs or overwriting (default = FALSE, overwrite)

Value

ROI information is stored in obj$rois. Uses the spatstat package to store ROI information. To get ROI information as a data frame, you can use the internal function roi2df. ROIs can be plotted using plot.rois.

See Also

plot.rois radialCoords roiFlower calcHits

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# itrackr.data('edfs') returns full path to 2 edf files
z <- itrackr(edfs=itrackr.data('edfs'))

coords <- matrix(c(512,384,100,100),nrow=2,byrow=T)

z <- makeROIs(z,coords,shape='ellipse',xradius=60, yradius=120, angles = c(45, 75))




## End(Not run)

jashubbard/itrackR documentation built on May 18, 2019, 4:53 p.m.