buffer_area.Rd
Buffers the area of a polygon.
buffer_area(df, buffer, close_plg = TRUE)
Data.frame with variables x and y describing the
vertices of the polygon that encircles the area based on which the barcode-spots
are binned. E.g. slot @area of ImageAnnotation
-objects. Note that the order of
observations in the data.frame must correspond to the order of vertices
of the polygon.
The distance by which to consecutively expand the
area that covers the image annotation screening. Given to argument
dist
of function sf::st_buffer()
.
library(ggplot2)
object <- downloadSpataObject("313_T")
object <- setImageAnnotation(object, img_ann = image_annotations[["313_T"]][["necrotic_center"]])
outline1 <- getImgAnnOutlineDf(object, ids = "necrotic_center")
print(outline1)
outline2 <- buffer_area(outline1, buffer = 20)
print(outline2)
plotSurface(object) +
geom_polygon(data = outline1, mapping = aes(x = x, y = y), color = "black", fill = NA, size = 2) +
geom_polygon(data = outline2, mapping = aes(x = x, y = y), color = "red" , fill = NA, size = 2)