Computes and extracts the size of the area covered by the tissue.

getTissueArea(object, unit, method = "obs", img_name = activeImage(object))

Arguments

object

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

unit

Character value. Output unit. Must be one of validUnitsOfArea().

method

Character value. Defines the origin based on which the outline is computed. Either 'image' or 'obs'.

img_name

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().

Value

A vector of area measures. Length is equal to the number of tissue sections.

Examples


library(SPATA2)

## Example 1 - image based
object <- example_data$object_UKF313T_diet

object <- identifyPixelContent(object)
object <- identifyTissueOutline(object, method = "image")

plotImage(object, outline = TRUE) +
 ggpLayerAxesSI(object, unit = "mm")

getTissueArea(object, unit = "mm")

## Example 2 - coordinates based
object <- loadExampleObject("UKF313T")

object <- identifyTissueOutline(object, method = "obs")

plotSurface(object, color_by = "tissue_section") +
 ggpLayerTissueOutline(object)

area_out <- getTissueArea(object)

print(area_out)

sum(area_out)