Create a sf data frame object (package `sf`) using Visium spots coordinates

visium2sf(
  seurat = NULL,
  is.hd = F,
  return.seurat = T,
  binsize = 16,
  res = NULL,
  img = NULL
)

Arguments

seurat

a Seurat object containing Visium/Visium-HD data

is.hd

boolean, whether or not the Seurat object contain data generated via Visium-HD technology. Default value is `FALSE`

return.seurat

boolean, whether returning the input Seurat file with the nb object stored in the `misc` slot (`TRUE`) or the nb object alone (`FALSE`). Default value is `TRUE`

binsize

numeric value indicating which bin resolution will be considered to create the final sf object when working with Visium-HD data

res

character string specifying which version of H&E Visium image have been used to create Kandinsky data. Must be one of the following: `low`, `high`, `full`, where `full` refers to the original H&E full-resolution tiff image. This parameter will be used to select the right scaling factor to align spot and image coordinates

img

Visium H&E image in array or SpatRaster format. Image resolution should match with the one specified for spot coordinates through the `res` parameter

Value

Seurat object with the new sf object stored in the `misc` slot or the sf object alone, depending on the `return.seurat` parameter

Details

This function will use Visium spot coordinates using an external 10X spot position file or spot coordinates already stored inside the input Seurat object. The function is compatible with either Visium or Visium-HD data format.