View source: R/geometry_operation.R
crop | R Documentation |
Returns an SFE object whose specified colGeometry
returns TRUE
with a geometric predicate function (usually intersects) with another
geometry of interest. This can be used to subset an SFE object with a tissue
boundary or histological region polygon, or crop away empty spaces. After
cropping, not only will the cells/spots be subsetted, but also all geometries
will be cropped.
crop(
x,
y = NULL,
colGeometryName = 1L,
sample_id = "all",
pred = deprecated(),
op = st_intersection,
keep_whole = "none",
cover = FALSE,
xmin = deprecated(),
xmax = deprecated(),
ymin = deprecated(),
ymax = deprecated()
)
x |
An SFE object. |
y |
An object of class |
colGeometryName |
Column geometry to used to indicate which cells/spots to keep. |
sample_id |
Samples to crop. Optional when only one sample is present.
Can be multiple samples, or "all", which means all samples. For multiple
samples, |
pred |
Deprecated. The binary predicate is now tied to the geometric
operation specified in |
op |
A geometric operation function to crop the geometries in the SFE
object. Only |
keep_whole |
Character vector, can be one or more of "col" and "annot"
to keep whole items from |
cover |
Logical, whether the geometries in |
xmin |
Deprecated. Supply the bounding box to argument |
xmax |
Deprecated. |
ymin |
Deprecated. |
ymax |
Deprecated. |
3D geometries are allowed, but geometric operations can only be performed in x and y but not z.
An SFE object. There is no guarantee that the geometries after cropping are still all valid or preserve the original geometry class.
library(SFEData)
sfe <- McKellarMuscleData("small")
# Subset sfe to only keep spots on tissue
sfe_on_tissue <- crop(sfe, tissueBoundary(sfe),
colGeometryName = "spotPoly",
sample_id = "Vis5A"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.