Skip to contents

Write a mask to disk

Usage

at_write_mask(
  mask,
  path,
  format = c("tiff", "png", "rds"),
  bits = c(16L, 8L),
  legend = TRUE,
  overwrite = FALSE,
  call = rlang::caller_env()
)

Arguments

mask

An annot_mask.

path

Output file path.

format

"tiff" (default), "png" (8-bit only), or "rds" (full-fidelity annot_mask).

bits

Integer bit depth for TIFF: 16 (default) or 8.

legend

Logical; also write a <path>.legend.json sidecar describing the mask. Default TRUE.

overwrite

Logical; overwrite an existing file. Default FALSE.

call

The calling environment, for error reporting.

Value

The output path, invisibly.

Examples

m <- at_mask(at_example_project(), "labelled")
f <- tempfile(fileext = ".tif")
at_write_mask(m, f)