diff --git a/man/as.points.Rd b/man/as.points.Rd index b9eff351..8d31ba60 100644 --- a/man/as.points.Rd +++ b/man/as.points.Rd @@ -3,9 +3,12 @@ \name{as.points} \alias{as.points} \alias{as.points,data.frame-method} +\alias{as.points,spatLocsObj-method} \title{Coerce to SpatVector points} \usage{ \S4method{as.points}{data.frame}(x, include_values = TRUE, specific_values = NULL) + +\S4method{as.points}{spatLocsObj}(x, ...) } \arguments{ \item{x}{SpatRaster, SpatVector, SpatExtent, or correctly formatted diff --git a/man/relate.Rd b/man/relate.Rd new file mode 100644 index 00000000..06040438 --- /dev/null +++ b/man/relate.Rd @@ -0,0 +1,52 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/methods-relate.R +\name{relate} +\alias{relate} +\alias{relate,giottoSpatial,giottoSpatial-method} +\title{Spatial relationships between geometries} +\usage{ +\S4method{relate}{giottoSpatial,giottoSpatial}( + x, + y, + relation, + pairs = TRUE, + na.rm = TRUE, + output = c("data.table", "list", "matrix"), + use_names = TRUE, + ... +) +} +\arguments{ +\item{x}{spatial object with records to test} + +\item{y}{spatial object records to test relations against} + +\item{relation}{character. One of "intersects", "touches", "crosses", "overlaps", "within", "contains", "covers", "coveredby", "disjoint". Or a "DE-9IM" string such as "FF*FF****". See \href{https://en.wikipedia.org/wiki/DE-9IM}{wikipedia} or \href{https://docs.geotools.org/stable/userguide/library/jts/dim9.html}{geotools doc}} + +\item{pairs}{logical. If \code{TRUE} a two-column matrix is returned with the indices of the cases where the requested relation is \code{TRUE}. This is especially helpful when dealing with many geometries as the returned value is generally much smaller} + +\item{na.rm}{logical. If \code{TRUE} and \code{pairs=TRUE}, geometries in \code{x} for which there is no related geometry in \code{y} are omitted} + +\item{output}{character. \code{"data.table"} or \code{"matrix"}. \code{"data.table"} is +only possible when \code{pairs=TRUE}} + +\item{use_names}{logical. If \code{TRUE}, \code{pairs=TRUE}, and \code{output="data.table"} +the IDs of the geometries will be used.} + +\item{...}{additional args to pass} +} +\value{ +\code{data.table} if \code{output="data.table"}. \code{matrix} if \code{output="matrix"} +} +\description{ +\code{relate()} returns a logical matrix indicating the presence or +absence of a specific spatial relationships between the geometries in +x and y. +} +\examples{ +sl <- GiottoData::loadSubObjectMini("spatLocsObj") +gpoints <- GiottoData::loadSubObjectMini("giottoPoints") +gpoly <- GiottoData::loadSubObjectMini("giottoPolygon") + +relate(gpoints, gpoly, relation = "intersects") +} diff --git a/man/replace_bracket.Rd b/man/replace_bracket.Rd index 1407978f..acdb92c4 100644 --- a/man/replace_bracket.Rd +++ b/man/replace_bracket.Rd @@ -35,6 +35,8 @@ \alias{[<-,giottoPolygon,missing,missing,ANY-method} \alias{[<-,giottoPolygon,missing,missing,} \alias{[<-,giottoPolygon,missing,missing-method} +\alias{[<-,giottoLargeImage,missing,missing,ANY-method} +\alias{[<-,giottoImage,missing,missing,ANY-method} \alias{[<-,affine2d,missing,missing,ANY-method} \alias{[<-,affine2d,missing,missing,} \alias{[<-,affine2d,missing,missing-method} @@ -60,6 +62,10 @@ \S4method{[}{giottoPolygon,missing,missing,ANY}(x, i, j) <- value +\S4method{[}{giottoLargeImage,missing,missing,ANY}(x, i, j) <- value + +\S4method{[}{giottoImage,missing,missing,ANY}(x, i, j) <- value + \S4method{[}{affine2d,missing,missing,ANY}(x, i, j) <- value } \arguments{ diff --git a/man/spatQueryGiottoPolygons.Rd b/man/spatQueryGiottoPolygons.Rd index c6c885d6..58f360ac 100644 --- a/man/spatQueryGiottoPolygons.Rd +++ b/man/spatQueryGiottoPolygons.Rd @@ -39,5 +39,5 @@ information recorded in the associated cell metadata. The final item in provided in param \code{filters} is the layer of information being queried. } \seealso{ -[spatQueryGiottoSpatLocs() +\code{\link[=relate]{relate()}} } diff --git a/man/spat_binary_ops.Rd b/man/spat_binary_ops.Rd new file mode 100644 index 00000000..780c6fec --- /dev/null +++ b/man/spat_binary_ops.Rd @@ -0,0 +1,65 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/spatial_binary_ops.R +\name{spat_binary_ops} +\alias{spat_binary_ops} +\alias{+,spatialClasses,spatialClasses-method} +\alias{-,spatialClasses,spatialClasses-method} +\alias{snap,giottoSpatial-method} +\alias{symdif,spatialClasses,spatialClasses-method} +\alias{union,spatialClasses,spatialClasses-method} +\alias{intersect,spatialClasses,spatialClasses-method} +\title{Spatial binary operations} +\usage{ +# S4 methods for giottoPolygon, giottoPoints, spatLocsObj, SpatVector # + +e1 + e2 + +e1 - e2 + +snap(x, y=NULL, tolerance) + +symdif(x, y) + +union(x, y) + +intersect(x, y) +} +\arguments{ +\item{x, e1}{spatial object 1} + +\item{y, e2}{spatial object 2 (can be missing or NULL)} + +\item{tolerance}{numeric. Snapping tolerance (distance between geometries)} + +\item{...}{additional args to pass} +} +\value{ +The same class as \code{e1} or \code{x} +} +\description{ +Perform geometric binary operations on Giotto spatial classes +(\code{giottoPolygon}, \code{giottoPoints} and \code{spatLocsObj}) and underlying +representations (only terra \code{SpatVector} right now.) +} +\examples{ +gpoly1 <- GiottoData::loadSubObjectMini("giottoPolygon") +epoly <- as.polygons(ext(c(6600, 6800, -5000, -4800))) +gpoly2 <- spatShift(gpoly1, dx = 20) + +plot(gpoly1) +plot(gpoly1 - gpoly2) +plot(gpoly1 - epoly) + +plot(gpoly1 + epoly) + +plot(symdif(gpoly1, epoly)) + +plot(intersect(gpoly1, epoly)) + +if (FALSE) { + # takes a long time so don't run in checks + plot(snap(gpoly1, tolerance = 0.2)) +} + + +} diff --git a/man/subset_bracket.Rd b/man/subset_bracket.Rd index f8c67477..96e96827 100644 --- a/man/subset_bracket.Rd +++ b/man/subset_bracket.Rd @@ -39,6 +39,8 @@ \alias{[,giottoPolygon,character,missing,missing-method} \alias{[,giottoPolygon,missing,gIndex,missing-method} \alias{[,terraVectData,gIndex,gIndex,missing-method} +\alias{[,giottoLargeImage,missing,missing,missing-method} +\alias{[,giottoImage,missing,missing,missing-method} \alias{[,affine2d,missing,missing,missing-method} \title{Subset part of an object with \code{[}} \usage{ @@ -116,6 +118,10 @@ \S4method{[}{terraVectData,gIndex,gIndex,missing}(x, i, j) +\S4method{[}{giottoLargeImage,missing,missing,missing}(x, i, j) + +\S4method{[}{giottoImage,missing,missing,missing}(x, i, j) + \S4method{[}{affine2d,missing,missing,missing}(x, i, j) } \arguments{