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

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

Arguments

seurat

a Seurat object containing G4X data

img_path

character string indicating the path of the H&E image to be used. If set to `NULL`, the function will look for any image path 'img' stored in tools slot

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 raster object stored in the `tools` slot (`TRUE`) or the raster 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 G4X H&E image file to create a SpatRaster image for downstream analysis and visualization.