Skip to contents

Pairwise ROI overlaps within a layer

Usage

sg_roi_rois_overlap(layer, call = rlang::caller_env())

Arguments

layer

An sg_roi_layer.

call

The calling environment, for error reporting.

Value

A tibble::tibble with columns id_a, id_b (character), overlap_px (double, level-0 pixels), and jaccard (double). A 0-row tibble with these columns when no ROIs overlap.

Examples

lyr <- sg_roi_layer_add(sg_roi_layer("cells"),
                        sg_roi_rect(0, 0, 4, 4, label = "cell"))
lyr <- sg_roi_layer_add(lyr, sg_roi_rect(2, 2, 6, 6, label = "cell"))
sg_roi_rois_overlap(lyr)
#> # A tibble: 1 × 4
#>   id_a          id_b          overlap_px jaccard
#>   <chr>         <chr>              <dbl>   <dbl>
#> 1 roi_000000046 roi_000000047          4   0.143