Ensures that the outline of a spatial annotation does not transgresses the outline of the tissue.

mergeWithTissueOutline(object, id, new_id)

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 whose outline is supposed to be cut at the tissue edge.

new_id

If character, gives the resulting spatial annotation a new id. If NULL, the spatial annotation is overwritten!

Value

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

Examples

library(SPATA2)

data("example_data")

object <- loadExampleObject("UKF313T")

if(!containsTissueOutline(object)){

  object <- identifyTissueOutline(object)

}

# image annotation which transgresses the tissue edge
plotSpatialAnnotations(object, ids = c("necrotic_edge2_transgr"))

object <-
  mergeWithTissueOutline(object, id = "necrotic_edge2_transgr", new_id = "necrotic_edge2", overwrite = TRUE)

plotSpatialAnnotations(object, ids = c("necrotic_edge2_transgr", "necrotic_edge2"))