SFE-image | R Documentation |
SpatialFeatureExperiment
and the Voyager
package work with
images differently from SpatialExperiment
. In SFE and
Voyager
's, plotting functions for SFE objects, the images are read
with rast
and represented as SpatRaster
, so the image is
not entirely loaded into memory unless necessary. Plotting will not load a
large image into memory; rather the image will be downsampled and the
downsampled version is plotted.
## S4 method for signature 'SpatialFeatureExperiment'
addImg(x, file, sample_id, image_id, extent = NULL, scale_fct = 1)
## S4 method for signature 'SpatRasterImage'
transposeImg(x)
## S4 method for signature 'SpatRasterImage'
mirrorImg(x, direction = "vertical")
## S4 method for signature 'SpatialFeatureExperiment'
transposeImg(x, sample_id = NULL, image_id = NULL)
## S4 method for signature 'SpatialFeatureExperiment'
mirrorImg(x, sample_id = NULL, image_id = NULL, direction = "vertical")
## S4 method for signature 'SpatRasterImage'
imgRaster(x)
## S4 method for signature 'SpatRasterImage'
imgSource(x)
x |
SpatRaster or SpatVector |
file |
File from which to read the image. |
sample_id |
Which sample the image is associated with. Use
|
image_id |
Image ID, such as "lowres" and "hires" for Visium data and "DAPI" and "PolyT" for Vizgen MERFISH data. |
extent |
A numeric vector of length 4 with names of the set xmin, ymin, xmax, and ymax, specifying the extent of the image. |
scale_fct |
Scale factor – multiply pixel coordinates in full
resolution image by this scale factor should yield pixel coordinates in a
different resolution. |
direction |
character. Should (partially) match "vertical" to flip by rows, or "horizontal" to flip by columns |
Methods for SpatRasterImage
return a modified
SpatRasterImage
, and methods for SFE return a modified SFE object.
If the image is already a GeoTIFF file that already has an extent, then
the extent associated with the file will be honored and the extent
and scale_fct
arguments are ignored. Also, when the image is
transposed, it is flipped about the axis going from top left to bottom
right.
library(SFEData)
sfe <- McKellarMuscleData("small")
img_path <- system.file(file.path("extdata", "sample01", "outs", "spatial",
"tissue_lowres_image.png"),
package = "SpatialFeatureExperiment")
sfe <- addImg(sfe, img_path, sample_id = "Vis5A", image_id = "lowres",
scale_fct = 0.023)
img <- getImg(sfe)
# SpatRasterImage method
img_t <- transposeImg(img)
# SFE method
sfe <- transposeImg(sfe, sample_id = "Vis5A", image_id = "lowres")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.