Simulate spatial tissue domains with challenging geometry
Source:R/spatial_graph_refinement.R
simulate_spatial_domains.RdGenerates irregular 2D tissue sections or 3D tissue volumes with known domain labels and corrupted initial cluster assignments.
Usage
simulate_spatial_domains(
n = 50000L,
pattern = c("jagged_stripes", "wavy_layers", "rings", "spiral", "branching", "lobes",
"islands", "disconnected", "thin_layers", "intermixed", "layers3d"),
k = 5L,
noise = 0.2,
dimensions = if (identical(pattern[1L], "layers3d")) 3L else 2L,
samples = 1L,
noise_type = c("random", "boundary", "patch", "region"),
feature_scale = 1,
density_profile = c("uniform", "moderate", "strong", "extreme", "hotspot"),
seed = 1L
)Arguments
- n
Number of observations.
- pattern
Domain geometry. See Details.
- k
Number of tissue domains.
- noise
Fraction of initial labels to corrupt. Each true class present in a specimen retains one correct exemplar; a rate that makes this impossible is rejected.
- dimensions
Either 2 or 3. Pattern `layers3d` requires 3.
- samples
Number of independent slides or samples.
- noise_type
One of `"random"`, `"boundary"`, `"patch"`, or `"region"`.
- feature_scale
Relative width of islands and thin layers. Values below one create more difficult sub-neighborhood structures.
- density_profile
Relative observation concentration across tissue regions. Use `"uniform"`, `"moderate"`, `"strong"`, `"extreme"`, `"hotspot"`, or a positive numeric vector of length `k`. Character profiles permute region weights reproducibly to avoid tying density to a particular class identifier.
- seed
Random seed.