ggpLayerTissueOutline.Rd
Adds a hull that outlines the tissue.
ggpLayerTissueOutline(object, ...)
# S4 method for class 'SPATA2'
ggpLayerTissueOutline(
object,
method = "obs",
img_name = activeImage(object),
by_section = TRUE,
fragments = FALSE,
line_alpha = 0.9,
line_color = "black",
line_size = 1,
line_type = "solid",
transform = TRUE,
smooth_with = "none",
scale_fct = 1,
outline_fct = c(1.75, 2.75),
expand_outline = recSgsRes(object, "px")/1.25,
...
)
# S4 method for class 'SpatialData'
ggpLayerTissueOutline(
object,
method = NULL,
img_name = activeImage(object),
by_section = TRUE,
fragments = FALSE,
line_alpha = 0.9,
line_color = "black",
line_size = 1,
line_type = "solid",
transform = TRUE,
smooth_with = "none",
scale_fct = 1,
outline_fct = c(1.75, 2.75),
expand_outline = 0,
...
)
# S4 method for class 'HistoImage'
ggpLayerTissueOutline(
object,
by_section = TRUE,
fragments = FALSE,
line_alpha = 0.9,
line_color = "black",
line_size = 1,
line_type = "solid",
transform = TRUE,
smooth_with = "chaikin",
scale_fct = 1,
expand_outline = 0,
...
)
# S4 method for class 'data.frame'
ggpLayerTissueOutline(
object,
method = "coords",
by_section = TRUE,
line_alpha = 0.9,
line_color = "black",
line_size = 1,
line_type = "solid",
outline_fct = c(1.75, 2.75),
use_scattermore = FALSE,
expand_outline = 0,
...
)
An object of class SPATA2
or, in case of S4 generics,
objects of classes for which a method has been defined.
Additional arguments given to smoothr::smooth()
depending on
the input for smooth_with
.
Character value. Either 'obs' or 'image'. Decides whether
the tissue outline used based on the observations
or the image is used. If method = NULL
, the function checks first if any HistoImage
is registered. If so, the outline from the image specified with img_name
is returned.
If there are no images, the outline computed with identifyTissueOutline(..., method = 'obs')
is used.
Character value. The name of the image of interest.
If NULL
, the active image is chosen by default. Either way, must
be one of getImageNames()
.
Logical value. If TRUE
, the outline is used which acknowledges
the potential for multiple tissue sections. If FALSE
, the outline is used which
simply outlines everything with one single polygon.
Numeric. Affects alpha of main lines of the plot.
Character. Affects color of the main lines of the plot.
Numeric. Affects size of the main lines of the plot.
Character. The line type. One of 'blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash' and 'twodash'.
Logical value. Ignored if no images exist in the object. If TRUE
,
spatial transformation instructions saved during image alignment of
the image img_name
are applied. Only relevant if there are any images registered
in the SPATA2
object.
Character vaule. Sets the method with which to smooth
the tissue outline polygon. One of c("chaikin", "densify", "ksmooth", "spline", "none")
.
If 'none', no smoothing is conducted.
Distance measure with which to expand the outline. Must be provided in pixel units!
Logical value. If TRUE
, data points are plotted with
scattermore::geom_scattermore()
which allows quick plotting of several
thousand data points. If the number of data points plotted is bigger than
10.000 it is used anyway.
Logical. If TRUE
, include tissue section outline. See examples of getTissueOutlineDf()
.
ggpLayer*()
-functions return lists of ggproto
objects
that can be added to ggplots via the +
operator. In most of the cases
they are supposed to be added to plots created with the plotSurface*()
family.
library(SPATA2)
library(tidyverse)
data("example_data")
object <- loadExampleObject("UKF275T")
plotSurface(object, color_by = "HM_HYPOXIA", pt_clrsp = "Reds 3") +
ggpLayerTissueOutline(object)
# alternative
plotSurface(object, color_by = "HM_HYPOXIA", pt_clrsp = "Reds 3", outline = TRUE)