Skip to contents

This function gets physical size of pixels in each resolution of a OME-TIFF pyramid in BioFormatsImage.

Usage

getPixelSize(file, resolution = 1L)

Arguments

file

Path to an OME-TIFF file.

resolution

Which resolution to query; 1 means the highest resolution. The pixels will be larger for the lower resolutions.

Value

Numeric vector of length 2 of pixel size in x and y. Usually they're the same.

Examples

library(SFEData)
fp <- tempdir()
dir_use <- XeniumOutput("v1", file_path = file.path(fp, "xenium_test"))
#> see ?SFEData and browseVignettes('SFEData') for documentation
#> downloading 1 resources
#> retrieving 1 resource
#> loading from cache
#> The downloaded files are in /tmp/RtmpRqe7ue/xenium_test/xenium_lr 
# RBioFormats null pointer error
try(getPixelSize(file.path(dir_use, "morphology_focus.ome.tif")))
#> Error in .jcall(.jcall("RBioFormats", "Lloci/formats/meta/MetadataStore;",  : 
#>   java.lang.NullPointerException
getPixelSize(file.path(dir_use, "morphology_focus.ome.tif"))
#> [1] 1.7 1.7
unlink(dir_use, recursive = TRUE)