readImgData: Read images & scale factors for 10x Genomics Visium

View source: R/readImgData.R

readImgDataR Documentation

Read images & scale factors for 10x Genomics Visium

Description

Function to read in images and scale factors for 10x Genomics Visium data, and return as a valid imgData DataFrame.

Usage

readImgData(
  path = ".",
  sample_id = names(path),
  imageSources = file.path(path, "tissue_lowres_image.png"),
  scaleFactors = file.path(path, "scalefactors_json.json"),
  load = TRUE
)

Arguments

path

a path where to find one or more images

sample_id

the sample_id for the SpatialExperiment object

imageSources

the images source path(s)

scaleFactors

the .json file where to find the scale factors

load

logical; should the image(s) be loaded into memory as a grob? If FALSE, will store the path/URL instead.

Value

a DataFrame

Author(s)

Helena L. Crowell

Examples

dir <- system.file(
  file.path("extdata", "10xVisium", "section1", "outs", "spatial"),
  package = "SpatialExperiment")

# base directory contains
# - scale factors (scalefactors_json.json)
# - one image (tissue_lowres_image.png)
list.files(dir)

# read in images & scale factors
# as valid 'imgData' 'DFrame'
readImgData(dir, sample_id = "foo")


drighelli/SpatialExperiment documentation built on June 30, 2024, 9:12 p.m.