EvidenceAIResearch commited on
Commit
41233c8
·
verified ·
1 Parent(s): 860cb43

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +208 -0
README.md ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ task_categories:
4
+ - image-segmentation
5
+ - image-classification
6
+ language:
7
+ - en
8
+ tags:
9
+ - medical
10
+ - radiology
11
+ - chest-ct
12
+ - anatomy
13
+ - segmentation
14
+ - ct-scan
15
+ - projection
16
+ pretty_name: RadGenome-ChestCT Views
17
+ size_categories:
18
+ - 10K<n<100K
19
+ configs:
20
+ - config_name: default
21
+ data_files:
22
+ - split: train
23
+ path: data/train/*.parquet
24
+ - split: validation
25
+ path: data/validation/*.parquet
26
+ dataset_info:
27
+ features:
28
+ - name: volume_id
29
+ dtype: string
30
+ - name: split
31
+ dtype: string
32
+ - name: image_pa
33
+ dtype: image
34
+ - name: image_ll
35
+ dtype: image
36
+ - name: mask_labels_pa
37
+ sequence: string
38
+ - name: masks_pa
39
+ sequence: image
40
+ - name: mask_labels_ll
41
+ sequence: string
42
+ - name: masks_ll
43
+ sequence: image
44
+ ---
45
+
46
+ # RadGenome-ChestCT Views
47
+
48
+ A Parquet dataset of chest CT 2D projection views with per-anatomy binary segmentation masks,
49
+ derived from the [RadGenome-ChestCT](https://huggingface.co/datasets/RadGenome/RadGenome-ChestCT) dataset
50
+ (originally based on [CT-RATE](https://huggingface.co/datasets/ibrahimhamamci/CT-RATE)).
51
+
52
+ Each row represents one CT volume and contains its PA (posteroanterior) and LL (lateral)
53
+ projection images, plus binary anatomy masks for all 210 anatomical structures.
54
+
55
+ ---
56
+
57
+ ## Dataset Summary
58
+
59
+ | Property | Value |
60
+ |---|---|
61
+ | **Volumes** | 25,692 total |
62
+ | **Views per volume** | 2 (PA + LL) |
63
+ | **Anatomy classes** | 210 structures |
64
+ | **License** | CC-BY-4.0 |
65
+ | **Source** | RadGenome-ChestCT / CT-RATE |
66
+
67
+ ### Splits
68
+
69
+ | Split | Volumes |
70
+ |---|---|
71
+ | train | 24,128 |
72
+ | validation | 1,564 |
73
+
74
+ ---
75
+
76
+ ## Dataset Structure
77
+
78
+ ### Data Fields
79
+
80
+ | Column | Type | Description |
81
+ |---|---|---|
82
+ | `volume_id` | `str` | Unique volume identifier, e.g. `train_1_a_1`. |
83
+ | `split` | `str` | Dataset split: `train` or `validation`. |
84
+ | `image_pa` | `Image` | PA (posteroanterior, front) chest projection image (JPEG). |
85
+ | `image_ll` | `Image` | LL (lateral, side) chest projection image (JPEG). |
86
+ | `mask_labels_pa` | `List[str]` | Anatomy structure names for the PA masks, e.g. `["lung", "heart", ...]`. Parallel to `masks_pa`. |
87
+ | `masks_pa` | `List[Image]` | Binary anatomy segmentation masks (one per structure) for the PA view. White pixels = structure present. |
88
+ | `mask_labels_ll` | `List[str]` | Anatomy structure names for the LL masks. Parallel to `masks_ll`. |
89
+ | `masks_ll` | `List[Image]` | Binary anatomy segmentation masks for the LL view. |
90
+
91
+ ### Anatomy Label Universe
92
+
93
+ The dataset contains masks for **210 anatomical structures**, covering:
94
+ - **Lungs**: left/right lung, upper/lower/middle lobes, lung nodule, tumor, effusion
95
+ - **Heart**: chambers (atria, ventricles), myocardium, ascending aorta, pulmonary artery/vein
96
+ - **Vessels**: aorta, inferior/superior vena cava, carotid arteries, subclavian arteries, brachiocephalic vessels, iliac vessels, renal vessels
97
+ - **Skeleton**: ribs (1–12, left/right), thoracic vertebrae (T1–T12), cervical/lumbar vertebrae, sternum, clavicles, scapulae, humerus, femur
98
+ - **Abdominal organs**: liver (with segments), spleen, pancreas, kidneys, gallbladder, stomach, intestine, esophagus
99
+ - **Endocrine/other**: thyroid, adrenal glands, thymus, trachea, larynx, spinal cord
100
+
101
+ The full ordered list is in [`label_universe.json`](./label_universe.json) at the repo root.
102
+ Use it to map labels to fixed class indices for consistent multi-label training.
103
+
104
+ ---
105
+
106
+ ## Usage
107
+
108
+ ### Load with 🤗 Datasets
109
+
110
+ ```python
111
+ from datasets import load_dataset
112
+
113
+ ds = load_dataset("EvidenceAIResearch/radgenome-anatomy")
114
+ print(ds)
115
+ # DatasetDict({
116
+ # train: Dataset({features: ['volume_id', 'split', 'image_pa', 'image_ll', ...], num_rows: 24,128})
117
+ # validation: Dataset({features: ['volume_id', 'split', 'image_pa', 'image_ll', ...], num_rows: 1,564})
118
+ # })
119
+ ```
120
+
121
+ ### Access images
122
+
123
+ ```python
124
+ from PIL import Image
125
+ import io
126
+
127
+ row = ds["train"][0]
128
+ print(row["volume_id"]) # e.g. "train_1_a_1"
129
+
130
+ # Decode PA image
131
+ pa_img = Image.open(io.BytesIO(row["image_pa"]["bytes"]))
132
+ ll_img = Image.open(io.BytesIO(row["image_ll"]["bytes"]))
133
+
134
+ pa_img.show()
135
+ ```
136
+
137
+ ### Working with masks
138
+
139
+ Each sample contains a list of binary masks with corresponding label names:
140
+
141
+ ```python
142
+ from PIL import Image
143
+ import io, numpy as np
144
+
145
+ row = ds["train"][0]
146
+
147
+ # Map label → mask for the LL view
148
+ mask_map = {
149
+ label: Image.open(io.BytesIO(img["bytes"]))
150
+ for label, img in zip(row["mask_labels_ll"], row["masks_ll"])
151
+ }
152
+
153
+ # Example: get the lung mask as a numpy array
154
+ lung_mask = np.array(mask_map["lung"]) # shape: (H, W), values 0 or 255
155
+
156
+ # Build a multi-label tensor [num_classes, H, W] using the label universe
157
+ import json, urllib.request
158
+ # label_universe.json is in the repo root
159
+ universe = json.loads(open("label_universe.json").read())
160
+ label_to_idx = {l: i for i, l in enumerate(universe)}
161
+
162
+ H, W = lung_mask.shape
163
+ multi_label = np.zeros((len(universe), H, W), dtype=np.uint8)
164
+ for label, img in zip(row["mask_labels_ll"], row["masks_ll"]):
165
+ if label in label_to_idx:
166
+ arr = np.array(Image.open(io.BytesIO(img["bytes"])))
167
+ multi_label[label_to_idx[label]] = (arr > 128).astype(np.uint8)
168
+ ```
169
+
170
+ ### Streaming (large dataset)
171
+
172
+ ```python
173
+ ds = load_dataset("EvidenceAIResearch/radgenome-anatomy", streaming=True)
174
+ for row in ds["train"]:
175
+ pa_img = Image.open(io.BytesIO(row["image_pa"]["bytes"]))
176
+ # process ...
177
+ break
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Source & Citation
183
+
184
+ This dataset is derived from **RadGenome-ChestCT**, which is built on **CT-RATE**.
185
+ If you use this dataset, please cite both:
186
+
187
+ ```bibtex
188
+ @article{radgenome2024,
189
+ title={RadGenome-Chest CT: A Grounded Vision-Language Dataset for Chest CT Analysis},
190
+ author={RadGenome Team},
191
+ year={2024},
192
+ }
193
+
194
+ @article{hamamci2024foundation,
195
+ title={A foundation model utilizing chest CT volumes and radiology reports for supervised-level zero-shot detection of abnormalities},
196
+ author={Hamamci, Ibrahim Ethem and others},
197
+ journal={arXiv preprint arXiv:2403.17834},
198
+ year={2024},
199
+ }
200
+ ```
201
+
202
+ ---
203
+
204
+ ## License
205
+
206
+ [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) — derived from CT-RATE.
207
+ Commercial use is not permitted without prior permission from the original data providers.
208
+ See the [original dataset terms](https://huggingface.co/datasets/RadGenome/RadGenome-ChestCT) for full conditions.