Request access to Gastric-X
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
Gastric-X is released under CC BY-NC-ND 4.0 for non-commercial research and education only. Access is granted automatically once you complete this form with your HuggingFace account. By requesting access you agree to the license terms below.
Log in or Sign Up to review the conditions and access this dataset content.
Gastric-X
Multi-phase abdominal CT cohort paired with structured laboratory panels and free-text radiology reports, in proficient medical English with the original Simplified Chinese preserved alongside.
Changelog
2026-06-26
- Added per-phase organ masks (
<phase>_organ_mask.nii.gz) — CADS multi-organ segmentation on each phase's CT grid (e.g. label 6 = stomach); all 4897 phases. - Added per-phase gastric tumor masks (
<phase>_tumor_mask.nii.gz, binary) — a patient's per-phase masks all mark the same physical lesion. - Added per-patient reference plane (
ref_plane.json+ref_plane.jpg) — liver-derived anatomical landmark per phase, with a 3-view QC figure.
| Patients (golden core) | 1403 |
| With bonus arterial phase | 688 |
| CT phases | non_contrast + venous + delayed (required) + arterial (optional) |
| NIfTI files | 4897 CT (~155 GB) |
| Organ masks (CADS) | 4897 <phase>_organ_mask.nii.gz |
| Gastric tumor masks | 4897 <phase>_tumor_mask.nii.gz (same lesion across phases) |
| Reference plane (per patient) | 1403 ref_plane.json + ref_plane.jpg |
| Lab records | 1394 / 1403 |
| Report records | 1388 / 1403 (ct_report + diagnosis) |
| Bbox annotations (lesion / nodule / stomach_body, arterial-phase) | 877 / 1403 |
| VQA items | 7223 questions across 1394 patients |
| License | CC BY-NC-ND 4.0 -- non-commercial, no derivatives, no redistribution |
Folder layout
Gastric-X/
+-- README.md
+-- LICENSE
+-- load_hu.py HU recovery helper (see "Reading the CT and bbox")
+-- metadata/
| +-- EN/
| | +-- Meta.json per-patient labs (English)
| | +-- Reports.json per-patient ct_report + diagnosis (English)
| | +-- VQA.json per-patient visual-QA items (English)
| +-- CN/
| +-- Meta.json per-patient labs (Simplified Chinese)
| +-- Reports.json per-patient ct_report + diagnosis (Simplified Chinese)
| +-- VQA.json per-patient visual-QA items (Simplified Chinese)
+-- assets/ 4-phase preview PNGs (bbox + sample VQA), 6 patients
+-- imaging/<GX####>/
+-- non_contrast.nii.gz
+-- venous.nii.gz
+-- delayed.nii.gz
+-- arterial.nii.gz (688 of 1403 patients)
+-- <phase>_organ_mask.nii.gz CADS multi-organ segmentation (per phase)
+-- <phase>_tumor_mask.nii.gz gastric-tumor mask (per phase)
+-- bbox.json (877 of 1403 patients, arterial-phase aligned)
+-- ref_plane.json per-phase anatomical reference point
+-- ref_plane.jpg 3-view (axial/coronal/sagittal) QC figure
metadata/EN/*.json and metadata/CN/*.json are paired: every patient
key in the English file is present in the Chinese file with the same
schema and equivalent content. Patient IDs are synthetic, anonymous
GX0001..GX1403; they are the same key across imaging/ and every
file under metadata/.
Annotation details
- bbox.json (per-patient): 3-D bounding boxes for
lesion,nodule, andstomach_body, annotated on the arterial-phase volume. Each file carries multiple "cases" plus anarterial_case_indexpointing to the case whose shape matchesarterial.nii.gz. Coordinates are corner-to-corner voxel indices into the NIfTI array,zyx_min/zyx_max=[axis0, axis1, axis2](axis2 = slice). Read them in this native order -- no rotation or flip. See "Reading the CT and bbox" below. - VQA.json (root):
{patient_id: [{question_id, question, answer, phase_mask, slices: {phase: [slice_idx, ...]}}]}. 22 question templates spanning T-stage, tumour location, serosal invasion, early-cancer status, and regional lymph nodes. Slice indices refer to Z-positions in the corresponding<phase>.nii.gzvolume.
Segmentation masks & reference plane
Every phase ships with two masks on the same voxel grid as that phase's CT (identical shape and affine — overlay voxel-for-voxel, no resampling/rotation/flip):
<phase>_organ_mask.nii.gz— CADS multi-organ segmentation (integer labels):1 spleen, 2 kidney_right, 3 kidney_left, 4 gallbladder, 5 liver, 6 stomach, 7 aorta, 8 ivc, 9 portal_vein_and_splenic_vein, 10 pancreas, 11/12 adrenal, 13-17 lung lobes. Present for all 4897 phases.<phase>_tumor_mask.nii.gz— binary{0,1}(uint8) gastric-tumor mask. A patient's four<phase>_tumor_maskfiles all mark the same physical lesion across phases. 5 venous series are chest-FOV scans that do not image the stomach; their tumor mask is intentionally empty.
ref_plane.json (per patient) gives a per-phase anatomical reference point
(liver-derived, one landmark per axis); ref_plane.jpg is the matching
3-view (axial / coronal / sagittal) QC figure.
{
"axis0": "anterior-posterior", "axis1": "left-right",
"axis2": "superior-inferior (slice / z_ref)",
"phases": {
"venous": { "axis0_coronal": 287, "axis1_sagittal": 235,
"axis2_axial": 78, "z_ref": 78.2, "slice_mm": 5.0,
"n_slices": 131, "qc": "ok" }
// ... one block per available phase
}
}
Using the masks
import numpy as np, nibabel as nib
pid, phase = "GX0001", "venous"
ct = np.asanyarray(nib.load(f"imaging/{pid}/{phase}.nii.gz").dataobj)
organ = np.asanyarray(nib.load(f"imaging/{pid}/{phase}_organ_mask.nii.gz").dataobj)
tumor = np.asanyarray(nib.load(f"imaging/{pid}/{phase}_tumor_mask.nii.gz").dataobj)
assert organ.shape == ct.shape == tumor.shape # same grid, overlay directly
stomach = (organ == 6) # CADS label 6
print("tumor voxels:", int((tumor > 0).sum()))
Tumor masks mark the same lesion across phases. Always check
<phase>_tumor_mask is non-empty before use (the 5 out-of-FOV venous masks are
empty by design).
How to load
Option A -- pull a single patient (fast, partial download)
from huggingface_hub import snapshot_download
import json, nibabel as nib
from pathlib import Path
ROOT = Path(snapshot_download(
repo_id="HaoChen2/Gastric-X",
repo_type="dataset",
allow_patterns=["metadata/EN/*", "imaging/GX0001/*"],
))
reports = json.load(open(ROOT / "metadata" / "EN" / "Reports.json"))
meta = json.load(open(ROOT / "metadata" / "EN" / "Meta.json"))
pid = "GX0001"
venous = nib.load(str(ROOT / "imaging" / pid / "venous.nii.gz")).get_fdata()
print("venous shape:", venous.shape)
print("diagnosis :", reports[pid].get("diagnosis", ""))
print("labs sample:", dict(list(meta.get(pid, {}).items())[:5]))
Option B -- structured tables via datasets
from datasets import load_dataset
reports = load_dataset("HaoChen2/Gastric-X", name="reports_en")["train"]
labs = load_dataset("HaoChen2/Gastric-X", name="meta_en")["train"]
vqa = load_dataset("HaoChen2/Gastric-X", name="vqa_en")["train"]
# Chinese mirrors: reports_cn / meta_cn / vqa_cn
Option C -- full mirror (~155 GB)
huggingface-cli download HaoChen2/Gastric-X --repo-type dataset \
--local-dir ./Gastric-X
Reading the CT and bbox
Hounsfield Units. NIfTI rescale slope/intercept are unset; volumes are stored
as raw 12-bit (HU + 1024), and some carry negative corner padding (e.g. -2000)
that fools a naive min >= 0 test (leaving the image over-bright). Decide the
convention from the non-padding voxels. True voxel spacing is in bbox.json
spacing_zyx_mm (slice-first: [slice, axis1, axis0]) -- the NIfTI affine is
identity, so use that, not the header.
import numpy as np, nibabel as nib
def to_hu(vol):
v = vol.astype(np.float32)
core = v[v > -1500] # ignore corner padding
if core.size and np.percentile(core, 1) >= -200:
v = v - 1024.0 # HU+1024 convention (air sits >= ~0)
return np.clip(v, -1024.0, None)
def window(hu, wl=40, ww=500): # abdomen L40/W500 -> [0,1]
return np.clip((hu - (wl - ww/2)) / ww, 0, 1)
Bounding boxes (lesion / nodule / stomach_body) are annotated on the
arterial phase. The file stores each box as two voxel-index corners
zyx_min / zyx_max, each [axis0, axis1, axis2] (axis2 = slice):
// imaging/<GX####>/bbox.json
{
"arterial_case_index": 0,
"cases": [
{
"shape_zyx": [512, 512, 53], // matches arterial.nii.gz
"spacing_zyx_mm": [5.0, 0.668, 0.668], // slice-first
"bbox": {
"lesion": { "zyx_min": [213, 170, 21], "zyx_max": [376, 297, 36] },
"nodule": { "zyx_min": [264, 181, 18], "zyx_max": [370, 294, 30] },
"stomach_body": { "zyx_min": [127, 155, 18], "zyx_max": [347, 393, 50] }
}
}
// ... more cases (other series); use cases[arterial_case_index]
]
}
Coordinate convention (exact).
- Load as
vol = np.asanyarray(nib.load(...).dataobj); shape isshape_zyx = (axis0, axis1, axis2). Despite thezyxname, the numbers are the literal array axes[axis0, axis1, axis2]—axis2is the through-plane slice;axis0/axis1are in-plane. Apply no rotation, flip, or transpose. zyx_min/zyx_maxare inclusive corners: the box occupiesvol[axis0_min:axis0_max+1, axis1_min:axis1_max+1, axis2_min:axis2_max+1].- With
imshow(vol[:, :, z], origin="upper"):axis1is the column,axis0the row; the box shows on slicesaxis2_min <= z <= axis2_max.
That fully defines the 3-D box. For visualization, draw a 2-D rectangle
on any slice z in [axis2_min, axis2_max] at column axis1_min, row
axis0_min, width axis1_max - axis1_min, height axis0_max - axis0_min:
import json, matplotlib.pyplot as plt, matplotlib.patches as patches
b = json.load(open("imaging/GX0651/bbox.json"))
case = b["cases"][b["arterial_case_index"]] # the case matching arterial.nii.gz
hu = to_hu(np.asanyarray(nib.load("imaging/GX0651/arterial.nii.gz").dataobj).astype("float32"))
les = case["bbox"]["lesion"]
z = (les["zyx_min"][2] + les["zyx_max"][2]) // 2 # a slice inside the lesion
plt.imshow(window(hu[:, :, z]), cmap="gray", origin="upper")
for name, color in {"lesion": "red", "nodule": "yellow", "stomach_body": "cyan"}.items():
s = case["bbox"].get(name)
if not s or not (s["zyx_min"][2] <= z <= s["zyx_max"][2]):
continue
x, y = s["zyx_min"][1], s["zyx_min"][0] # column=axis1, row=axis0
w, h = s["zyx_max"][1] - x, s["zyx_max"][0] - y # width, height
plt.gca().add_patch(patches.Rectangle((x, y), w, h, lw=2, edgecolor=color, facecolor="none"))
plt.axis("off"); plt.show()
Boxes are deliberately coarse 3-D regions around the stomach, not tight masks.
Sample previews are under assets/ (e.g. assets/GX0651_overview.png).
How to use
- Vision-language pre-training / fine-tuning with paired CT volumes and bilingual radiology reports.
- Multimodal modelling combining imaging, structured labs (TNM stage, tumor markers, blood counts, biochemistry) and free text.
- Cross-lingual NLP:
Reports.json/Reports_CN.jsonandMeta.json/Meta_CN.jsonform a high-quality parallel corpus of clinical Chinese <-> medical English. - Multi-phase imaging tasks: segmentation, classification, contrast-phase modelling, foundation-model pre-training.
Not for clinical or diagnostic deployment. Research and education only. Users agree not to attempt re-identification of any subject.
License & redistribution
CC BY-NC-ND 4.0 (Attribution — NonCommercial — NoDerivatives), with an explicit no-redistribution term:
- NonCommercial — research / educational use only; no commercial use.
- NoDerivatives, not ShareAlike — this is not a ShareAlike license. You may not publish or distribute modified or derivative versions of the dataset (including re-processed images, derived masks, or repackaged subsets).
- No redistribution — do not mirror, re-host, or otherwise redistribute the dataset or any part of it. Obtain it only from the official source; point others to that source rather than sharing copies.
- Attribution — cite the dataset (below) in any publication or presentation that uses it.
- No re-identification — you agree not to attempt to identify any individual represented in the data.
Provided "as is", with no warranty of fitness for clinical or diagnostic use.
Citation
@inproceedings{lu2026gastric,
title = {Gastric-X: A Multimodal Multi-Phase Benchmark Dataset for
Advancing Vision-Language Models in Gastric Cancer Analysis},
author = {Lu, Sheng and Chen, Hao and Yin, Rui and Ba, Juyan and
Zhang, Yu and Li, Yuanzhe},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision
and Pattern Recognition (CVPR) 2026},
year = {2026}
}
- Downloads last month
- 11,434