getSpatialAnnotation | R Documentation |
Extracts object of class SpatialAnnotation
by
it's ID.
getSpatialAnnotation(object, ...)
## S4 method for signature 'SPATA2'
getSpatialAnnotation(
object,
id = idSA(object),
add_image = containsHistoImages(object),
expand = 0,
square = FALSE,
...
)
## S4 method for signature 'SpatialData'
getSpatialAnnotation(
object,
id = idSA(object),
add_image = TRUE,
expand = 0,
square = FALSE,
...
)
object |
An object of class |
... |
Used to absorb deprecated arguments or functions. |
id |
Character value specifying the ID of the spatial annotation of interest. If there is only one spatial annotation in the object, the function will default to using it. However, if there are multiple annotations, this argument must be explicitly specified to identify the target annotation. |
add_image |
Logical. If TRUE, the area of the histology image that
is occupied by the annotated structure is added to the |
expand |
Specifies image expansion. An image that is cropped based on an image
annotation centers around the image annotation. If |
square |
Logical value. Most image annotations come in variable shapes and
have different horizontal and vertical diameters. Therefore, height and width of the image
section are usually not equal. If Processing of the image output depending on argument |
An object of class SpatialAnnotation
.
The argument expand
is a versatile way, to specify how a cropped
image section is extracted. If you want the cropped image as is, specify
expand = 0
. Else, there are multiple options. In general, expand
takes
three kinds of values, namely percentages, distances and distance exclamations.
Percentage: A string suffixed with %. E.g. expand = '50%'
adds 50% of the distance from the center to the border of the image annotation
to the image frame.
Distance measures: In pixel or European units of length. E.g. expand = list(x = '1mm')
expands the x-axis on both sides with 1mm. expand = list(x = c('0.5mm', 1.5mm')
expands the x-axis on the left side with 0.5mm and on the right side with 1.5mm.
Exclam distance measures: Distance measure with an exclamation mark
suffix. E.g. expand = '1mm!'
centers the image and forces an axis length of
1 millimeter. (Example 5)
Depending on how the values are specified different parts of the image can be expanded.
Single values, like expand = 50
, are recycled: Every end of each image axis
is expanded by 50 pixel. (Example 2)
Vectors of length two, like expand = c('1mm', '2mm')
, are recycled: The beginning
of each axis is expanded by 1 millimeter. The end of each axis is expanded by
2mm. (Example 3)
Named lists can be more precise. expand = list(x = c('1mm', '0.5mm'), y = c('0.25mm', '1mm'))
.
Applies the vectors to expand the corresponding axis. (Example 4)
Using exclam input the side of the axis must not be specified as the
axis is fixed as a whole. E.g expand = list(x = '1mm!', y = '2mm!')
results
in the same output as expand = list(x = c('1mm!', '1mm!'), y = c('2mm!', '2mm!')
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.