Skip to contents

Creates a validated benchmark object that is consumed by simulations, refinement runs, and benchmarking utilities. All fields are aligned by spot index, so every function in the package sees the same coordinates, labels, and optional evaluation masks.

Usage

spatial_benchmark(
  xy,
  labels,
  truth,
  samples = NULL,
  boundary = NULL,
  regions = NULL,
  sparse = NULL,
  name = NULL,
  metadata = list()
)

Arguments

xy

Numeric matrix containing two or three spatial coordinates per observation.

labels

Initial cluster assignments.

truth

Reference assignments used only for evaluation.

samples

Optional tissue or section identifier.

boundary

Optional logical vector marking boundary observations.

regions

Optional region identifier used for defining sparse-versus-dense accuracy when `sparse` is not supplied.

sparse

Optional logical vector marking a user-provided sparse subset.

name

Optional benchmark name.

metadata

Optional named list with provenance or scenario information.

Value

An object of class `spatial_refinement_benchmark`.

Examples

sim <- simulate_spatial_domains(n = 500, pattern = "jagged_stripes")
bench <- spatial_benchmark(
  sim$xy, sim$labels, sim$truth, sim$samples,
  boundary = sim$boundary, regions = sim$region
)