Expands or shrinks the outer outline of a spatial annotation.

expandSpatialAnnotation(object, id, expand, new_id = FALSE, overwrite = FALSE)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

id

Character value. The ID of the spatial annotation of interest.

expand

Distance measure with which to expand the border. Negative values shrink the outline.

new_id

Character value or FALSE. If character, the resulting spatial annotation is stored under a new ID.

overwrite

Logical value. Must be TRUE to allow overwriting.

Value

The updated input object, containing the added, removed or computed results.

Examples


library(SPATA2)
library(tidyverse)

data("example_data")

object <- loadExampleObject("UKF275T")

plotImage(object) + ggpLayerSpatAnnOutline(object, ids = "vessel1", line_color = "red")
plotSpatialAnnotations(object, "vessel1")

object <- expandSpatialAnnotation(object, id = "vessel1", expand = "50um", new_id = "vessel1_exp")

plotSpatialAnnotations(object, ids = c("vessel1", "vessel1_exp"))