Skip to contents

Create a polygon ROI

Usage

at_roi_polygon(
  coords,
  label,
  level = 0L,
  hole = NULL,
  ...,
  call = rlang::caller_env()
)

Arguments

coords

Either a two-column numeric matrix of exterior-ring vertices, or a list of such matrices where the first is the exterior ring and any others are holes. Rings are closed automatically.

label

Single string class label.

level

Integer pyramid level the coordinates refer to. Default 0.

hole

Optional list of two-column matrices giving additional holes, combined with any holes supplied via coords.

...

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

sq <- matrix(c(0, 0, 10, 0, 10, 10, 0, 10), ncol = 2, byrow = TRUE)
r <- at_roi_polygon(sq, label = "region")