File: SpatialExperiment-rotate-mirror.Rd

package info (click to toggle)
r-bioc-spatialexperiment 1.16.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,648 kB
  • sloc: makefile: 2
file content (110 lines) | stat: -rw-r--r-- 4,545 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/SpatialExperiment-rotate-mirror.R
\name{SpatialExperiment-rotate-mirror}
\alias{SpatialExperiment-rotate-mirror}
\alias{rotateCoords}
\alias{mirrorCoords}
\alias{rotateObject}
\alias{mirrorObject}
\alias{rotateCoords,SpatialExperiment-method}
\alias{mirrorCoords,SpatialExperiment-method}
\alias{rotateObject,SpatialExperiment-method}
\alias{mirrorObject,SpatialExperiment-method}
\title{Methods for spatial attributes}
\usage{
\S4method{rotateCoords}{SpatialExperiment}(x, sample_id = NULL, degrees = 90, warn = TRUE)

\S4method{mirrorCoords}{SpatialExperiment}(x, sample_id = NULL, axis = c("h", "v"), warn = TRUE)

\S4method{rotateObject}{SpatialExperiment}(x, sample_id = NULL, image_id = NULL, degrees = 90)

\S4method{mirrorObject}{SpatialExperiment}(x, sample_id = NULL, image_id = NULL, axis = c("h", "v"))
}
\arguments{
\item{x}{A \code{\link{SpatialExperiment}} object.}

\item{sample_id}{Logical value or character vector specifying sample
identifier(s) for \code{scaleFactors}. Default = \code{TRUE} (all samples).}

\item{degrees}{single numeric 
in +/-[0,90,...,360] specifying how many degrees to rotate.
A negative/positive value corresponds to counter-/clockwise rotation.
Applicable for \code{rotateCoords} and \code{rotateObject} methods.}

\item{warn}{Logical value indicating whether to print a warning about
mismatches between coordinates and images, possible with the spatialCoords
transformation methods \code{rotateCoords} and \code{mirrorCoords}.}

\item{axis}{character string specifying whether to mirror 
horizontally (\code{"h"}) or vertically (\code{"v"}). Applicable for
\code{mirrorCoords} and \code{mirrorObject} methods.}

\item{image_id}{Logical value or character vector specifying image
identifier(s) for \code{scaleFactors}. Default = \code{TRUE} (all images).}
}
\value{
Return value varies depending on method, as described below.
}
\description{
The \code{\link{SpatialExperiment}} class provides methods to rotate and
mirror \code{\link{SpatialExperiment}} objects and their
\code{spatialCoords}.
}
\details{
Additional details for each type of data attribute are provided below.
}
\section{spatialCoords transformation methods}{

\describe{
\item{\code{rotateCoords(x, sample_id, degrees, warn)}: }{
  Apply a rotation to the \code{spatialCoords} of \code{x}, potentially
  subsetted to sample \code{sample_id} (or without subsetting if
  \code{sample_id} is \code{NULL}), by the specified number of \code{degrees}
  clockwise. Warn about mismatches with images if \code{warn}.}
\item{\code{mirrorCoords(x, sample_id, axis, warn)}: }{
  Reflect the \code{spatialCoords} of \code{x} across either the horizontal
  or vertical axis, specified by supplying "h" or "v" to the \code{axis}
  argument, respectively. Subset \code{x} to just the sample
  \code{sample_id}, if not \code{NULL}. Warn about mismatches with images if
  \code{warn}.}
}
}

\section{SpatialExperiment transformation wrapper methods}{

\describe{
\item{\code{rotateObject(x, sample_id, image_id, degrees)}: }{
  Apply a rotation to the \code{\link{spatialCoords}} and
  \code{\link{imgData}} of
  \code{x}, potentially subsetted to sample \code{sample_id} (or without
  subsetting if \code{sample_id} is \code{NULL}), by the specified number of
  \code{degrees} clockwise. Wrapper around \code{rotateCoords} and
  \code{rotateImg}.}
\item{\code{mirrorObject(x, sample_id, image_id, axis)}: }{
  Reflect the \code{\link{spatialCoords}} and \code{\link{imgData}} of \code{x} across
  either the horizontal or vertical axis, specified by supplying "h" or "v"
  to the \code{axis} argument, respectively. Subset \code{x} to just the
  sample \code{sample_id}, if not \code{NULL}. Wrapper around
  \code{mirrorCoords} and \code{mirrorImg}.}
}
}

\examples{
example(read10xVisium)

# 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")
}
\author{
Nicholas J. Eagles
}