Diff of /docs/pixelanalysis.Rmd [000000] .. [413088]

Switch to unified view

a b/docs/pixelanalysis.Rmd
1
---
2
title: "Importing Spatial Data"
3
output: 
4
  html_document:
5
    toc: true
6
    toc_depth: 4
7
    toc_float:
8
      collapsed: false
9
      smooth_scroll: false
10
---
11
12
<style>
13
.title{
14
  display: none;
15
}
16
body {
17
  text-align: justify
18
}
19
.center {
20
  display: block;
21
  margin-left: auto;
22
  margin-right: auto;
23
}
24
table, th, td {
25
  border-collapse: collapse;
26
  align-self: center;
27
  padding-right: 10px;
28
  padding-left: 10px;
29
}
30
</style>
31
32
```{css, echo=FALSE}
33
.watch-out {
34
  color: black;
35
}
36
```
37
38
```{r setup, include=FALSE}
39
# use rmarkdown::render_site(envir = knitr::knit_global())
40
knitr::opts_chunk$set(highlight = TRUE, echo = TRUE)
41
```
42
43
<br>
44
45
# Analyzing Image Datasets
46
47
VoltRon is a spatial omic analysis platform that allows storing a large amount of spatially resolved datasets. As opposed to datasets with either supracellular (spot-level) or cellular resolutions, one might analyze image datasets and pixels to characterize the morphology of a tissue section. Here, images can also be used to build VoltRon objects where pixels (or tiles) are defined as spatial points, and then can also be used for multiple downstream analysis purposes. 
48
49
<br>
50
51
## Analysis of H&E images
52
53
In this use case, we will analyze the H&E image derived from a tissue section that was first analyzed by The 10x Genomics [Xenium In Situ](https://www.10xgenomics.com/platforms/xenium) platform. Three tissue sections were cut from a single formalin-fixed, paraffin-embedded (FFPE) breast cancer tissue block. A 5 $\mu$m section was used to generate a single Xenium replicate. 
54
55
More information on the Xenium and the study can be also be found on the [BioArxiv preprint](https://www.biorxiv.org/content/10.1101/2022.10.06.510405v1). You can download the H&E image from the [10x Genomics website](https://www.10xgenomics.com/products/xenium-in-situ/preview-dataset-human-breast) as well (specifically, import the **Post-Xenium H&E image (TIFF)** data). 
56
57
We incorporate **importImageData** to convert an image into a pixel-based spatial dataset. 
58
59
```{r eval = FALSE, class.source="watch-out"}
60
Xen_R1_image <- importImageData("Xenium_FFPE_Human_Breast_Cancer_Rep1_he_image.tif",
61
                                sample_name = "XeniumR1image", 
62
                                image_name = "H&E")
63
Xen_R1_image
64
```
65
66
```
67
VoltRon Object 
68
XeniumR1image: 
69
  Layers: Section1 
70
Assays: ImageData(Main) 
71
```
72
73
```{r eval = FALSE, class.source="watch-out"}
74
vrImages(Xen_R1_image, scale.perc = 2)
75
```
76
77
<img width="70%" height="70%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/importdata_HE.png" class="center">
78
79
</br>
80
81
This VoltRon object stores the metadata information and localization of all pixels in the image.
82
83
```{r eval = FALSE, class.source="watch-out"}
84
head(Metadata(Xen_R1_image))
85
```
86
87
```
88
             id assay_id     Assay    Layer        Sample     id
89
         <char>   <char>    <char>   <char>        <char> <char>
90
1: tile1_3adf0a   Assay1 ImageData Section1 XeniumR1image  tile1
91
2: tile2_3adf0a   Assay1 ImageData Section1 XeniumR1image  tile2
92
3: tile3_3adf0a   Assay1 ImageData Section1 XeniumR1image  tile3
93
4: tile4_3adf0a   Assay1 ImageData Section1 XeniumR1image  tile4
94
5: tile5_3adf0a   Assay1 ImageData Section1 XeniumR1image  tile5
95
6: tile6_3adf0a   Assay1 ImageData Section1 XeniumR1image  tile6
96
```
97
98
```{r eval = FALSE, class.source="watch-out"}
99
nrow(Metadata(Xen_R1_image))
100
```
101
102
```
103
[1] 5656658
104
```