Adds a hull that encircles the sample. Useful, if you want to plot numeric variables by color against white.

ggpLayerTissueOutline(
  object,
  line_color = "grey",
  line_size = 0.5,
  expand_outline = getCCD(object, "px") * 1.25,
  concavity = NULL,
  inc_outline = TRUE,
  ...
)

Arguments

object

An object of class spata2.

line_color

Character. Affects color of the main lines of the plot.

line_size

Numeric. Affects size of the main lines of the plot.

expand_outline

Distance measure by which the outline of the area is expanded.

concavity

Given to concavity of ggforce::geom_mark_hull(). Can be optimized for every sample via object <- setDefault(object, concavity = ...). Default by object initiation is 1.

inc_outline

Logical. If TRUE, include tissue section outline. See examples of getTissueOutlineDf().

...

Additional arguments given to ggforce::geom_mark_hull()

Value

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.

Distance measures

Several functions in SPATA2 have arguments that take distance input. To specifically refer to a distance the unit must be specified. There are three ways to create valid input for these arguments.

1. In pixel:

There are two valid input options to specify the distance in pixel:

  • numeric: Single numeric values, e.g. arg_input = c(2, 3.554, 69, 100.67). If no unit is specified the input will be interpreted as pixels.

  • character: Suffixed with 'px', e.g. arg_input = c('2px', '3.554px', '69px', '100.67px')

Note: The unit pixel (px) is used for distances as well as for areas. If pixel refers to a distance the pixel side length is meant. If pixel refers to an area the number of pixels is meant.

2. According to the Systeme international d`unites (SI):

Specifying distances in SI units e.g. arg_input = c('2mm', '4mm') etc. requires the input to be a character as the unit must be provided as suffix. Between the numeric value and the unit must be no empty space! Valid suffixes can be obtained using the function validUnitsOfLengthSI().

3. As vectors of class unit:

Behind the scenes SPATA2 works with the units package. Input is converted into vectors of class units. Therefore, input can be directly provided this way: arg_input = units::set_unit(x = c(2,4), value = 'mm') Note that pixel is not a valid unit in the units package. If you want to specify the input in pixel you have to use input option 1. In pixel.

Examples


object <- donwloadPubExample("MCD_LMU")

plotImageGgplot(object, unit = "mm") +
 ggpLayerTissueOutline(object, inc_outline = TRUE)

plotImageGgplot(object, unit = "mm") +
 ggpLayerTissueOutline(object, inc_outline = FALSE)