Function to read in images and scale factors for 10x Genomics Visium data,
and return as a valid imgData
DataFrame
.
Arguments
- path
a path where to find one or more images
- sample_id
the
sample_id
for theSpatialExperiment
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.
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)
#> [1] "scalefactors_json.json" "tissue_lowres_image.png"
#> [3] "tissue_positions_list.csv"
# read in images & scale factors
# as valid 'imgData' 'DFrame'
readImgData(dir, sample_id = "foo")
#> DataFrame with 1 row and 4 columns
#> sample_id image_id data scaleFactor
#> <character> <character> <list> <numeric>
#> 1 foo lowres #### 0.0510334