Method to extract coordinates
GetCoordinates.Rd
Method to extract coordinates
Usage
GetCoordinates(object)
# S4 method for class 'Staffli'
GetCoordinates(object)
# S4 method for class 'Seurat'
GetCoordinates(object)
Examples
# Load example data
se_mbrain <- readRDS(system.file("extdata/mousebrain", "se_mbrain", package = "semla")) |>
LoadImages()
#>
#> ── Loading H&E images ──
#>
#> ℹ Loading image from /private/var/folders/8r/bfm2m_q17znfk0m_8dt330tm0000gp/T/RtmpLHpYU7/temp_libpath305b1609463d/semla/extdata/mousebrain/spatial/tissue_lowres_image.jpg
#> ℹ Scaled image from 600x565 to 400x377 pixels
#> ℹ Saving loaded H&E images as 'rasters' in Seurat object
# Fetch Staffli object
staffli_object <- GetStaffli(se_mbrain)
# Fetch coordinates from a Staffli object
coordinates <- GetCoordinates(staffli_object)
coordinates
#> # A tibble: 2,560 × 6
#> barcode x y pxl_col_in_fullres pxl_row_in_fullres sampleID
#> <chr> <int> <int> <int> <int> <int>
#> 1 AAACAAGTATCTCCCA-1 102 50 12934 10718 1
#> 2 AAACACCAATAACTGC-1 19 59 4435 12308 1
#> 3 AAACATTTCCCGGATT-1 97 61 12420 12677 1
#> 4 AAACCCGAACGAAATC-1 115 45 14267 9830 1
#> 5 AAACCGGGTAGGTACC-1 28 42 5361 9282 1
#> 6 AAACCGTTCGTCCAGG-1 42 52 6792 11065 1
#> 7 AAACCTAAGCAGCCGG-1 83 65 10985 13387 1
#> 8 AAACGAGACGGTTGAT-1 79 35 10584 8043 1
#> 9 AAACGGGCGTACGGGT-1 91 65 11804 13388 1
#> 10 AAACGGTTGCGAACTG-1 59 67 8528 13739 1
#> # ℹ 2,550 more rows
# Fetch images from a Seurat object
coordinates <- GetCoordinates(se_mbrain)
coordinates
#> # A tibble: 2,560 × 6
#> barcode x y pxl_col_in_fullres pxl_row_in_fullres sampleID
#> <chr> <int> <int> <int> <int> <int>
#> 1 AAACAAGTATCTCCCA-1 102 50 12934 10718 1
#> 2 AAACACCAATAACTGC-1 19 59 4435 12308 1
#> 3 AAACATTTCCCGGATT-1 97 61 12420 12677 1
#> 4 AAACCCGAACGAAATC-1 115 45 14267 9830 1
#> 5 AAACCGGGTAGGTACC-1 28 42 5361 9282 1
#> 6 AAACCGTTCGTCCAGG-1 42 52 6792 11065 1
#> 7 AAACCTAAGCAGCCGG-1 83 65 10985 13387 1
#> 8 AAACGAGACGGTTGAT-1 79 35 10584 8043 1
#> 9 AAACGGGCGTACGGGT-1 91 65 11804 13388 1
#> 10 AAACGGTTGCGAACTG-1 59 67 8528 13739 1
#> # ℹ 2,550 more rows