Save BioFormatsImage
for alabaster
saveObject-BioFormatsImage-method.Rd
This function copies the original file to a pre-defined location within the
directory that stores the on disk representation of the SFE object for data
sharing. Since BioFormatsImage
is essentially just some metadata in
memory and it never loads the image into memory (once the image is loaded
into memory it becomes ExtImage
), once the original image is moved,
the BioFormatsImage
object will no longer work, which is why the
pre-defined location is important. This function also saves the metadata,
which includes spatial extent and affine transformations.
See also
Other saveObject-SFE-image:
saveObject,ExtImage-method
,
saveObject,SpatRaster-method
Examples
library(SFEData)
fp <- tempfile()
fsave <- file.path(fp, "bfi2")
x1 <- XeniumOutput(dataset = "v1", file_path = file.path(fp, "xenium1"))
#> see ?SFEData and browseVignettes('SFEData') for documentation
#> loading from cache
#> The downloaded files are in /tmp/RtmpfBErth/file2aa865074075/xenium1/xenium_lr
sfe <- readXenium(x1)
#> >>> Cell segmentations are found in `.csv` file(s)
#> >>> Reading cell and nucleus segmentations
#> >>> Making POLYGON geometries
#> >>> Checking polygon validity
#> >>> Saving geometries to parquet files
#> >>> Reading cell metadata -> `cells.csv`
#> >>> Reading h5 gene count matrix
#> >>> filtering cellSeg geometries to match 16324 cells with counts > 0
#> >>> filtering nucSeg geometries to match 16324 cells with counts > 0
bfi <- getImg(sfe)
saveObject(bfi, fsave)
bfi2 <- readObject(fsave)
unlink(fsave, recursive = TRUE)