SpatialExperiment-rotate-mirror | R Documentation |
The SpatialExperiment
class provides methods to rotate and
mirror SpatialExperiment
objects and their
spatialCoords
.
## S4 method for signature 'SpatialExperiment'
rotateCoords(x, sample_id = NULL, degrees = 90, warn = TRUE)
## S4 method for signature 'SpatialExperiment'
mirrorCoords(x, sample_id = NULL, axis = c("h", "v"), warn = TRUE)
## S4 method for signature 'SpatialExperiment'
rotateObject(x, sample_id = NULL, image_id = NULL, degrees = 90)
## S4 method for signature 'SpatialExperiment'
mirrorObject(x, sample_id = NULL, image_id = NULL, axis = c("h", "v"))
x |
A |
sample_id |
Logical value or character vector specifying sample
identifier(s) for |
degrees |
single numeric
in +/-[0,90,...,360] specifying how many degrees to rotate.
A negative/positive value corresponds to counter-/clockwise rotation.
Applicable for |
warn |
Logical value indicating whether to print a warning about
mismatches between coordinates and images, possible with the spatialCoords
transformation methods |
axis |
character string specifying whether to mirror
horizontally ( |
image_id |
Logical value or character vector specifying image
identifier(s) for |
Additional details for each type of data attribute are provided below.
Return value varies depending on method, as described below.
rotateCoords(x, sample_id, degrees, warn)
: Apply a rotation to the spatialCoords
of x
, potentially
subsetted to sample sample_id
(or without subsetting if
sample_id
is NULL
), by the specified number of degrees
clockwise. Warn about mismatches with images if warn
.
mirrorCoords(x, sample_id, axis, warn)
: Reflect the spatialCoords
of x
across either the horizontal
or vertical axis, specified by supplying "h" or "v" to the axis
argument, respectively. Subset x
to just the sample
sample_id
, if not NULL
. Warn about mismatches with images if
warn
.
rotateObject(x, sample_id, image_id, degrees)
: Apply a rotation to the spatialCoords
and
imgData
of
x
, potentially subsetted to sample sample_id
(or without
subsetting if sample_id
is NULL
), by the specified number of
degrees
clockwise. Wrapper around rotateCoords
and
rotateImg
.
mirrorObject(x, sample_id, image_id, axis)
: Reflect the spatialCoords
and imgData
of x
across
either the horizontal or vertical axis, specified by supplying "h" or "v"
to the axis
argument, respectively. Subset x
to just the
sample sample_id
, if not NULL
. Wrapper around
mirrorCoords
and mirrorImg
.
Nicholas J. Eagles
example(SpatialExperiment)
# rotateCoords(), mirrorCoords(), rotateObject(), and mirrorObject() return a
# SpatialExperiment, potentially subsetted by sample.
# Subset to just "section1"; rotate coordinates 90 degrees clockwise followed
# by a reflection across the vertical axis
spe_coords <- rotateCoords(spe, sample_id = "section1", degrees = 90)
spe_coords <- mirrorCoords(spe_coords, axis = "v")
# Subset to just "section2"; transform both the imgData() and spatialCoords()
# by a 180-degree rotation then reflection across the vertical axis
spe_wrapper <- rotateObject(spe, sample_id = "section2", degrees = 180)
spe_wrapper <- mirrorObject(spe_wrapper, axis = "v")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.