| SpatialAnnotation-class | R Documentation |
SpatialAnnotation - ClassS4 class that represents annotations for spatial data, allowing users to define and store polygons that outline areas of interest within images or datasets. It serves as the overarching class for different spatial annotation methods.
The following classes are derivatives of this class: GroupAnnotation,
ImageAnnotation, NumericAnnotation
arealist. A named list of data.frames with the numeric variables x_orig and y_orig. Observations correspond to the vertices of the polygons that are needed to represent the spatial annotation. Must contain a slot named outer which sets the outer border of the spatial annotation. Can contain multiple slots named inner (suffixed) with numbers that correspond to inner polygons - holes within the annotation.
Upon extraction via getSpatAnnOutlineDf() or extraction of the whole annotation
via getSpatialAnnotation() and getSpatialAnnotations() the variables x and y
are created by scaling x_orig and y_orig to the current resolution of the
active image to ensure alignment. This is achieved by using the coords scale factor
of the listslot @scale_factors of the HistoImage object of the active image.
idcharacter. String to identify the object in a list of multiple objects of the same class.
imageA cropped version of an image that focuses solely on the area containing the
annotation, along with an expansion margin. This slot is designed to remain
empty until the annotation object is explicitly extracted or used, contributing to efficient
data storage. Extraction through functions like getSpatialAnnotation() or
getSpatialAnnotation() populates this slot with the cropped image. The parameters
used for cropping the image are stored in the @image_info slot.
image_infoA list containing information related to the image stored in the @image slot.
This information pertains to the cropped image obtained and set using functions like
getSpatialAnnotation() or getSpatialAnnotations(). It serves as metadata
around the cropped image and may include parameters or details about the cropping process.
misclist. A flexible list for miscellaneous input such as meta data or to implement new ideas..
sampleCharacter string. The sample to which the annotation belongs.
tagscharacter. Vector of arbitrary length. Contains tags that can be used to group and select spatial annotations in different manners.
versionA list of three slots denoting the version of SPATA2 under
which the object has been created.
Selection of spatial annotations via the arguments ids, class, tags and
test works in three steps:
First, if ids is a character it prefilters the annotations by ID and only
the specified ones are submitted to the next steps. If it is NULL, all
annotations are submitted to the next steps.
Secondd, if class is a character it filters the annotations remaining
after the first step by their class. If NULL, the step is skipped.
Third, if tags is a character it is used in combination with test to select
from the spatial annotations that remain after the second step based on the meta data
they are tagged with. There are multiple options:
Argument test set to 'any' or 1: To be included, an image annotation
must be tagged with at least one of the input tags.
Argument test set to 'all' or 2: To be included, an image annotation
must be tagged with all of the input tags. Can contain tags that are not specified.
Argument test set to 'identical' or 3: To be included, an image annotation
must be tagged with all of the input tags. Can not be tagged with anything else.
Argument test set to not_identical or 4: To be included, an image
annotation must not be tagged with the combination of input tags.
Argument test set to 'none' or 5: To be included, an image annotation
must not contain any of the input tags.
If tags is NULL, the step is skipped. Therefore, if ids, class and tags
are all NULL, which is the default, all annotations are selected as all subsetting
steps are skipped. Eventually, the remaining spatial annotations are submitted to
whatever the respective function does.
The following functions can be used to create spatial annotations:
addSpatialAnnotation(): Based on polygon input.
barcodesToSpatialAnnotation():Based on the spatial extent of a
set of data points identified by the input barcodes.
createGroupAnnotations(): Based on the spatial extent of one or more
groups of data points. Uses barcodesToSpatialAnnotation()
createImageAnnotations(): Based on interactive drawing
on images.
createNumericAnnotations(): Based on the expression of numeric
features such as gene expression, read counts, copy number alterations, etc.
Uses barcodesToSpatialAnnotation()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.