shiftSpatialAnnotation | R Documentation |
This function moves a spatial annotation either in the x or y direction, or both. It allows for selective shifting of outer and/or inner borders of the annotation.
shiftSpatialAnnotation(
object,
id,
outer = TRUE,
inner = TRUE,
shift_x = 0,
shift_y = 0,
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. |
outer |
Logical; if TRUE, the outer border of the annotation is affected. |
inner |
Logical or numeric; if TRUE, all inner borders are affected. If a numeric value is provided, only the specified inner borders are affected. |
shift_x , shift_y |
Distance measure. The shift in the x- and/or y-direction. Negative values are also accepted. |
new_id |
Character value or |
overwrite |
Logical value. Must be |
The updated input object, containing the added, removed or computed results.
expandSpatialAnnotation()
, smoothSpatialAnnotation()
, SpatialAnnotation
library(SPATA2)
library(patchwork)
library(stringr)
data("example_data")
object <- example_data$object_UKF313T_diet
p1 <- plotImage(object) + ggpLayerSpatAnnOutline(object, ids = "necrotic_area")
plot(p1)
object <- shiftSpatialAnnotation(object, id = "necrotic_area", shift_x = "0.5mm", shift_y = "0.25mm", new_id = "na_shifted")
p2 <- plotImage(object) + ggpLayerSpatAnnOutline(object, ids = "na_shifted")
# compare both
p1 + p2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.