Clip an ROI to image bounds
Usage
at_clamp(roi, dims, call = rlang::caller_env())Arguments
- roi
An annot_roi.
- dims
Integer
c(width, height)bounds in pixels.- call
The calling environment, for error reporting.
Value
An annot_roi clipped to [0, width] x [0, height]. Warns if the
clip empties the geometry.
Examples
at_clamp(at_roi_rect(-5, -5, 20, 20, label = "a"), dims = c(10, 10))
#> <annot_roi> a (POLYGON)
#> id: "roi_000000006" | level: 0 | source: manual
#> bbox: [0, 0] - [10, 10]