mergeSpatialAnnotations.Rd
Merges the spatial extent of two or more spatial annotations into one.
mergeSpatialAnnotations(
object,
ids,
id,
tags = NULL,
tags_expand = TRUE,
concavity = 2,
remove_old = FALSE,
overwrite = FALSE
)
An object of class SPATA2
or, in case of S4 generics,
objects of classes for which a method has been defined.
Character vector of ids from spatial annotations to merge.
Character value. The ID of the new spatial annotation that results from the merging.
A character vector of tags for the spatial annotation.
Logical value. If TRUE
, the tags with which the image
annotations are tagged are expanded by the unsuffixed id
, the grouping
,
the group
and 'createGroupAnnotations'.
Numeric value. Given to argument concavity
of
concaveman::concaveman()
. Determines the relative measure of concavity.
1 results in a relatively detailed shape, Infinity results in a convex hull.
You can use values lower than 1, but they can produce pretty crazy shapes.
Logical value. If TRUE
, the old spatial annotations
denoted in ids
are removed from the object.
Logical value. Must be TRUE
to allow overwriting.
The updated input object, containing the added, removed or computed results.
library(SPATA2)
library(tidyverse)
object <- loadExampleObject("UKF275T")
r <- getSpatAnnRange(object, id = "img_ann_1")
plotImage(object) +
ggpLayerSpatAnnOutline(object, ids = c("vessel2", "img_ann_1"), use_colors = T)
plotImage(object, xrange = r$x, yrange = r$y) +
ggpLayerSpatAnnOutline(object, ids = c("vessel2", "img_ann_1"), use_colors = T)
object <-
mergeSpatialAnnotations(
object = object,
ids = c("img_ann_1", "vessel2"),
id = "new_img_ann",
)
plotSpatialAnnotations(object)