Skip to contents

ROI area

Usage

at_roi_area(
  roi,
  level = 0L,
  units = c("px", "physical"),
  call = rlang::caller_env()
)

Arguments

roi

An annot_roi.

level

Integer pyramid level at which to express the area. Default 0.

units

Either "px" (pixels squared, the default) or "physical". Physical units require a pixel_size attribute on the ROI.

call

The calling environment, for error reporting.

Value

A numeric scalar area, or NA_real_ for non-areal geometry (points, lines).

Examples

at_roi_area(at_roi_rect(0, 0, 10, 5, label = "a"))
#> [1] 50