Per-value statistics of a mask
Usage
at_mask_stats(mask, pixel_size = NULL, call = rlang::caller_env())Value
A tibble::tibble with one row per mask value: value, label,
n_px, area_px, area_physical, frac_total, bounding box
(bbox_xmin, bbox_ymin, bbox_xmax, bbox_ymax), and centroid
(centroid_x, centroid_y). A 0-row tibble when the mask is empty.
Examples
at_mask_stats(at_mask(at_example_project(), "labelled"))
#> # A tibble: 3 × 12
#> value label n_px area_px area_physical frac_total bbox_xmin bbox_ymin
#> <int> <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 tumour 19600 19600 NA 0.0748 120 150
#> 2 2 necrosis 72704 72704 NA 0.277 0 370
#> 3 3 stroma 34200 34200 NA 0.130 300 30
#> # ℹ 4 more variables: bbox_xmax <dbl>, bbox_ymax <dbl>, centroid_x <dbl>,
#> # centroid_y <dbl>