bbox-SpatialFeatureExperiment-method: Find bounding box of SFE objects

bbox,SpatialFeatureExperiment-methodR Documentation

Find bounding box of SFE objects

Description

Find bounding box of the union of all colGeometries and annotGeometries of each sample in the SFE object. This can be used to remove empty space so the tissue and geometries have one corner at the origin so all samples will be on comparable coordinates.

Usage

## S4 method for signature 'SpatialFeatureExperiment'
bbox(sfe, sample_id = "all", include_images = FALSE, include_row = TRUE)

Arguments

sfe

A SpatialFeatureExperiment object.

sample_id

Sample(s) whose bounding box(es) to find. The bounding box would be for the union of all colGeometries and annotGeometries associated with each sample.

include_images

Logical, whether the bounding boxes should include image extents. Defaults to FALSE because often the image has a lot of empty space surrounding the tissue.

include_row

Logical, whether the bounding boxes should include rowGeometries, defaults to TRUE.

Value

For one sample, then a named vector with names xmin, ymin, xmax, and ymax specifying the bounding box. For multiple samples, then a matrix whose columns are samples and whose rows delineate the bounding box.

Examples

library(SFEData)
sfe <- McKellarMuscleData("small")
bbox(sfe, sample_id = "Vis5A")

pachterlab/SpatialFeatureExperiment documentation built on Aug. 23, 2024, 11:38 p.m.