Transform an ROI between pyramid levels using real image dimensions
Source:R/geometry.R
at_transform.RdUnlike at_roi_rescale() (which assumes a power-of-two pyramid), this uses
the actual level dimensions of an annot_image, so it is exact for pyramids
with any downsampling ratio.
Usage
at_transform(roi, from_level, to_level, img, call = rlang::caller_env())Arguments
- roi
An annot_roi.
- from_level, to_level
Integer source and target pyramid levels.
- img
The annot_image whose pyramid defines the level dimensions.
- call
The calling environment, for error reporting.
Value
An annot_roi with coordinates at to_level. Exactly invertible.
Examples
img <- at_example_image("multiplex")
r <- at_roi_rect(0, 0, 100, 100, label = "a")
at_transform(r, from_level = 0, to_level = 2, img = img)
#> <annot_roi> a (POLYGON)
#> id: "roi_000000079" | level: 2 | source: manual
#> bbox: [0, 0] - [25, 25]