Create a SpatRaster object (package terra) using Visium image file

visium2rast(
  seurat = NULL,
  img_path = NULL,
  rm_old_img = F,
  return.seurat = T,
  max_dim = 2000
)

Arguments

seurat

a Seurat object containing Visium/Visium-HD data

img_path

character string indicating the path of the H&E image to be used for Visium/VisiumHD. If set to NULL, no image is loaded and stored in Seurat object

rm_old_img

boolean, whether or not removing any Image object already loaded in the Seurat object (Images())

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

max_dim

numeric value indicating the ideal maximum pixel dimension accepted for Visium H&E image. If image size is bigger than this value, a scale factor will be applied to lower image pixel resolution/size up to the defined maximum value

Value

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

Details

This function will use Visium H&E image file to create a SpatRaster image for downstream analysis and visualization. The function is compatible with either Visium or Visium-HD data format.