Skip to contents

Generates four ordered tissue areas whose reference classes are `A`, `B`, `B`, and `C`. Within the areas, a configurable minority fraction is labeled `B`, `A`, `C`, and `B`, respectively. Independent tissues are generated with separate curved boundaries and coordinate offsets.

Usage

simulate_gradient_regions(
  n = 50000L,
  minority = 0.05,
  dimensions = 2L,
  samples = 1L,
  seed = 1L,
  curvature = 0.04,
  density_profile = c("uniform", "moderate", "strong", "extreme")
)

Arguments

n

Total number of observations across all tissues.

minority

Fraction of minority labels in every area.

dimensions

Either 2 or 3 spatial dimensions.

samples

Number of independent tissues.

seed

Random seed.

curvature

Boundary waviness on the unit coordinate scale.

density_profile

Relative observation concentration across the four tissue areas. Use `"uniform"`, `"moderate"`, `"strong"`, `"extreme"`, or a positive numeric vector of length four.

Value

A `spatial_refinement_benchmark` containing `xy`, mixed `labels`, reference `truth`, `samples`, `area`, boundary indicators, and sparse-region indicators.

Examples

sim <- simulate_gradient_regions(n = 4000, minority = 0.05, samples = 2)
table(sim$area, sim$labels)
#>        
#>           A   B   C
#>   area1 950  50   0
#>   area2  50 950   0
#>   area3   0 950  50
#>   area4   0  50 950