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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
---
pretty_name: CellHIST-Bench
license: cc-by-nc-4.0
language:
  - en
tags:
  - spatial-transcriptomics
  - single-cell
  - histopathology
  - whole-slide-image
  - gene-expression
  - computational-pathology
  - weakly-supervised-learning
  - image-to-gene-expression
  - spatial-gene-expression
size_categories:
  - 100K<n<1M

---

# CellHIST-Bench

## Dataset Summary

CellHIST-Bench is a benchmark dataset for histology-based spatial gene expression inference. It provides paired whole-slide histopathology images, spatial transcriptomics labels, cell segmentation results, spot-centered patch metadata, and cell-to-patch correspondence information.

The dataset supports two levels of spatial transcriptomics annotations:

- **Spot-resolution spatial transcriptomics**, where each spot is associated with a local histology patch and a spot-level gene expression vector.
- **Single-cell-resolution spatial transcriptomics**, where each cell is associated with a single-cell gene expression vector and can be linked to image-detected cells.

CellHIST-Bench is designed to support benchmarking of weakly supervised learning methods for predicting spatial gene expression from histopathology images.

---

## Dataset Organization

The dataset is organized by tissue or cancer type. Each folder contains whole-slide images, cell segmentation files, patch metadata, patch-cell relationship files, and gene expression labels.

A typical directory structure is shown below:

```text
/data/west_bench
├── LUNG
│   ├── wsis
│   ├── cellvit++_seg
│   ├── patches
│   ├── patches_cell
│   ├── st_spot_label
│   └── st_cell_label
├── IDC
├── SKCM
└── ...
```

---

## Spot-Resolution Samples

For spot-resolution spatial transcriptomics samples, the dataset contains the following files:

```text
/data/west_bench
├── LUNG
│   ├── wsis
│   │   ├── TENX62.tif
│   │   └── ...
│   │
│   ├── cellvit++_seg
│   │   ├── TENX62_seg.parquet
│   │   ├── TENX62.h5
│   │   └── ...
│   │
│   ├── patches
│   │   ├── TENX62.h5
│   │   └── ...
│   │
│   ├── patches_cell
│   │   ├── TENX62.json
│   │   └── ...
│   │
│   └── st_spot_label
│       ├── TENX62.h5ad
│       └── ...
```

### `wsis/`

This folder stores whole-slide images.

Each file is a `.tif` image:

```text
TENX62.tif
```

The WSI file contains the original histopathology image. These files are usually very large and may require specialized tools such as OpenSlide or tifffile for reading.

### `cellvit++_seg/`

This folder stores cell segmentation results generated by CellViT++.

Each sample may contain:

```text
TENX62_seg.parquet
TENX62.h5
```

The `*_seg.parquet` file is a DataFrame containing cell-level segmentation information. Typical columns include:

```text
['geometry', 'class', 'cell_id']
```

The corresponding `.h5` file stores cell-level information. Typical keys include:

```text
['cell_coords', 'cell_embedding', 'cell_class_id']
```

where:

- `cell_coords` stores cell coordinates;
- `cell_embedding` stores cell-level image embeddings;
- `cell_class_id` stores predicted cell class IDs.

### `patches/`

This folder stores metadata for spot-centered patches.

Each `.h5` file contains:

```text
['barcode', 'coords']
```

where:

- `barcode` is the spatial transcriptomics spot barcode;
- `coords` records the patch coordinates in the WSI.

Note that the raw patch image array is not stored in this file. Users need to crop the patch from the corresponding WSI according to the provided coordinates.

### `patches_cell/`

This folder describes the cells contained in each spot-centered patch.

Each `.json` file stores a dictionary indexed by spot barcode. A typical entry is:

```json
{
  "barcode": {
    "cell_index": [99],
    "in_spot": [1]
  }
}
```

where:

- `cell_index` indicates the indices of cells located in the patch;
- `in_spot` indicates whether each cell is located inside the spatial spot region.

Each patch corresponds to a local image region of:

```text
224 × 224 pixels
```

### `st_spot_label/`

This folder stores spot-level gene expression labels.

Each `.h5ad` file contains a spot-level gene expression matrix:

```text
num_spots × num_genes
```

The row index corresponds to the spot barcode.

---

## Single-Cell-Resolution Samples

For single-cell-resolution spatial transcriptomics samples, the dataset contains all files used in spot-resolution samples, with additional files for single-cell gene expression labels and spot-cell mapping.

A typical structure is shown below:

```text
/data/west_bench
├── LUNG
│   ├── wsis
│   │   ├── TENX141.tif
│   │   └── ...
│   │
│   ├── cellvit++_seg
│   │   ├── TENX141_seg.parquet
│   │   ├── TENX141.h5
│   │   ├── TENX141_st_cell_idx.parquet
│   │   └── ...
│   │
│   ├── patches
│   │   ├── TENX141.h5
│   │   └── ...
│   │
│   ├── patches_cell
│   │   ├── TENX141.json
│   │   └── ...
│   │
│   ├── st_spot_label
│   │   ├── TENX141.h5ad
│   │   └── ...
│   │
│   └── st_cell_label
│       ├── TENX141.h5ad
│       └── ...
```

### `*_st_cell_idx.parquet`

This file stores the mapping between spatial transcriptomics cell indices and image-detected cell IDs.

Typical columns include:

```text
['st_cell_index', 'cell_id']
```

where:

- `st_cell_index` is the cell index in the spatial transcriptomics data;
- `cell_id` is the cell ID detected from the WSI by CellViT++.

### `st_cell_label/`

This folder stores single-cell-level gene expression labels.

Each `.h5ad` file contains a single-cell gene expression matrix:

```text
num_cells × num_genes
```

The row index corresponds to:

```text
st_cell_index
```

---

## Data Fields

### Whole-Slide Images

| File    | Description                      |
| ------- | -------------------------------- |
| `*.tif` | Whole-slide histopathology image |

### Cell Segmentation Files

| Field            | Description                          |
| ---------------- | ------------------------------------ |
| `geometry`       | Cell geometry or polygon information |
| `class`          | Predicted cell category              |
| `cell_id`        | Unique cell identifier in the WSI    |
| `cell_coords`    | Cell coordinates                     |
| `cell_embedding` | Cell-level image embedding           |
| `cell_class_id`  | Numeric cell class ID                |

### Patch Metadata Files

| Field     | Description                          |
| --------- | ------------------------------------ |
| `barcode` | Spatial transcriptomics spot barcode |
| `coords`  | Patch coordinates in the WSI         |

### Patch-Cell Relationship Files

| Field        | Description                                                  |
| ------------ | ------------------------------------------------------------ |
| `cell_index` | Indices of cells located in the patch                        |
| `in_spot`    | Binary indicator showing whether the cell is inside the spot region |

### Spot-Level Gene Expression Labels

| Field  | Description                       |
| ------ | --------------------------------- |
| `.X`   | Spot-level gene expression matrix |
| `.obs` | Spot metadata                     |
| `.var` | Gene metadata                     |
| index  | Spot barcode                      |

### Single-Cell-Level Gene Expression Labels

| Field  | Description                              |
| ------ | ---------------------------------------- |
| `.X`   | Single-cell-level gene expression matrix |
| `.obs` | Cell metadata                            |
| `.var` | Gene metadata                            |
| index  | `st_cell_index`                          |

---

## Supported Tasks

CellHIST-Bench can be used for the following tasks:

1. **Spot-level spatial gene expression prediction**

   Given a spot-centered histology patch, predict the corresponding spot-level gene expression vector.

2. **Single-cell-level gene expression prediction**

   Given image-derived cell information and local histological context, predict the gene expression profile of individual cells.

3. **Weakly supervised spatial gene expression inference**

   Evaluate whether weakly supervised models can infer molecular profiles from histopathology images.

4. **Cell-aware representation learning**

   Use cell segmentation, cell embeddings, and patch-cell relationships to learn cell-aware histology representations.

5. **Cross-resolution spatial transcriptomics analysis**

   Compare spot-level and single-cell-level spatial gene expression prediction under a unified data organization.

---

## Loading Examples

### Load Spot-Level Gene Expression Labels

```python
import scanpy as sc

adata = sc.read_h5ad("LUNG/st_spot_label/TENX62.h5ad")

print(adata)
print(adata.X.shape)  # num_spots × num_genes
print(adata.obs.head())
print(adata.var.head())
```

### Load Single-Cell-Level Gene Expression Labels

```python
import scanpy as sc

adata = sc.read_h5ad("LUNG/st_cell_label/TENX141.h5ad")

print(adata)
print(adata.X.shape)  # num_cells × num_genes
print(adata.obs.head())
print(adata.var.head())
```

### Load Patch Metadata

```python
import h5py

with h5py.File("LUNG/patches/TENX62.h5", "r") as f:
    print(list(f.keys()))
    barcodes = f["barcode"][:]
    coords = f["coords"][:]

print(barcodes.shape)
print(coords.shape)
```

### Load Cell Segmentation Results

```python
import h5py
import pandas as pd

seg_df = pd.read_parquet("LUNG/cellvit++_seg/TENX62_seg.parquet")
print(seg_df.head())

with h5py.File("LUNG/cellvit++_seg/TENX62.h5", "r") as f:
    print(list(f.keys()))
    cell_coords = f["cell_coords"][:]
    cell_embedding = f["cell_embedding"][:]
    cell_class_id = f["cell_class_id"][:]

print(cell_coords.shape)
print(cell_embedding.shape)
print(cell_class_id.shape)
```

### Load Patch-Cell Relationship Files

```python
import json

with open("LUNG/patches_cell/TENX62.json", "r") as f:
    patch_cells = json.load(f)

first_barcode = list(patch_cells.keys())[0]

print(first_barcode)
print(patch_cells[first_barcode])
```

### Load Spot-Cell Mapping for Single-Cell-Resolution Samples

```python
import pandas as pd

mapping = pd.read_parquet("LUNG/cellvit++_seg/TENX141_st_cell_idx.parquet")

print(mapping.head())
print(mapping.columns)
```

---

## Recommended Evaluation Settings

CellHIST-Bench supports evaluation under different task settings.

### Spot-Level Prediction

The model takes a spot-centered histology patch as input and predicts the corresponding spot-level gene expression vector.

Input:

```text
spot-centered histology patch
```

Output:

```text
spot-level gene expression vector
```

Label file:

```text
st_spot_label/*.h5ad
```

### Single-Cell-Level Prediction

The model takes cell-level visual information and local histological context as input and predicts single-cell gene expression.

Input:

```text
cell-level image features and local patch context
```

Output:

```text
single-cell gene expression vector
```

Label file:

```text
st_cell_label/*.h5ad
```

Mapping file:

```text
cellvit++_seg/*_st_cell_idx.parquet
```

---

## Dataset Splits

The dataset can be split by tissue type, sample ID, or task setting depending on the evaluation protocol.

A typical split may include:

```text
train
validation
test
```

When evaluating generalization, users should ensure that slides from the same biological sample are not shared across training and test sets.

If official split files are provided, users should follow the official split protocol.

---

## Intended Use

This dataset is intended for research on:

- histology-based spatial gene expression prediction;
- weakly supervised learning for spatial transcriptomics;
- computational pathology;
- cell-aware histology representation learning;
- integration of histology images and spatial omics data;
- single-cell and spatial transcriptomics analysis.

This dataset is intended for research use only.

---

## Out-of-Scope Use

This dataset should not be used for:

- clinical diagnosis;
- treatment recommendation;
- patient identification;
- direct medical decision-making;
- commercial use without proper permission.

---

## Limitations

### Large WSI Files

Whole-slide images are large and may require specialized tools and sufficient storage capacity.

### Patch Images Are Not Directly Stored

The `patches/*.h5` files provide patch coordinates and barcodes, but do not directly store raw patch image arrays. Users need to crop patches from the corresponding WSI.

### Cell Segmentation Depends on CellViT++

Cell-level information is derived from CellViT++ segmentation. Downstream analysis may therefore be affected by the accuracy and bias of the segmentation model.

### Resolution Differences

Spot-resolution and single-cell-resolution samples have different label granularities. Results across these two settings should be interpreted carefully.

### Gene Expression Sparsity

Spatial transcriptomics and single-cell transcriptomics data are sparse and noisy. Prediction performance should be interpreted with appropriate biological and technical considerations.

---

## Ethical Considerations

The dataset contains histopathology images and molecular profiles derived from biomedical samples. Users are responsible for ensuring that their use of the dataset complies with applicable ethical, institutional, and legal requirements.

The dataset should only be used for research purposes and should not be used for patient identification, clinical diagnosis, or treatment recommendation.

## Contact

For questions about the dataset, please open an issue in this Hugging Face dataset repository.