Skip to contents

Stack per-layer masks into a 3D array

Usage

sg_roi_mask_stack(
  project,
  layers = NULL,
  level = 0L,
  call = rlang::caller_env()
)

Arguments

project

An sg_roi_project.

layers

Optional layer name(s) to include; all by default.

level

Integer pyramid level. Default 0.

call

The calling environment, for error reporting.

Value

A 3D integer array [y, x, layer], one multi-class plane per layer; the third dimension is named by layer.

Examples

tumour <- sg_roi_layer_add(sg_roi_layer("tumour"),
                           sg_roi_rect(2, 2, 8, 8, label = "tumour"))
stroma <- sg_roi_layer_add(sg_roi_layer("stroma"),
                           sg_roi_rect(10, 10, 18, 18, label = "stroma"))
proj <- sg_roi_project(sg_roi_frame(c(20, 20)), list(tumour, stroma))
dim(sg_roi_mask_stack(proj))
#> [1] 20 20  2