smoothSpatialAnnotation | R Documentation |
This function applies a smoothing algorithm to the borders of a
SpatialAnnotation
object. It can smooth both outer and inner borders using various methods.
smoothSpatialAnnotation(
object,
id,
method,
outer = TRUE,
inner = TRUE,
new_id = FALSE,
overwrite = FALSE,
...
)
object |
An object of class |
id |
Character value specifying the ID of the spatial annotation of interest. If there is only one spatial annotation in the object, the function will default to using it. However, if there are multiple annotations, this argument must be explicitly specified to identify the target annotation. |
method |
The smoothing method to be applied. Options include "chaikin", "densify", "ksmooth", and "spline". |
outer |
Logical; if TRUE, the outer border of the annotation is smoothed. |
inner |
Logical or numeric; if TRUE, all inner borders are smoothed. If a numeric value is provided, only the specified inner border is smoothed. |
new_id |
Character value or |
overwrite |
Logical value. Must be |
... |
Additional arguments passed to the smoothing function |
The updated input object, containing the added, removed or computed results.
Requires the package 'terra' and 'smoothr'.
expandSpatialAnnotation()
, shiftSpatialAnnotation()
, SpatialAnnotation
library(SPATA2)
data("example_data")
object <- example_data$object_UKF313T_diet
ids <- getSpatAnnIds(object, tags = c("necrotic", "compr"), test = "identical")
plotSpatialAnnotations(object, ids = "necrotic_edge")
object <-
smoothSpatialAnnotation(object, id = "necrotic_edge", method = "ksmooth", new_id = "necrotic_edge_sm", smoothness = 50)
plotSpatialAnnotations(object, ids = c("necrotic_edge", "necrotic_edge_sm"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.