Skip to contents

Add an ROI to a layer

Usage

sg_roi_layer_add(layer, roi, call = rlang::caller_env())

Arguments

layer

An sg_roi_layer.

roi

An sg_roi.

call

The calling environment, for error reporting.

Value

A new sg_roi_layer with the ROI appended. The label vocabulary and colour mapping are extended if the ROI introduces a new label. A colliding ROI identifier is re-minted to preserve uniqueness. The input is unchanged.

Examples

lyr <- sg_roi_layer("tumour", labels = "tumour")
lyr <- sg_roi_layer_add(lyr, sg_roi_rect(0, 0, 10, 10, label = "tumour"))
sg_roi_layer_n(lyr)
#> [1] 1