Skip to contents

A freehand trace is stored as a closed polygon, optionally simplified.

Usage

at_roi_freehand(
  coords,
  label,
  level = 0L,
  simplify = 0,
  ...,
  call = rlang::caller_env()
)

Arguments

coords

Two-column numeric matrix of vertices in drawing order.

label

Single string class label.

level

Integer pyramid level the coordinates refer to. Default 0.

simplify

Non-negative Douglas-Peucker tolerance (dTolerance) applied to the closed polygon. 0 (default) keeps every vertex.

...

Additional named attributes stored on the ROI. The reserved names author, source, and id set those fields; all others become user attributes.

call

The calling environment, for error reporting.

Value

An annot_roi with POLYGON geometry.

Examples

pts <- cbind(c(0, 5, 10, 5), c(0, 2, 0, -2))
r <- at_roi_freehand(pts, label = "trace")