getImgAnnArea.Rd
Computes the area of an image annotation in SI units of area.
getImgAnnArea(
object,
ids = NULL,
unit = "mm2",
tags = NULL,
test = "any",
as_numeric = TRUE,
verbose = NULL,
...
)
An object of class spata2
.
Character vector or NULL
. If character, specifies the IDs
of the image annotations of interest. If numeric, the image annotations are picked by number.
If NULL
, all image annotations are included - subsequent selection with tags
and
test
is possible.
Character value. Specifies the desired unit.
Character vector or NULL
. If character, the tags for the image annotation
selection. See section Selection of image annotation with tags for more information.
Character value. One of any. all, identical, not_identical and
none. Specifies how input for tags
is used to select image annotations.
See section Selection of image annotation with tags for more information.
Logical. If set to TRUE informative messages regarding the computational progress will be printed.
(Warning messages will always be printed.)
Used to absorb deprecated arguments or functions.
Numeric vector of the same length as ids
. Named accordingly.
Contains the area of the image annotations in the unit that is specified in unit
.
The unit is attached to the output as an attribute named unit. E.g. if
unit = *mm2*
the output value has the unit mm^2.
First, the side length of each pixel is calculated and based on that the area.
Second, the number of pixels that fall in the area given by the outer border
of the image annotation is computed with sp::point.in.polygon()
.
Third, if the image annotation contains holes the pixel that fall in these holes are removed.
Fourth, the number of remaining pixels s multiplied with the area per pixel.