Return a tidy table of ROIs, optionally filtered by layer and/or label.
Usage
sg_roi_rois(project, layer = NULL, label = NULL, call = rlang::caller_env())Arguments
- project
An sg_roi_project.
- layer
Optional single layer name to filter to.
- label
Optional character vector of labels to filter to.
- call
The calling environment, for error reporting.
Value
A tibble::tibble with one row per ROI and, in this exact order, the columns:
roi_idUnique identifier (character).
layerLayer name (character).
labelClass label (character).
geom_typeGeometry type, e.g.
"POLYGON"(character).levelReference pyramid level (integer).
area_pxArea in level-0 pixels (double);
NAfor points/lines.centroid_x,centroid_yCentroid at level 0 (double).
n_verticesVertex count (integer).
created,modifiedTimestamps (POSIXct).
authorAuthor (character).
sourceProvenance source (character).
geometryThe
sfgeometry column (sfc), at level 0.
Returns a 0-row tibble with these columns if no ROIs match.
Details
Coordinates in the geometry column, together with area_px and the
centroid, are expressed at pyramid level 0; the level column records the
level at which each ROI was originally defined.
Examples
lyr <- sg_roi_layer_add(sg_roi_layer("tissue"),
sg_roi_rect(2, 2, 8, 8, label = "tissue"))
proj <- sg_roi_project(sg_roi_frame(c(20, 20)), lyr)
sg_roi_rois(proj)
#> # A tibble: 1 × 14
#> roi_id layer label geom_type level area_px centroid_x centroid_y n_vertices
#> <chr> <chr> <chr> <chr> <int> <dbl> <dbl> <dbl> <int>
#> 1 roi_0000… tiss… tiss… POLYGON 0 36 5 5 5
#> # ℹ 5 more variables: created <dttm>, modified <dttm>, author <chr>,
#> # source <chr>, geometry <POLYGON>