% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/R-layer.R
\name{create_all_layers}
\alias{create_all_layers}
\title{Create and visualize layers for multiple clusters}
\usage{
create_all_layers(
  df,
  clusters = NULL,
  k = 6,
  max_dist = NULL,
  intermediate_quantile = 0.5,
  coord_cols = c("x", "y"),
  cluster_col = "cluster"
)
}
\arguments{
\item{df}{A data.frame containing at least coordinate and cluster columns.}

\item{clusters}{Optional vector of cluster labels to process. If `NULL`,
all unique clusters are used.}

\item{k}{Integer. Number of nearest neighbors to consider. Default is 6.}

\item{max_dist}{Optional numeric. Maximum Euclidean distance for neighbors.}

\item{intermediate_quantile}{Numeric between 0 and 1. The quantile of
distances to border
  used to define the intermediate layer threshold. Default is 0.5 (median).}

\item{coord_cols}{Character vector of length 2 giving the coordinate column
names.
  Default is `c("x","y")`.}

\item{cluster_col}{Character. Name of the column containing cluster labels.
Default is `"cluster"`.}
}
\value{
A data.frame combining all processed clusters with the `layer` column
added.
}
\description{
Batch create layer classifications for multiple clusters and optionally
generate individual plots for each cluster.
}
\examples{
data("visiumHD_16um_simulated_spe", package = "Battlefield")
spe <- visiumHD_16um_simulated_spe
df <- data.frame(
  spot_id = colnames(spe),
  x = SpatialExperiment::spatialCoords(spe)[, 1],
  y = SpatialExperiment::spatialCoords(spe)[, 2],
  cluster = SummarizedExperiment::colData(spe)$cluster
)
all_layers <- create_all_layers(df, k = 6, intermediate_quantile = 0.5)
head(all_layers)

}
