Datasets:
[release] v1.2.0: add 8 datasets, resolve annotation versions per dataset
Browse filesv1.2.0 adds 8 datasets and changes no existing annotation. Every dataset
released before this version loads exactly the same annotation files it did at
v1.1.1, byte for byte. Full note: doc/release-v1.2.0.md.
What you gain:
- 8 new datasets — AFIDs, DEEP-PSMA, LIDC-IDRI, LNQ2023, MAMA-MIA, PDDCA,
PI-CAI, VerSe. The catalogue grows from 820 to 950 configs.
- Every plane that has loadable data has a config. Tumor-Lesion-Size covers
sagittal and coronal as well as axial for MAMA-MIA, LIDC-IDRI and PI-CAI, and
DEEP-PSMA covers all three planes for Mask-Size and Box-Size across both
tracers. LNQ2023 stays axial-only on purpose: its lesions fragment on reslice,
so the single-cluster filter empties the other planes (0 of 36 sagittal and 3
of 53 coronal slices survive) — declaring them would ship empty splits.
What was wrong, and is now fixed:
- Cached data could be stale. load_dataset keeps a local copy of the rows it
built last time, and decided whether that copy was still good by comparing the
version you asked for. But asking for a version does not pin down the data: the
same request can point at different annotation files at different times. When
that happened you got the old copy back and the new annotations never reached
you. Not hypothetical — v1.1.1 changed the already-published v1.1.0
annotations in place, relabelling the train/test split of ~41% of cases across
six datasets, so the measurements looked normal while the partition differed.
The cache key is now the annotation version that actually loads.
- Two data roots could share one cache. Every row contains absolute file paths
built from MedVision_DATA_DIR, but the root was not part of the name the cache
was filed under. Point at a second root and the first root's cache answered:
nothing downloaded into the new location, and the paths led back into the old
one.
- Four download defects. A failed image download was recorded as a finished
install, so every later load skipped it and built rows pointing at files that
do not exist. Preparing two configs of one dataset at once — train and test of
one task is enough — crashed the second one. A relative MedVision_DATA_DIR
broke every download. And loading at `latest` re-fetched ~27 GiB of
annotations that had not changed.
How versions work now:
- Your version setting is a ceiling, not an exact match: each dataset loads the
newest annotations it published at or before it. Before, every task except
Tumor-Lesion-Size fell back to v1.0.0 and TL did not fall back at all — so the
162 existing TL configs would all have failed at `latest` once the release
moved to 1.2.0.
- MedVision_ACK_RELEASE is now judged per dataset, so an additive release does
not block datasets it did not touch. Nobody pinned at 1.1.1 is prompted at all.
It accepts either that dataset's newest annotation version or the release
version, since a catalogue sweep cannot use a per-dataset value.
- A version string nobody published — 1.1.5, or a malformed v1.1.1 — is now
refused with the accepted values listed, instead of quietly resolving to
something older.
Also:
- Config lists move to info/v1.2.0/; the 820-config lists are restored under
info/v1.0.0-v1.1.1/ for sweeps pinned at or below 1.1.1.
- New tests: scripts/test_annotation_resolution.py (351 checks over 950 configs
x every pin); test_tl_ack_gate.py extended to 16 cases, original 5 unmodified.
- New docs: doc/release-v1.2.0.md, doc/release-v1.2.0-datasets.md,
doc/design-annotation-version-resolution.md; update README and changelog.
- .gitignore +5 -0
- MedVision.py +0 -0
- README.md +75 -38
- doc/changelog.md +11 -0
- doc/design-annotation-version-resolution.md +481 -0
- doc/release-v1.2.0-datasets.md +381 -0
- doc/release-v1.2.0.md +302 -0
- info/{ConfigurationsList_All.csv → v1.0.0-v1.1.1/ConfigurationsList_All.csv} +0 -0
- info/{ConfigurationsList_Test.csv → v1.0.0-v1.1.1/ConfigurationsList_Test.csv} +0 -0
- info/{ConfigurationsList_Train.csv → v1.0.0-v1.1.1/ConfigurationsList_Train.csv} +0 -0
- info/v1.2.0/ConfigurationsList_All.csv +950 -0
- info/v1.2.0/ConfigurationsList_Test.csv +475 -0
- info/v1.2.0/ConfigurationsList_Train.csv +475 -0
- scripts/_medvision_test_support.py +80 -0
- scripts/test_annotation_resolution.py +603 -0
- scripts/test_tl_ack_gate.py +83 -20
- src/medvision_ds/__version__.py +1 -1
- src/medvision_ds/datasets/AFIDs/__init__.py +0 -0
- src/medvision_ds/datasets/AFIDs/download_fast.py +118 -0
- src/medvision_ds/datasets/AFIDs/download_raw.py +347 -0
- src/medvision_ds/datasets/AFIDs/preprocess_biometry.py +247 -0
- src/medvision_ds/datasets/DEEP_PSMA/__init__.py +0 -0
- src/medvision_ds/datasets/DEEP_PSMA/download_fast.py +123 -0
- src/medvision_ds/datasets/DEEP_PSMA/download_raw.py +181 -0
- src/medvision_ds/datasets/DEEP_PSMA/preprocess_biometry.py +226 -0
- src/medvision_ds/datasets/DEEP_PSMA/preprocess_detection.py +135 -0
- src/medvision_ds/datasets/DEEP_PSMA/preprocess_segmentation.py +135 -0
- src/medvision_ds/datasets/LIDC_IDRI/__init__.py +0 -0
- src/medvision_ds/datasets/LIDC_IDRI/download_fast.py +121 -0
- src/medvision_ds/datasets/LIDC_IDRI/download_raw.py +397 -0
- src/medvision_ds/datasets/LIDC_IDRI/preprocess_biometry.py +207 -0
- src/medvision_ds/datasets/LIDC_IDRI/preprocess_detection.py +128 -0
- src/medvision_ds/datasets/LIDC_IDRI/preprocess_segmentation.py +128 -0
- src/medvision_ds/datasets/LNQ2023/__init__.py +0 -0
- src/medvision_ds/datasets/LNQ2023/download_fast.py +119 -0
- src/medvision_ds/datasets/LNQ2023/download_raw.py +313 -0
- src/medvision_ds/datasets/LNQ2023/preprocess_biometry.py +207 -0
- src/medvision_ds/datasets/LNQ2023/preprocess_detection.py +128 -0
- src/medvision_ds/datasets/LNQ2023/preprocess_segmentation.py +128 -0
- src/medvision_ds/datasets/MAMA_MIA/__init__.py +0 -0
- src/medvision_ds/datasets/MAMA_MIA/download_fast.py +121 -0
- src/medvision_ds/datasets/MAMA_MIA/download_raw.py +254 -0
- src/medvision_ds/datasets/MAMA_MIA/preprocess_biometry.py +210 -0
- src/medvision_ds/datasets/MAMA_MIA/preprocess_detection.py +131 -0
- src/medvision_ds/datasets/MAMA_MIA/preprocess_segmentation.py +131 -0
- src/medvision_ds/datasets/PDDCA/__init__.py +0 -0
- src/medvision_ds/datasets/PDDCA/download_fast.py +155 -0
- src/medvision_ds/datasets/PDDCA/download_raw.py +361 -0
- src/medvision_ds/datasets/PDDCA/preprocess_biometry.py +195 -0
- src/medvision_ds/datasets/PDDCA/preprocess_detection.py +138 -0
|
@@ -180,3 +180,8 @@ bak
|
|
| 180 |
.DS_Store
|
| 181 |
*.log
|
| 182 |
dev/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
.DS_Store
|
| 181 |
*.log
|
| 182 |
dev/
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
# Claude Code
|
| 186 |
+
CLAUDE.md
|
| 187 |
+
.worktrees
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
@@ -25,9 +25,9 @@ size_categories:
|
|
| 25 |
MedVision Dataset
|
| 26 |
</div>
|
| 27 |
|
| 28 |
-
| 🌏 [**Project**](https://medvision-vlm.github.io) | 🧑🏻💻 [**Code**](https://github.com/YongchengYAO/MedVision) | 🩻 [**Dataset**](https://huggingface.co/datasets/YongchengYAO/MedVision) | [**Data Explorer**](https://medvision-vlm.github.io/explorer.html) | 🤗 [**Models**](https://huggingface.co/collections/YongchengYAO/medvision-v0) | 📖 [**arXiv**](https://arxiv.org/abs/2511.18676) |
|
| 29 |
|
| 30 |
-
💿
|
| 31 |
|
| 32 |
📏 Annotation: segmentation mask | landmark coordinate | bounding box | tumor/lesion size | distance | angle 📏
|
| 33 |
|
|
@@ -52,14 +52,21 @@ MedVision Dataset
|
|
| 52 |
|
| 53 |
# News
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
- [Jun 29, 2026] 🚀 Release **MedVision** dataset v1.1.1 [[release-v1.1.1]](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/release-v1.1.1.md)
|
| 56 |
- Highlight: corrected T/L ellipse fit — fixes a transposed in-plane voxel-spacing bug (wrong axis lengths and major/minor labelling on anisotropic slices, e.g. sagittal/coronal); ~22% fewer T/L samples on anisotropic data, isotropic data (e.g. KiPA22) essentially unchanged
|
| 57 |
- The codebase `medvision_ds` will be automatically updated to the latest (v1.1.1)
|
| 58 |
- Backward compatibility: `MedVision_PLANNER_VERSION='latest'` now resolves to v1.1.1; pin `'1.1.0'` or `'1.0.0'` for earlier annotations. Only the Tumor-Lesion-Size task changed — all other tasks fall back to v1.0.0.
|
|
|
|
| 59 |
- [May 14, 2026] 🚀 Release **MedVision** dataset v1.1.0 [[release-v1.1.0]](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/release-v1.1.0.md)
|
| 60 |
- Highlight: new T/L samples filtering (with ambiguous cases removed), more T/L samples with a single small target (cluster size > 20)
|
| 61 |
- The codebase `medvision_ds` will be automatically updated to the latest (v1.1.0)
|
| 62 |
- Backward compatibility: the env var `MedVision_PLANNER_VERSION` is required (v1.1.0+) to specify the annotation data version. Setting `MedVision_PLANNER_VERSION='1.0.0'` will fall back to **MedVision** dataset v1.0.0.
|
|
|
|
| 63 |
- [Oct 8, 2025] 🚀 Release **MedVision** dataset v1.0.0
|
| 64 |
|
| 65 |
<br/>
|
|
@@ -78,34 +85,44 @@ For essential updates, check the [change log](https://huggingface.co/datasets/Yo
|
|
| 78 |
quantitative annotations from this study. MRI: Magnetic Resonance Imaging;
|
| 79 |
CT: Computed Tomography; PET: positron emission tomography; US: Ultrasound;
|
| 80 |
b-box: bounding box; T/L: tumor/lesion size; A/D: angle/distance; HF:
|
| 81 |
-
HuggingFace; GC: Grand-Challenge; * redistributed.
|
| 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 |
⚠️ For the following datasets, which do not allow redistribution, you need to apply for access from data owners, (optionally) upload to your private HF dataset repo, and set corresponding environment variables.
|
| 111 |
|
|
@@ -140,6 +157,9 @@ from datasets import load_dataset
|
|
| 140 |
# Set data folder
|
| 141 |
os.environ["MedVision_DATA_DIR"] = <your/data/folder>
|
| 142 |
|
|
|
|
|
|
|
|
|
|
| 143 |
# Pick a dataset config name and split
|
| 144 |
config = <config-name> # e.g., "OAIZIB-CM_BoxSize_Task01_Axial_Test"
|
| 145 |
split_name = "test" # use "test" for testing set config; use "train" for training set config
|
|
@@ -152,7 +172,7 @@ ds = load_dataset(
|
|
| 152 |
split=split_name,
|
| 153 |
)
|
| 154 |
```
|
| 155 |
-
📝 List of config names [here](https://huggingface.co/datasets/YongchengYAO/MedVision/tree/main/info) (`./info`)
|
| 156 |
|
| 157 |
<br/>
|
| 158 |
|
|
@@ -162,15 +182,27 @@ ds = load_dataset(
|
|
| 162 |
# Set where data will be saved, requires ~1T for the complete dataset
|
| 163 |
export MedVision_DATA_DIR=<your/data/folder>
|
| 164 |
|
| 165 |
-
# Required:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
export MedVision_PLANNER_VERSION=latest
|
| 167 |
|
| 168 |
-
# Acknowledges you
|
| 169 |
-
#
|
| 170 |
-
# ANY task.
|
| 171 |
-
#
|
| 172 |
-
#
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
# Force download and process raw images, default to "False"
|
| 176 |
export MedVision_FORCE_DOWNLOAD_DATA="False"
|
|
@@ -570,6 +602,11 @@ There are a few venues to control the dataset loading and building behavior:
|
|
| 570 |
> **Summary:**
|
| 571 |
> - Update Arrow/Fields only: Use [1].
|
| 572 |
> - Update Raw Data: Use [1] **AND** ([2] or [3]).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
>
|
| 574 |
> 🔥 We will maintain a [change log](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/changelog.md) for essential updates.
|
| 575 |
|
|
|
|
| 25 |
MedVision Dataset
|
| 26 |
</div>
|
| 27 |
|
| 28 |
+
| 🌏 [**Project**](https://medvision-vlm.github.io) | 🧑🏻💻 [**Code**](https://github.com/YongchengYAO/MedVision) | 🩻 [**Dataset**](https://huggingface.co/datasets/YongchengYAO/MedVision) | 🔎 [**Data Explorer**](https://medvision-vlm.github.io/explorer.html) | 🤗 [**Models**](https://huggingface.co/collections/YongchengYAO/medvision-v0) | 📖 [**arXiv**](https://arxiv.org/abs/2511.18676) | 💼 [**LinkedIn**](https://www.linkedin.com/in/yongcheng-yao-379b44279) |
|
| 29 |
|
| 30 |
+
💿 32.7K 3D images | 11.9M 2D slices | 24.7M single-instance / 46.7M multi-instance annotations | multi-modality | multi-anatomy 💿
|
| 31 |
|
| 32 |
📏 Annotation: segmentation mask | landmark coordinate | bounding box | tumor/lesion size | distance | angle 📏
|
| 33 |
|
|
|
|
| 52 |
|
| 53 |
# News
|
| 54 |
|
| 55 |
+
- [Jul 28, 2026] 🚀 Release **MedVision** dataset v1.2.0 [[release-v1.2.0]](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/release-v1.2.0.md)
|
| 56 |
+
- Highlight: 8 new datasets (130 configs) — AFIDs, DEEP-PSMA, LIDC-IDRI, LNQ2023, MAMA-MIA, PDDCA, PI-CAI, VerSe.
|
| 57 |
+
- **No existing annotation changed.** Annotation versions now resolve per dataset: the version you set is a *ceiling*, and each dataset loads the newest annotation it published at or before it. Pinning `'1.1.1'` or older keeps working for every pre-existing dataset (check [Annotation Version Control](https://medvision-vlm.github.io/explorer.html)).
|
| 58 |
+
- ⚠️ **Fixes a stale-cache defect present in all earlier versions.** The cache key used the version you *requested* rather than the annotation actually loaded, so `load_dataset` could silently return previously cached rows after the annotations changed — which really happened, to the v1.1.0 T/L train/test split. See [Fixed: cached data could be stale](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/release-v1.2.0.md#fixed-cached-data-could-be-stale) for who is affected and how to clear it. The data root is now part of the key too, which matters only if your HuggingFace cache is not already co-located with it. Because the cache key changed, **existing Arrow caches rebuild once** on next use (reads the annotation file, no re-download)
|
| 59 |
+
|
| 60 |
- [Jun 29, 2026] 🚀 Release **MedVision** dataset v1.1.1 [[release-v1.1.1]](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/release-v1.1.1.md)
|
| 61 |
- Highlight: corrected T/L ellipse fit — fixes a transposed in-plane voxel-spacing bug (wrong axis lengths and major/minor labelling on anisotropic slices, e.g. sagittal/coronal); ~22% fewer T/L samples on anisotropic data, isotropic data (e.g. KiPA22) essentially unchanged
|
| 62 |
- The codebase `medvision_ds` will be automatically updated to the latest (v1.1.1)
|
| 63 |
- Backward compatibility: `MedVision_PLANNER_VERSION='latest'` now resolves to v1.1.1; pin `'1.1.0'` or `'1.0.0'` for earlier annotations. Only the Tumor-Lesion-Size task changed — all other tasks fall back to v1.0.0.
|
| 64 |
+
|
| 65 |
- [May 14, 2026] 🚀 Release **MedVision** dataset v1.1.0 [[release-v1.1.0]](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/release-v1.1.0.md)
|
| 66 |
- Highlight: new T/L samples filtering (with ambiguous cases removed), more T/L samples with a single small target (cluster size > 20)
|
| 67 |
- The codebase `medvision_ds` will be automatically updated to the latest (v1.1.0)
|
| 68 |
- Backward compatibility: the env var `MedVision_PLANNER_VERSION` is required (v1.1.0+) to specify the annotation data version. Setting `MedVision_PLANNER_VERSION='1.0.0'` will fall back to **MedVision** dataset v1.0.0.
|
| 69 |
+
|
| 70 |
- [Oct 8, 2025] 🚀 Release **MedVision** dataset v1.0.0
|
| 71 |
|
| 72 |
<br/>
|
|
|
|
| 85 |
quantitative annotations from this study. MRI: Magnetic Resonance Imaging;
|
| 86 |
CT: Computed Tomography; PET: positron emission tomography; US: Ultrasound;
|
| 87 |
b-box: bounding box; T/L: tumor/lesion size; A/D: angle/distance; HF:
|
| 88 |
+
HuggingFace; GC: Grand-Challenge; * redistributed. Sample counts are for
|
| 89 |
+
annotation **v1.2.0** — b-box and A/D are identical in every release, and
|
| 90 |
+
only T/L was ever regenerated (in 1.1.0 and 1.1.1).
|
| 91 |
+
|
| 92 |
+
| **Dataset** | **Anatomy** | **Modality** | **Annotation** | **Availability** | **Source** | **# Sample (Train/Test)** | | | **Status** |
|
| 93 |
+
| ---------------- | ------------- | ------------ | -------------- | ---------------- | -------------- | ------------------------- | ------------ | -------------- | ---------- |
|
| 94 |
+
| | | | | | | **b-box** | **T/L** | **A/D** | |
|
| 95 |
+
| AbdomenAtlas | abdomen | CT | b-box | open | HF | 6.8 / 2.9M | 0 | 0 | ✅ |
|
| 96 |
+
| AbdomenCT-1K | abdomen | CT | b-box | open | Zenodo | 0.7 / 0.3M | 0 | 0 | ✅ |
|
| 97 |
+
| ACDC | heart | MRI | b-box | open | HF*, others | 9.5 / 4.8K | 0 | 0 | ✅ |
|
| 98 |
+
| AFIDs | brain | MRI | A/D | open | HF*, OpenNeuro | 0 | 0 | 300 / 132 | ✅ |
|
| 99 |
+
| AMOS22 | abdomen | CT, MRI | b-box | open | Zenodo | 0.5 / 0.2M | 0 | 0 | ✅ |
|
| 100 |
+
| autoPET-III | whole body | CT, PET | b-box, T/L | open | HF*, others | 22 / 9.9K | 570 / 309 | 0 | ✅ |
|
| 101 |
+
| BCV15 | abdomen | CT | b-box | open | HF*, Synapse | 48 / 20K | 0 | 0 | ✅ |
|
| 102 |
+
| BraTS24 | brain | MRI | b-box, T/L | open | HF*, Synapse | 0.8 / 0.3M | 11 / 4.6K | 0 | ✅ |
|
| 103 |
+
| CAMUS | heart | US | b-box | open | HF*, others | 0.7 / 0.3M | 0 | 0 | ✅ |
|
| 104 |
+
| Ceph-Bio-400 | head and neck | X-ray | A/D | open | HF*, others | 0 | 0 | 5.3 / 2.3K | ✅ |
|
| 105 |
+
| CrossMoDA | brain | MRI | b-box | open | HF*, Zenodo | 3.0 / 1.0K | 0 | 0 | ✅ |
|
| 106 |
+
| DEEP-PSMA | whole body | PET | b-box, T/L | open | HF*, Zenodo | 1.3 / 0.9K | 34 / 60 | 0 | ✅ |
|
| 107 |
+
| FeTA24 | fetal brain | MRI | b-box, A/D | registration | Synapse | 34 / 15K | 0 | 225 / 100 | ✅ |
|
| 108 |
+
| FLARE22 | abdomen | CT | b-box | open | HF*, others | 72 / 33K | 0 | 0 | ✅ |
|
| 109 |
+
| HNTSMRG24 | head and neck | MRI | b-box, T/L | open | Zenodo | 23 / 9.4K | 1.6 / 0.6K | 0 | ✅ |
|
| 110 |
+
| ISLES24 | brain | MRI | b-box | open | HF*, GC | 7.2 / 2.6K | 0 | 0 | ✅ |
|
| 111 |
+
| KiPA22 | kidney | CT | b-box, T/L | open | HF*, GC | 26 / 11K | 2.0 / 1.0K | 0 | ✅ |
|
| 112 |
+
| KiTS23 | kidney | CT | b-box, T/L | open | HF*, GC | 80 / 35K | 5.0 / 2.1K | 0 | ✅ |
|
| 113 |
+
| LIDC-IDRI | lung | CT | b-box, T/L | open | HF*, TCIA | 7.3 / 3.0K | 314 / 103 | 0 | ✅ |
|
| 114 |
+
| LNQ2023 | mediastinum | CT | b-box, T/L | open | HF*, TCIA | 1.2 / 0.5K | 34 / 11 | 0 | ✅ |
|
| 115 |
+
| MAMA-MIA | breast | MRI | b-box, T/L | open | HF*, Synapse | 47 / 21K | 2.3 / 1.0K | 0 | ✅ |
|
| 116 |
+
| MSD | multiple | CT, MRI | b-box, T/L | open | others | 0.2 / 0.1M | 4.3 / 1.8K | 0 | ✅ |
|
| 117 |
+
| OAIZIB-CM | knee | MRI | b-box | open | HF | 0.5 / 0.2M | 0 | 0 | ✅ |
|
| 118 |
+
| PDDCA | head and neck | CT | b-box, A/D | open | HF*, others | 10 / 4.8K | 0 | 92 / 40 | ✅ |
|
| 119 |
+
| PI-CAI | prostate | MRI | b-box, T/L | open | HF*, Zenodo | 3.9 / 1.6K | 238 / 157 | 0 | ✅ |
|
| 120 |
+
| SKM-TEA | knee | MRI | b-box | registration | others | 0.2 / 0.1M | 0 | 0 | ✅ |
|
| 121 |
+
| ToothFairy2 | tooth | CT | b-box | registration | others | 1.0 / 0.4M | 0 | 0 | ✅ |
|
| 122 |
+
| TopCoW24 | brain | CT, MRI | b-box | open | HF*, Zenodo | 29 / 13K | 0 | 0 | ✅ |
|
| 123 |
+
| TotalSegmentator | multiple | CT, MRI | b-box | open | HF*, Zenodo | 5.4 / 2.2M | 0 | 0 | ✅ |
|
| 124 |
+
| VerSe | spine | CT | b-box, A/D | open | HF*, others | 0.2 / 0.1M | 0 | 1.1 / 0.5K | ✅ |
|
| 125 |
+
| **Total** | | | | | | **17 / 7.3M** | **28 / 12K** | **7.0 / 3.0K** | |
|
| 126 |
|
| 127 |
⚠️ For the following datasets, which do not allow redistribution, you need to apply for access from data owners, (optionally) upload to your private HF dataset repo, and set corresponding environment variables.
|
| 128 |
|
|
|
|
| 157 |
# Set data folder
|
| 158 |
os.environ["MedVision_DATA_DIR"] = <your/data/folder>
|
| 159 |
|
| 160 |
+
# Required: annotation version. No default — loading raises without it.
|
| 161 |
+
os.environ["MedVision_PLANNER_VERSION"] = "latest"
|
| 162 |
+
|
| 163 |
# Pick a dataset config name and split
|
| 164 |
config = <config-name> # e.g., "OAIZIB-CM_BoxSize_Task01_Axial_Test"
|
| 165 |
split_name = "test" # use "test" for testing set config; use "train" for training set config
|
|
|
|
| 172 |
split=split_name,
|
| 173 |
)
|
| 174 |
```
|
| 175 |
+
📝 List of config names [here](https://huggingface.co/datasets/YongchengYAO/MedVision/tree/main/info/v1.2.0) (`./info/v1.2.0`, 950 configs). Config lists are versioned: use [`./info/v1.0.0-v1.1.1`](https://huggingface.co/datasets/YongchengYAO/MedVision/tree/main/info/v1.0.0-v1.1.1) (820 configs) when pinning an annotation version below 1.2.0, since datasets added in v1.2.0 cannot be loaded at an earlier version.
|
| 176 |
|
| 177 |
<br/>
|
| 178 |
|
|
|
|
| 182 |
# Set where data will be saved, requires ~1T for the complete dataset
|
| 183 |
export MedVision_DATA_DIR=<your/data/folder>
|
| 184 |
|
| 185 |
+
# Required: the newest annotations you are willing to load (no default; unset
|
| 186 |
+
# raises an error). Accepted: 'latest', any published annotation version
|
| 187 |
+
# (1.0.0 | 1.1.0 | 1.1.1 | 1.2.0), or the medvision_ds release version.
|
| 188 |
+
# Anything else — a malformed value like 'v1.1.1' or '1.2', or a well-formed but
|
| 189 |
+
# unpublished one like '1.1.5' — is refused, with the accepted set listed.
|
| 190 |
+
#
|
| 191 |
+
# The value is a CEILING, not a selection: each dataset loads the newest
|
| 192 |
+
# annotation published at or before it. So a release that did not regenerate a
|
| 193 |
+
# dataset never changes what that dataset loads, and datasets introduced after
|
| 194 |
+
# the version you pin cannot be loaded at that version.
|
| 195 |
export MedVision_PLANNER_VERSION=latest
|
| 196 |
|
| 197 |
+
# Acknowledges that you are deliberately loading an older annotation. Required
|
| 198 |
+
# ONLY when you pin a version older than the newest one published FOR THE DATASET
|
| 199 |
+
# you are loading, for ANY task. Two values are accepted: that dataset's newest
|
| 200 |
+
# annotation version, or the release version as a blanket acknowledgement. The
|
| 201 |
+
# error tells you both. Use the release value for a catalogue sweep — one env var
|
| 202 |
+
# cannot hold several per-dataset values. Pinning an older version is a valid
|
| 203 |
+
# choice when the latest fix does not affect your task or slices;
|
| 204 |
+
# see doc/release-v1.2.0.md for what changed.
|
| 205 |
+
export MedVision_ACK_RELEASE=1.2.0
|
| 206 |
|
| 207 |
# Force download and process raw images, default to "False"
|
| 208 |
export MedVision_FORCE_DOWNLOAD_DATA="False"
|
|
|
|
| 602 |
> **Summary:**
|
| 603 |
> - Update Arrow/Fields only: Use [1].
|
| 604 |
> - Update Raw Data: Use [1] **AND** ([2] or [3]).
|
| 605 |
+
|
| 606 |
+
> [!Important]
|
| 607 |
+
> **When would I need this?** Normally never — v1.2.0 keys the Arrow cache on the annotation version actually loaded, so a cache is invalidated whenever the annotations behind it change.
|
| 608 |
+
>
|
| 609 |
+
> There is one historical exception. Versions before v1.2.0 keyed the cache on the version you *requested*, and the v1.1.1 release re-aligned the already-published v1.1.0 T/L train/test split in place without a version bump. A cache built for a `Tumor-Lesion-Size` config at `MedVision_PLANNER_VERSION=1.1.0` before that release still holds the old partition, at both the Arrow and annotation-file layers. Clear it with [1] **AND** [2] once. See [Fixed: cached data could be stale](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/release-v1.2.0.md#fixed-cached-data-could-be-stale).
|
| 610 |
>
|
| 611 |
> 🔥 We will maintain a [change log](https://huggingface.co/datasets/YongchengYAO/MedVision/blob/main/doc/changelog.md) for essential updates.
|
| 612 |
|
|
@@ -2,6 +2,17 @@
|
|
| 2 |
|
| 3 |
This is a summary of essential changes.
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
- [Jul, 2026] [feat] add `MedVision_DISABLE_SAMPLE_FILTERING` (default off) to bypass the per-sample quality/size filters (Mask-Size, Box-Size, Tumor-Lesion-Size) and return all planner samples; the distance/angle task split is preserved @ [bbc65ed893c05b0a8a3d05dfb32d0beda3835c5e](https://huggingface.co/datasets/YongchengYAO/MedVision/commit/bbc65ed893c05b0a8a3d05dfb32d0beda3835c5e)
|
| 6 |
- [Jul, 2026] [chore] fix typo in label name of TopCoW24: arterr --> artery @ [21f7a5b62b1d146ac2ae119035eb2bed2e2c1a49](https://huggingface.co/datasets/YongchengYAO/MedVision/commit/21f7a5b62b1d146ac2ae119035eb2bed2e2c1a49)
|
| 7 |
- [Jun, 2026] [feat] require `MedVision_ACK_RELEASE` to load any annotation version older than the latest, for all tasks (forces release-note acknowledgement)
|
|
|
|
| 2 |
|
| 3 |
This is a summary of essential changes.
|
| 4 |
|
| 5 |
+
- [Jul, 2026] [release] release **MedVision dataset v1.2.0** @ [0596d4e2aa5910ce58b7423ed4899624b39a741e](https://huggingface.co/datasets/YongchengYAO/MedVision/commit/0596d4e2aa5910ce58b7423ed4899624b39a741e) [b8ba35c7617f47c432d15cb8ef30ac74204d3f6d](https://huggingface.co/datasets/YongchengYAO/MedVision/commit/b8ba35c7617f47c432d15cb8ef30ac74204d3f6d)
|
| 6 |
+
- **8 new datasets** — AFIDs, DEEP-PSMA, LIDC-IDRI, LNQ2023, MAMA-MIA, PDDCA, PI-CAI, VerSe; 820 → 950 configs. No existing annotation was regenerated
|
| 7 |
+
- [feat] **resolve annotation versions per (dataset, task)** — the version you set is a ceiling, and each dataset loads the newest annotation it published at or before it. Replaces the hardcoded v1.0.0 fallback and its Tumor-Lesion-Size exclusion, under which the 162 pre-existing TL configs would all have failed at `latest` once the release moved to 1.2.0
|
| 8 |
+
- [feat] **`MedVision_ACK_RELEASE` now triggers per dataset**, so an additive release does not block datasets it did not touch. It accepts either that dataset's newest annotation version or the release version — the first expires when that dataset is regenerated, the second at the next release; a catalogue sweep needs the second, since one env var cannot hold several per-dataset values
|
| 9 |
+
- [fix] **key the HF builder-cache fingerprint on the annotation version resolved**, not the one requested — the old key could not tell that a pin's underlying data had changed, so `load_dataset` silently served stale cached rows. This really happened, to the v1.1.0 T/L split re-aligned in place by v1.1.1. See the "Fixed: cached data could be stale" section of `doc/release-v1.2.0.md`
|
| 10 |
+
- [fix] **include `MedVision_DATA_DIR` in the cache key** — it prefixes every path field of every row, so each root now keeps its own cache. Only ever reachable when the Arrow cache is not co-located with the data root, i.e. plain `load_dataset` with only `MedVision_DATA_DIR` set; anything going through `medvision_bm`'s `setup_env_hf_medvision_ds` was unaffected. One-time effect: existing Arrow caches are orphaned and rebuild on next use (reads the plan file, no re-download)
|
| 11 |
+
- [fix] **decide the annotation re-download from the dataset directory and the published version index** instead of `.downloaded_datasets.json` — loading at `latest` no longer re-downloads ~27 GiB of unchanged annotations, and tracker entries recording a version the dataset never had are self-healed. The tracker entry is still read, but for presence only: it marks that a previous install finished
|
| 12 |
+
- [fix] **a failed raw-image download can no longer be recorded as a completed install** — the download step used to swallow the failure (a bare `except:` that blindly re-ran the whole multi-GB transfer, plus an outer `except subprocess.CalledProcessError`) and write the completion marker anyway, so every later load skipped the download and the dataset built with image paths that do not exist. The bare `except:` also swallowed Ctrl-C, restarting a long download instead of aborting
|
| 13 |
+
- [fix] **serialise the per-dataset annotation zip** (download → extract → delete) under its own lock — HuggingFace's builder lock is per config, so two configs of one dataset prepared concurrently both extracted into the same tree and the second died at `os.remove` with a bare `FileNotFoundError`
|
| 14 |
+
- [fix] **canonicalise `MedVision_DATA_DIR` to an absolute path once** — a relative value made the per-dataset download scripts' own `os.chdir(dataset_dir)` resolve against the loader's earlier chdir and fail, so no dataset could be downloaded at all. A blank value is now rejected instead of silently resolving to the current directory
|
| 15 |
+
- [fix] **validate `MedVision_PLANNER_VERSION` against the published annotation versions** derived from `_ANNOTATION_INDEX`, plus the release version. Malformed values (`v1.1.1`, `1.2`) and well-formed but unpublished ones (`1.1.5`, `0.0.0`) are refused with the accepted set listed, instead of silently resolving down to an older annotation or leaving every config unloadable
|
| 16 |
- [Jul, 2026] [feat] add `MedVision_DISABLE_SAMPLE_FILTERING` (default off) to bypass the per-sample quality/size filters (Mask-Size, Box-Size, Tumor-Lesion-Size) and return all planner samples; the distance/angle task split is preserved @ [bbc65ed893c05b0a8a3d05dfb32d0beda3835c5e](https://huggingface.co/datasets/YongchengYAO/MedVision/commit/bbc65ed893c05b0a8a3d05dfb32d0beda3835c5e)
|
| 17 |
- [Jul, 2026] [chore] fix typo in label name of TopCoW24: arterr --> artery @ [21f7a5b62b1d146ac2ae119035eb2bed2e2c1a49](https://huggingface.co/datasets/YongchengYAO/MedVision/commit/21f7a5b62b1d146ac2ae119035eb2bed2e2c1a49)
|
| 18 |
- [Jun, 2026] [feat] require `MedVision_ACK_RELEASE` to load any annotation version older than the latest, for all tasks (forces release-note acknowledgement)
|
|
@@ -0,0 +1,481 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Design: per-dataset annotation version resolution
|
| 2 |
+
|
| 3 |
+
**Status: implemented and shipped in v1.2.0.** This document is the *design rationale* — why the
|
| 4 |
+
mechanism has the shape it has. For the user-facing contract, see
|
| 5 |
+
[`doc/release-v1.2.0.md`](release-v1.2.0.md).
|
| 6 |
+
|
| 7 |
+
Context: `MedVision.py` bumps `MedVisionConfig.version` from `1.1.1` to `1.2.0` and adds 8
|
| 8 |
+
datasets whose benchmark plans exist **only** at `v1.2.0`.
|
| 9 |
+
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
## 1. Root cause
|
| 13 |
+
|
| 14 |
+
**In plain English.** Two different things were both called "the version", and they move at
|
| 15 |
+
different speeds. One is the version of the *release* — it goes up every time anything ships. The
|
| 16 |
+
other is the version of *one dataset's annotations for one task* — it goes up only when those
|
| 17 |
+
particular annotations are regenerated, which is rare. The loader assumed the two were the same
|
| 18 |
+
number. That assumption held only by luck: until v1.2.0, every release happened to regenerate
|
| 19 |
+
something, and the fallback rule happened to describe what had been regenerated.
|
| 20 |
+
|
| 21 |
+
**Technically.** `MedVision.py` conflated both under one scalar, `_planner_version`:
|
| 22 |
+
|
| 23 |
+
| Concept | What it really is | Changes when |
|
| 24 |
+
| --- | --- | --- |
|
| 25 |
+
| **Release version** (`self.config.version`) | a property of the *repo* | every release, monotonically |
|
| 26 |
+
| **Annotation version** (the `_v{X}` in `benchmark_plan_*_v{X}.json.gz`) | a property of a *(dataset, plan-kind)* pair | only when that dataset's plan is actually regenerated |
|
| 27 |
+
|
| 28 |
+
`benchmark_planner.py` reinforces the conflation: `self.version = __version__` (line 34), so a
|
| 29 |
+
plan file is stamped with the *installed package version* at generation time, not with anything
|
| 30 |
+
describing the dataset.
|
| 31 |
+
|
| 32 |
+
The one place the old loader admitted they differ was a hardcoded fallback:
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
if not os.path.exists(bm_plan_file) and self.config.taskType != "Tumor-Lesion-Size":
|
| 36 |
+
fallback_version = "1.0.0"
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
That branch encodes a historical snapshot — *"every annotation update after v1.0.0 changed only
|
| 40 |
+
the TL task"* — as control flow. v1.2.0 falsifies that statement in both directions, so the
|
| 41 |
+
branch is wrong in both directions.
|
| 42 |
+
|
| 43 |
+
**Task-type-wise fallback cannot work**, because the axis of variation is *(dataset ×
|
| 44 |
+
plan-kind)*, not *task type*. Two datasets in the same task type now legitimately have disjoint
|
| 45 |
+
version sets.
|
| 46 |
+
|
| 47 |
+
### Measured version matrix
|
| 48 |
+
|
| 49 |
+
Plan files actually published (verified by listing `Datasets/*.zip` and the regenerated data in
|
| 50 |
+
`MedVision-data/Datasets/`):
|
| 51 |
+
|
| 52 |
+
| Group | Datasets | segmentation | detection | biometry |
|
| 53 |
+
| --- | --- | --- | --- | --- |
|
| 54 |
+
| Pre-existing, non-TL | 16 | `1.0.0` | `1.0.0` | `1.0.0` (Ceph-Biometrics-400, FeTA24 only) |
|
| 55 |
+
| Pre-existing, TL | 6 — BraTS24, HNTSMRG24, KiPA22, KiTS23, MSD, autoPET-III | `1.0.0` | `1.0.0` | `1.0.0`, `1.1.0`, `1.1.1` |
|
| 56 |
+
| New in v1.2.0 | 8 — AFIDs, DEEP-PSMA, LIDC-IDRI, LNQ2023, MAMA-MIA, PDDCA, PI-CAI, VerSe | `1.2.0` | `1.2.0` | `1.2.0` |
|
| 57 |
+
|
| 58 |
+
Config counts: 950 total = 820 pre-existing (324 Mask-Size, 324 Box-Size, 162 Tumor-Lesion-Size,
|
| 59 |
+
10 Biometrics-From-Landmarks) + 130 new.
|
| 60 |
+
|
| 61 |
+
Note the two version sets are **disjoint**: no pre-existing dataset has a `1.2.0` plan, and no
|
| 62 |
+
new dataset has a `1.0.0`/`1.1.x` plan. So under the old loader, whichever single version the
|
| 63 |
+
user pinned was wrong for one of the two groups — there was **no value of
|
| 64 |
+
`MedVision_PLANNER_VERSION` that loaded the whole catalogue.**
|
| 65 |
+
|
| 66 |
+
---
|
| 67 |
+
|
| 68 |
+
## 2. Defects in the pre-v1.2.0 loader
|
| 69 |
+
|
| 70 |
+
Five defects, all verified against the branch before the fix.
|
| 71 |
+
|
| 72 |
+
### A. `PLANNER_VERSION=latest`, pre-existing dataset, TL task — silent bad path, late crash
|
| 73 |
+
|
| 74 |
+
162 configs across the 6 TL datasets. `get_bm_plan_file(dataset_dir, "1.2.0")` yields
|
| 75 |
+
`benchmark_plan_biometry_v1.2.0.json.gz`, which does not exist. The recovery block was explicitly
|
| 76 |
+
guarded by `taskType != "Tumor-Lesion-Size"`, so it was **skipped**. `bm_plan_file` stayed a
|
| 77 |
+
non-existent path, was passed unchecked into `_generate_examples`, and died at `gzip.open()` with
|
| 78 |
+
a bare `FileNotFoundError` — *after* the dataset had already downloaded, with no version context
|
| 79 |
+
in the message.
|
| 80 |
+
|
| 81 |
+
This was the headline bug.
|
| 82 |
+
|
| 83 |
+
### B. `PLANNER_VERSION=latest`, pre-existing dataset, non-TL task — works, but lies
|
| 84 |
+
|
| 85 |
+
658 configs. Falls back to `1.0.0` and loads correctly, but the printed notice asserts something
|
| 86 |
+
false ("Every annotation update after v1.0.0 changed only the Tumor-Lesion-Size task"). It prints
|
| 87 |
+
once per *task type*, so a full sweep showed 3 notices and the user could not tell which datasets
|
| 88 |
+
fell back.
|
| 89 |
+
|
| 90 |
+
### C. `PLANNER_VERSION=1.1.1` (a user pinning today's latest) — every config breaks
|
| 91 |
+
|
| 92 |
+
The ack gate compared the pin against the global release version. `1.1.1 < 1.2.0` and no ack set,
|
| 93 |
+
so it raised `EnvironmentError` for **all 950 configs** — including the 658 whose annotations are
|
| 94 |
+
byte-identical between the two releases. Every existing pipeline would break the day v1.2.0
|
| 95 |
+
landed.
|
| 96 |
+
|
| 97 |
+
After setting `MedVision_ACK_RELEASE=1.2.0`, the new datasets were still unreachable: they
|
| 98 |
+
requested `_v1.1.1`, which does not exist.
|
| 99 |
+
|
| 100 |
+
### D. Download-cache thrash — ~27 GiB of needless transfer
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
_needs_download = force_download_data or _downloaded_data_version is None \
|
| 104 |
+
or _version_tuple(_downloaded_data_version) < _version_tuple(_planner_version_for_check)
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
With `_planner_version = 1.2.0`, every pre-existing dataset (cached as `1.0.0` or `1.1.1`)
|
| 108 |
+
compares strictly less, so **all 22 annotation zips are re-fetched** — 28,025 MiB, of which
|
| 109 |
+
KiTS23 alone is 9,597 MiB — despite not one of their plan files having changed. Plus an
|
| 110 |
+
unconditional in-place RAS+ reorientation of the whole image corpus.
|
| 111 |
+
|
| 112 |
+
Worse, the loader then recorded `dataset_<name> = "1.2.0"`, a version that dataset does not
|
| 113 |
+
possess. The cache stored a fiction that the next release's comparison would trust.
|
| 114 |
+
|
| 115 |
+
### E. Builder-cache fingerprint keyed on the requested version
|
| 116 |
+
|
| 117 |
+
`_planner_version` was part of the builder fingerprint, so the bump discarded the Arrow cache for
|
| 118 |
+
all 950 configs and forced full regeneration, including for the 658 configs whose output bytes
|
| 119 |
+
are unchanged.
|
| 120 |
+
|
| 121 |
+
**E is the serious one, in the opposite direction.** Keying on the *requested* version does not
|
| 122 |
+
merely over-invalidate; it also **under**-invalidates, and that had already served stale data in
|
| 123 |
+
production. See §4.5.
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
+
|
| 127 |
+
## 3. The rule
|
| 128 |
+
|
| 129 |
+
**In plain English.** Read `MedVision_PLANNER_VERSION` as a ceiling, not as an exact match:
|
| 130 |
+
*"give me the newest annotations that existed at or before this point."* Each dataset answers
|
| 131 |
+
that question for itself. That is exactly what a reproducibility pin means — *"the annotations as
|
| 132 |
+
they stood at release R"* — and it is uniform across task types, so the
|
| 133 |
+
`taskType != "Tumor-Lesion-Size"` special case disappears entirely.
|
| 134 |
+
|
| 135 |
+
**Technically.**
|
| 136 |
+
|
| 137 |
+
> **Resolve, per (dataset, plan-kind), to the newest published annotation version that is
|
| 138 |
+
> ≤ the requested version.**
|
| 139 |
+
|
| 140 |
+
Behaviour against the measured matrix:
|
| 141 |
+
|
| 142 |
+
| Request | Dataset / task | Resolves to | vs. before |
|
| 143 |
+
| --- | --- | --- | --- |
|
| 144 |
+
| `1.2.0` | pre-existing, non-TL | `1.0.0` | same result, principled |
|
| 145 |
+
| `1.2.0` | pre-existing, TL | `1.1.1` | **fixes defect A** |
|
| 146 |
+
| `1.2.0` | new | `1.2.0` | same |
|
| 147 |
+
| `1.1.1` | pre-existing, TL | `1.1.1` | same |
|
| 148 |
+
| `1.1.1` | new | *unavailable* → explicit error | **fixes defect C** |
|
| 149 |
+
| `1.0.0` | pre-existing, any | `1.0.0` | same |
|
| 150 |
+
| `1.0.0` | new | *unavailable* → explicit error | correct |
|
| 151 |
+
|
| 152 |
+
---
|
| 153 |
+
|
| 154 |
+
## 4. The mechanism
|
| 155 |
+
|
| 156 |
+
Module-level helpers in `MedVision.py`, all pure and all testable without network or disk:
|
| 157 |
+
`_version_tuple`, `_is_version`, `_data_root`, `_published_versions`, `_acceptable_versions`,
|
| 158 |
+
`_plan_path`, `_resolve`, `_download_needed`, `_declared_versions`, `_newest_declared`,
|
| 159 |
+
`_discover_versions`, `_check_biometry_family`, `_normalize_requested`, and the error builders.
|
| 160 |
+
|
| 161 |
+
Two prerequisites were needed, **neither of which was a bug** — both are consequences of adding a
|
| 162 |
+
module-level consumer of machinery that was function-local:
|
| 163 |
+
|
| 164 |
+
- `glob` was not imported. Nothing needed it before. Added.
|
| 165 |
+
- `_version_tuple` was defined *inside* `_split_generators`, and `_enforce_release_ack` carried a
|
| 166 |
+
hand-copied duplicate named `_vt` whose comment openly acknowledged it was "mirroring" the
|
| 167 |
+
other. The bodies were identical, so there was no behavioural divergence and no defect. One
|
| 168 |
+
copy was hoisted to module level and the other deleted.
|
| 169 |
+
|
| 170 |
+
The hoist is not incidental cleanup. Both copies were nested, so neither was reachable from a
|
| 171 |
+
module-level resolver — without hoisting, this change would have introduced a *third* copy of the
|
| 172 |
+
same parsing rule. It also matters for correctness: the resolver and the ack gate must agree on
|
| 173 |
+
version ordering exactly, or a dataset could be judged current by one and unavailable by the
|
| 174 |
+
other. Sharing one implementation makes that class of inconsistency impossible by construction.
|
| 175 |
+
|
| 176 |
+
`_version_tuple`'s `except → (1,0,0)` is preserved verbatim. It is the published legacy-boolean
|
| 177 |
+
contract from `doc/release-v1.1.0.md`, now reached only by `true` values in
|
| 178 |
+
`.downloaded_datasets.json`.
|
| 179 |
+
|
| 180 |
+
### 4.1 Two sources of truth, each authoritative for a different thing
|
| 181 |
+
|
| 182 |
+
**In plain English.** Looking at the files on disk tells you what you *have*. It cannot tell you
|
| 183 |
+
what *exists*. Those are different questions, and the loader has to answer both — often before
|
| 184 |
+
anything has been downloaded at all. So the design carries a declared list of what has been
|
| 185 |
+
published, and uses the disk only to confirm what is actually there.
|
| 186 |
+
|
| 187 |
+
**Technically.** `_ANNOTATION_INDEX` (inline in `MedVision.py`, **30 datasets / 72
|
| 188 |
+
(dataset, plan-kind) pairs**) is authoritative for every decision taken *before* the data is on
|
| 189 |
+
disk: the cache fingerprint, the acknowledgement gate, and "is something newer available?". The
|
| 190 |
+
on-disk glob (`_discover_versions`) is authoritative for the file actually opened.
|
| 191 |
+
`_split_generators` reconciles the two and raises `_annotation_integrity_error` when they
|
| 192 |
+
disagree.
|
| 193 |
+
|
| 194 |
+
Three decisions happen before any file exists, which is what forces the index:
|
| 195 |
+
|
| 196 |
+
1. `create_config_id` runs at builder construction, long before `dataset_dir` exists.
|
| 197 |
+
2. The ack gate is deliberately fail-fast — it must fire before downloading gigabytes.
|
| 198 |
+
3. "Is a newer annotation available?" is unanswerable from local files by definition.
|
| 199 |
+
|
| 200 |
+
The third is the load-bearing one. A directory holding only `_v1.0.0` is indistinguishable
|
| 201 |
+
between *"v1.0.0 is the newest version that exists for this pair"* and *"v1.0.0 is merely the
|
| 202 |
+
newest version I happen to have downloaded"*. Without the index, a user whose `KiTS23/` dates
|
| 203 |
+
from the v1.0.0 era and who pins `1.1.1` would resolve `1.0.0` (since `1.0.0 ≤ 1.1.1`), fire no
|
| 204 |
+
download, and be **silently served the pre-bugfix annotations they explicitly asked to avoid.**
|
| 205 |
+
|
| 206 |
+
`MedVision.py` is re-fetched from the hub on every `load_dataset`, so an inline index is
|
| 207 |
+
automatically as fresh as the data it describes.
|
| 208 |
+
|
| 209 |
+
**Why the index is keyed on the pair, not on the dataset.** A dataset-level key cannot express
|
| 210 |
+
what v1.1.1 actually did: it regenerated only the **biometry** plans of the six TL datasets,
|
| 211 |
+
leaving their segmentation and detection plans at `1.0.0`. Keyed by dataset, the index would
|
| 212 |
+
report `1.1.1` as KiTS23's newest segmentation annotation — a file that does not exist. The
|
| 213 |
+
72-entry pair granularity is what makes the index able to describe the published data at all.
|
| 214 |
+
|
| 215 |
+
**Version discovery derives its pattern from the naming convention, not a second copy of it.**
|
| 216 |
+
`_discover_versions` builds its glob from the same plan-filename convention as `_plan_path`,
|
| 217 |
+
using `glob.escape` on the directory and an `\x00` sentinel to cut prefix and suffix safely, with
|
| 218 |
+
`_is_version` filtering the captures so a stray `..._vdraft.json.gz` can never be selected as the
|
| 219 |
+
1.0.0 plan.
|
| 220 |
+
|
| 221 |
+
**The biometry filename collision is made executable, not tacit.**
|
| 222 |
+
`MedVision_BenchmarkPlannerBiometry` (landmarks) and `MedVision_BenchmarkPlannerBiometry_fromSeg`
|
| 223 |
+
(TL) emit the *same* filename, `benchmark_plan_biometry_*`. This is safe only while no dataset
|
| 224 |
+
carries both families. `_BIOMETRY_FAMILY` (16 entries — 5 landmark, 11 fromSeg) records the
|
| 225 |
+
split, and `_check_biometry_family` raises if a future dataset ever declares both, instead of
|
| 226 |
+
silently opening the wrong family's plan and dying with a `KeyError` deep inside
|
| 227 |
+
`_generate_examples`.
|
| 228 |
+
|
| 229 |
+
### 4.2 "Unavailable" is an error, not a fallback
|
| 230 |
+
|
| 231 |
+
When resolution returns `None`, this is not a fallback situation — it is a genuine conflict, and
|
| 232 |
+
raising is the only honest outcome. `_annotation_unavailable_error` names the dataset, the
|
| 233 |
+
requested version, and the versions that do exist.
|
| 234 |
+
|
| 235 |
+
Do *not* silently skip. A skipped config yields an empty split, which is indistinguishable from a
|
| 236 |
+
real result and would silently corrupt a benchmark table.
|
| 237 |
+
|
| 238 |
+
Users sweeping at an old pin should filter *before* loading. The config lists are versioned on
|
| 239 |
+
disk for exactly this: `info/v1.0.0-v1.1.1/` holds the 820 configs valid for every release up to
|
| 240 |
+
1.1.1, and `info/v1.2.0/` holds all 950. A sweep pinned at 1.1.1 that iterates the former never
|
| 241 |
+
presents the resolver with a config it cannot satisfy.
|
| 242 |
+
|
| 243 |
+
### 4.3 The download trigger compares two resolutions of the same request
|
| 244 |
+
|
| 245 |
+
**In plain English.** The old check asked "did the global version number move?", which is not the
|
| 246 |
+
same question as "can what I already have serve what was asked for?". The new one asks the second
|
| 247 |
+
question, by looking at the dataset directory rather than at a recorded number.
|
| 248 |
+
|
| 249 |
+
**Technically.** `_download_needed(force, tracker_entry, local, target)` compares the *index*
|
| 250 |
+
side (`_target` — the best version the hub can offer for this pin) against the *disk* side
|
| 251 |
+
(`_local` — the best version already present for it). Both are clamped to the pin, which is what
|
| 252 |
+
makes a downgrade a no-op: annotation zips are cumulative, so the older file a downgrade wants is
|
| 253 |
+
already on disk.
|
| 254 |
+
|
| 255 |
+
Reading the directory instead of `.downloaded_datasets.json` makes the version decision
|
| 256 |
+
**self-healing**: the poisoned `"1.2.0"` entries that the old code wrote no longer suppress a
|
| 257 |
+
download that is genuinely needed.
|
| 258 |
+
|
| 259 |
+
The tracker entry is still consulted, but **for presence only**. It is written at step 3.4, after
|
| 260 |
+
the images (3.2) and the RAS+ reorientation (3.3), while the annotation plans are extracted at
|
| 261 |
+
step 3.1, before them. Without the presence check, a run that dies anywhere between 3.1 and 3.4
|
| 262 |
+
would leave plans on disk with no images, and every later run would classify that as complete.
|
| 263 |
+
|
| 264 |
+
**Only the plan-kind lookup moved earlier**, and that is a dict lookup
|
| 265 |
+
(`_PLAN_KIND_BY_TASKTYPE`), not the planner import. The task-type dispatch stays below the
|
| 266 |
+
download block. Hoisting it would have coupled annotation resolution to `pip install .`
|
| 267 |
+
succeeding — and install failure is swallowed at info level, so that coupling would have been
|
| 268 |
+
silent.
|
| 269 |
+
|
| 270 |
+
### 4.4 The acknowledgement gate is per dataset, with two accepted tokens
|
| 271 |
+
|
| 272 |
+
**In plain English.** `MedVision_ACK_RELEASE` is the "yes, I know I am asking for something older
|
| 273 |
+
than what exists" switch. Judging *older* against the whole catalogue meant that publishing
|
| 274 |
+
anything new demanded the switch from every pinned user, even for datasets the release never
|
| 275 |
+
touched. It is now judged against the dataset in front of you.
|
| 276 |
+
|
| 277 |
+
**Technically.** `_enforce_release_ack` compares the pin against `_newest_declared(dataset,
|
| 278 |
+
kind)` rather than against the release version, and accepts **either** of two tokens:
|
| 279 |
+
|
| 280 |
+
```python
|
| 281 |
+
if os.environ.get("MedVision_ACK_RELEASE") in (ack_value, latest_version):
|
| 282 |
+
return
|
| 283 |
+
```
|
| 284 |
+
|
| 285 |
+
- `latest_version` — that pair's newest annotation version. Expires when that dataset is
|
| 286 |
+
regenerated. It is the number the error message shows.
|
| 287 |
+
- `ack_value` — the release version. Expires at the next release.
|
| 288 |
+
|
| 289 |
+
Both are needed, and neither alone suffices. A single-dataset load wants the per-dataset value,
|
| 290 |
+
because that is what the error names. A **catalogue sweep cannot use it**: different datasets sit
|
| 291 |
+
at different newest versions, so a sweep would need several values at once, and the environment
|
| 292 |
+
variable holds one. Without the release token, sweeping at an old pin would be impossible;
|
| 293 |
+
without the per-dataset token, the error message would name a value the gate does not accept.
|
| 294 |
+
|
| 295 |
+
Consequence: **v1.2.0 is non-breaking for all 820 pre-existing configs.** A user pinned at
|
| 296 |
+
`1.1.1` sees no ack error at all, because v1.2.0 regenerated nothing they load. That is the
|
| 297 |
+
backward-compatibility requirement satisfied by construction rather than by a grandfather clause.
|
| 298 |
+
|
| 299 |
+
### 4.5 The fingerprint keys on the resolved version and the data root
|
| 300 |
+
|
| 301 |
+
**In plain English.** A cache key has to name every input that can change the output. The old key
|
| 302 |
+
named the version you *asked for*, which is not an identity for the data — several requests map
|
| 303 |
+
to one file, and one request can map to different files over time. It also named nothing at all
|
| 304 |
+
about the data root, even though the data root is baked into every path in every row.
|
| 305 |
+
|
| 306 |
+
**Technically.** The token is the index-resolved version plus an 8-hex SHA-1 of the canonical
|
| 307 |
+
data root, folded into the `planner_version` key to stay inside the `datasets` 32-char
|
| 308 |
+
readability limit:
|
| 309 |
+
|
| 310 |
+
```python
|
| 311 |
+
_root_token = hashlib.sha1(_data_root(strict=False).encode()).hexdigest()[:8]
|
| 312 |
+
kwargs_with_planner = {**(config_kwargs or {}), "planner_version": f"{planner_version}-{_root_token}"}
|
| 313 |
+
```
|
| 314 |
+
|
| 315 |
+
`create_config_id` never raises and never touches disk — hence `strict=False`.
|
| 316 |
+
|
| 317 |
+
#### 4.5.1 The stale-cache defect is shipped history, not a hypothetical
|
| 318 |
+
|
| 319 |
+
`scripts/align_tl_split_to_v1.0.0.py` rewrote the **already-published**
|
| 320 |
+
`benchmark_plan_biometry_v1.1.0.json.gz` files **in place** (`gzip.open(p, "wt")` + `json.dump`)
|
| 321 |
+
for all 6 TL datasets, relabelling the train/test membership of ~41% of cases — **without bumping
|
| 322 |
+
the version number.** For a user who ran a TL config at `1.1.0` before that realignment:
|
| 323 |
+
|
| 324 |
+
| Layer | Key/check | Result after the realignment |
|
| 325 |
+
| --- | --- | --- |
|
| 326 |
+
| HF Arrow cache | token `"1.1.0"` — unchanged | **cache hit → pre-realignment split served** |
|
| 327 |
+
| Local plan file | `_vt("1.1.0") < _vt("1.1.0")` is false | **no re-download → stale file kept** |
|
| 328 |
+
|
| 329 |
+
Measurement values were byte-identical, so nothing looked wrong; only the partition differed —
|
| 330 |
+
exactly the kind of error that survives review and poisons a benchmark.
|
| 331 |
+
|
| 332 |
+
**This is why the policy below is part of the design, not an afterthought.** Keying on the
|
| 333 |
+
resolved version fixes the cache layer for *future* changes, and §4.3 fixes the file layer. But
|
| 334 |
+
no fingerprint scheme can detect a published file edited without a version bump, because the
|
| 335 |
+
version string is the only identity the data has.
|
| 336 |
+
|
| 337 |
+
> **Invariant — a published annotation file is never rewritten in place. Corrections always get a
|
| 338 |
+
> new version number.**
|
| 339 |
+
|
| 340 |
+
Guards that encode this today, and must not be weakened:
|
| 341 |
+
`scripts/test_annotation_resolution.py` §9 (the token is the *resolved* version) and §11 (two
|
| 342 |
+
data roots never share a cache).
|
| 343 |
+
|
| 344 |
+
### 4.6 Accepted values are derived from the index
|
| 345 |
+
|
| 346 |
+
**In plain English.** A version string nobody ever published is far more likely to be a typo than
|
| 347 |
+
an intention.
|
| 348 |
+
|
| 349 |
+
**Technically.** `_acceptable_versions(release_version)` unions the published set with the
|
| 350 |
+
release version:
|
| 351 |
+
|
| 352 |
+
```python
|
| 353 |
+
def _acceptable_versions(release_version):
|
| 354 |
+
return tuple(sorted(
|
| 355 |
+
set(_published_versions()) | {str(release_version)}, key=_version_tuple
|
| 356 |
+
))
|
| 357 |
+
```
|
| 358 |
+
|
| 359 |
+
The union is **load-bearing**: `latest` resolves to the release, so a version bump made before
|
| 360 |
+
any regeneration would otherwise make `latest` itself unusable.
|
| 361 |
+
|
| 362 |
+
Two categories were previously mishandled. *Malformed* values (`v1.1.1`, `1.2`) parsed to
|
| 363 |
+
`(1,0,0)` and, with an ack set, silently loaded v1.0.0. *Well-formed but unpublished* values
|
| 364 |
+
(`1.1.5`, `0.0.0`) were accepted — `1.1.5` resolved down silently, `0.0.0` left all 950 configs
|
| 365 |
+
unloadable with no hint why. Both now raise at parse time with the accepted set listed.
|
| 366 |
+
|
| 367 |
+
### 4.7 The fallback notice is replaced by logging
|
| 368 |
+
|
| 369 |
+
The "only TL changed" banner is deleted along with `_FALLBACK_NOTICE_SHOWN`. Resolution is normal
|
| 370 |
+
behaviour, not an exception, so it emits one `logger.info` per config recording requested →
|
| 371 |
+
resolved (greppable, invisible by default across 950 configs). The loud banner is reserved for
|
| 372 |
+
the §4.2 conflict error, which is the only case the user must act on.
|
| 373 |
+
|
| 374 |
+
### 4.8 Adjacent defects fixed in the same release
|
| 375 |
+
|
| 376 |
+
Three download-path defects surfaced while this was being built. They are outside the scope of
|
| 377 |
+
version resolution; see the *Fixed: download reliability* section of
|
| 378 |
+
[`doc/release-v1.2.0.md`](release-v1.2.0.md#fixed-download-reliability):
|
| 379 |
+
|
| 380 |
+
- a failed image download was recorded as a completed install (a bare `except:` that also
|
| 381 |
+
swallowed Ctrl-C);
|
| 382 |
+
- two configs of one dataset prepared concurrently both extracted the shared annotation zip, and
|
| 383 |
+
the second died at `os.remove` — HuggingFace's builder lock is per *config*, the shared zip is
|
| 384 |
+
per *dataset*;
|
| 385 |
+
- a relative `MedVision_DATA_DIR` broke every download, because the per-dataset download scripts
|
| 386 |
+
`chdir` into the dataset directory themselves.
|
| 387 |
+
|
| 388 |
+
The last one interacts with §4.5: the data root is now part of the cache key, so it must be
|
| 389 |
+
canonicalised (`expanduser` → `abspath` → `normpath`) before hashing, or one directory would get
|
| 390 |
+
several keys.
|
| 391 |
+
|
| 392 |
+
---
|
| 393 |
+
|
| 394 |
+
## 5. Backward compatibility
|
| 395 |
+
|
| 396 |
+
| Existing usage | Behaviour after the change |
|
| 397 |
+
| --- | --- |
|
| 398 |
+
| `PLANNER_VERSION=1.0.0` (+ack) | every pre-existing dataset resolves `1.0.0`, byte-identical |
|
| 399 |
+
| `PLANNER_VERSION=1.1.0` (+ack) | TL resolves `1.1.0`, non-TL resolves `1.0.0` — as before |
|
| 400 |
+
| `PLANNER_VERSION=1.1.1` | ack no longer required for unchanged datasets; TL resolves `1.1.1` |
|
| 401 |
+
| `PLANNER_VERSION=latest` | each dataset resolves to its own newest — TL stops crashing |
|
| 402 |
+
| legacy boolean `True` cache entries | presence read as "install completed"; value no longer parsed as a version |
|
| 403 |
+
| new datasets at any pin < 1.2.0 | explicit, actionable error (previously an obscure crash) |
|
| 404 |
+
|
| 405 |
+
No published file is renamed, moved, or duplicated. `_generate_examples` is untouched, so proving
|
| 406 |
+
`bm_plan_file` is unchanged suffices to prove the rows are.
|
| 407 |
+
|
| 408 |
+
Two behaviours changed deliberately, both from "silently wrong" to "explicitly refused": a
|
| 409 |
+
malformed version string, and a dataset requested at a version predating its existence. Neither
|
| 410 |
+
had a working counterpart before.
|
| 411 |
+
|
| 412 |
+
One-time effect: because the fingerprint changed, existing Arrow caches are orphaned and rebuild
|
| 413 |
+
on next use. The rebuild reads the plan file and re-emits rows — no re-transfer.
|
| 414 |
+
|
| 415 |
+
---
|
| 416 |
+
|
| 417 |
+
## 6. Verification
|
| 418 |
+
|
| 419 |
+
Success criterion, checkable without downloading anything:
|
| 420 |
+
|
| 421 |
+
> For each of the 950 configs × every pin, the resolver either returns a version present in
|
| 422 |
+
> `_declared_versions`, or raises `_annotation_unavailable_error`. **No third outcome — in
|
| 423 |
+
> particular, never a path that does not exist.**
|
| 424 |
+
|
| 425 |
+
`scripts/test_annotation_resolution.py` implements this in 13 sections. **All 351 checks pass**
|
| 426 |
+
against the real published version matrix.
|
| 427 |
+
|
| 428 |
+
| Pin | Resolve | Unavailable | Unavailable datasets |
|
| 429 |
+
| --- | ---: | ---: | --- |
|
| 430 |
+
| `1.0.0` | 820 | 130 | the 8 new datasets |
|
| 431 |
+
| `1.1.0` | 820 | 130 | the 8 new datasets |
|
| 432 |
+
| `1.1.1` | 820 | 130 | the 8 new datasets |
|
| 433 |
+
| `1.2.0` | **950** | **0** | — |
|
| 434 |
+
| `latest` | **950** | **0** | — |
|
| 435 |
+
|
| 436 |
+
The 820/130 split is exactly the `info/v1.0.0-v1.1.1/` vs `info/v1.2.0/` config lists, computed
|
| 437 |
+
independently. The 950/0 rows are final: plan generation for all 8 new datasets is complete.
|
| 438 |
+
|
| 439 |
+
The 162 configs of defect A all resolve `1.1.1` at pin `1.2.0`:
|
| 440 |
+
|
| 441 |
+
```
|
| 442 |
+
BraTS24 HNTSMRG24 KiPA22 KiTS23 MSD autoPET-III
|
| 443 |
+
available=['1.0.0','1.1.0','1.1.1'] -> 1.1.1
|
| 444 |
+
```
|
| 445 |
+
|
| 446 |
+
`scripts/test_tl_ack_gate.py` covers the acknowledgement gate in 16 cases; the original 5 pass
|
| 447 |
+
unmodified, which is the evidence that the signature change (`ack_value`, `dataset_name`,
|
| 448 |
+
`plan_kind`, all defaulted) is backward compatible.
|
| 449 |
+
|
| 450 |
+
**A partially generated tree is a supported state.** Working against one is the normal condition
|
| 451 |
+
while preparing a release, and it is where the old loader behaved worst: a not-yet-generated TL
|
| 452 |
+
plan hit defect A, while non-TL configs died pointing at a `_v1.0.0` fallback path that was never
|
| 453 |
+
plausible for a dataset introduced in v1.2.0. Under the shipped resolver, a config whose plan
|
| 454 |
+
does not exist yet fails immediately with a message naming the dataset and listing what it
|
| 455 |
+
actually has, which makes "generation is still running" self-evident rather than something to
|
| 456 |
+
diagnose.
|
| 457 |
+
|
| 458 |
+
---
|
| 459 |
+
|
| 460 |
+
## 7. Invariants to preserve
|
| 461 |
+
|
| 462 |
+
Anything that weakens these re-opens a defect class that has already caused damage:
|
| 463 |
+
|
| 464 |
+
1. **The cache key is the annotation version actually resolved**, plus the canonical data root.
|
| 465 |
+
Reverting the token to the requested pin, or dropping the root component, re-opens the
|
| 466 |
+
silent-stale-cache class (§4.5.1).
|
| 467 |
+
2. **A published annotation file is never rewritten in place.** Corrections get a new version
|
| 468 |
+
number. No fingerprint scheme can detect an in-place edit.
|
| 469 |
+
3. **Any new input that changes which rows `_generate_examples` yields must be folded into the
|
| 470 |
+
cache key.** The existing precedent is `MedVision_DISABLE_SAMPLE_FILTERING`.
|
| 471 |
+
4. **The index and the disk stay reconciled.** `_annotation_integrity_error` exists so drift is
|
| 472 |
+
loud; test §5 checks `_discover_versions == _declared_versions` for every present pair.
|
| 473 |
+
|
| 474 |
+
---
|
| 475 |
+
|
| 476 |
+
## 8. See also
|
| 477 |
+
|
| 478 |
+
- [`doc/release-v1.2.0.md`](release-v1.2.0.md) — the shipped user-facing contract
|
| 479 |
+
- [`doc/release-v1.2.0-datasets.md`](release-v1.2.0-datasets.md) — the 8 new datasets
|
| 480 |
+
- [`doc/release-v1.1.1.md`](release-v1.1.1.md) — the in-place split realignment that motivated §4.5
|
| 481 |
+
- [`doc/release-v1.1.0.md`](release-v1.1.0.md) — the legacy-boolean tracker contract
|
|
@@ -0,0 +1,381 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Release v1.2.0 — the 8 new datasets
|
| 2 |
+
|
| 3 |
+
Companion to [`doc/release-v1.2.0.md`](release-v1.2.0.md), which covers the loader and
|
| 4 |
+
annotation-versioning changes. **This note covers the data**: what was added, where it came from,
|
| 5 |
+
what was included or filtered and why, and how it is distributed.
|
| 6 |
+
|
| 7 |
+
```bash
|
| 8 |
+
export MedVision_DATA_DIR=/path/to/data # required — the loader raises without it
|
| 9 |
+
export MedVision_PLANNER_VERSION=latest # resolves to 1.2.0
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
Nothing here changes an existing dataset. Every annotation published before v1.2.0 loads byte for
|
| 13 |
+
byte as it did at v1.1.1.
|
| 14 |
+
|
| 15 |
+
**These 8 datasets require a pin of `1.2.0` or `latest`.** Their annotations did not exist at any
|
| 16 |
+
earlier version, so requesting one at `MedVision_PLANNER_VERSION=1.1.1` or below raises an error
|
| 17 |
+
naming the dataset and the versions that do exist — see
|
| 18 |
+
[Pinning a version older than v1.2.0](release-v1.2.0.md#pinning-a-version-older-than-v120).
|
| 19 |
+
|
| 20 |
+
## At a glance
|
| 21 |
+
|
| 22 |
+
**+3,609 subjects · +3,709 volumes · +130 configs** (catalogue 820 → 950).
|
| 23 |
+
|
| 24 |
+
| Dataset | Anatomy / Modality | Cases | Tasks | Configs | Licence |
|
| 25 |
+
| --- | --- | ---: | --- | ---: | --- |
|
| 26 |
+
| **AFIDs** | brain / T1w MRI | 72 | Landmarks | 4 | CC BY 4.0 |
|
| 27 |
+
| **PDDCA** | head & neck / CT | 48 | Mask, Box, Landmarks | 16 | public domain, CC BY 3.0 |
|
| 28 |
+
| **VerSe** | spine / CT | 325 | Mask, Box, Landmarks | 14 | CC BY-SA 4.0 |
|
| 29 |
+
| **PI-CAI** | prostate / bpMRI (T2W) | 425 | Mask, Box, T/L | 18 | CC BY-NC 4.0 |
|
| 30 |
+
| **MAMA-MIA** | breast / DCE-MRI | 1,506 | Mask, Box, T/L | 18 | CC BY-NC 4.0 |
|
| 31 |
+
| **DEEP-PSMA** | whole body / PSMA + FDG PET | 100 ×2 tracers | Mask, Box, T/L | 28 | CC BY-NC 4.0 |
|
| 32 |
+
| **LNQ2023** | mediastinum / CT | 120 | Mask, Box, T/L | 14 | CC BY 4.0 |
|
| 33 |
+
| **LIDC-IDRI** | lung / CT | 1,013 | Mask, Box, T/L | 18 | CC BY 3.0 |
|
| 34 |
+
|
| 35 |
+
*Mask = Mask-Size, Box = Box-Size, T/L = Tumor-Lesion-Size, Landmarks = Biometrics-From-Landmarks.*
|
| 36 |
+
|
| 37 |
+
**What this widens:**
|
| 38 |
+
|
| 39 |
+
- **PET becomes a first-class modality.** DEEP-PSMA adds PSMA and FDG tracers with SUV volumes —
|
| 40 |
+
the first PSMA data in MedVision.
|
| 41 |
+
- **Spine, head-and-neck OARs, and brain fiducials are new anatomies.** VerSe covers C1–L6 per
|
| 42 |
+
vertebra; PDDCA covers 9 organs at risk; AFIDs covers 32 standardized brain fiducials.
|
| 43 |
+
- **Biometrics-From-Landmarks triples.** It was the rarest task family; AFIDs, PDDCA and VerSe add
|
| 44 |
+
355 landmark cases across 3 anatomies.
|
| 45 |
+
- **Oncology breadth.** Prostate (PI-CAI), breast (MAMA-MIA), lung nodule (LIDC-IDRI) and
|
| 46 |
+
mediastinal node (LNQ2023) lesions join the existing T/L datasets.
|
| 47 |
+
|
| 48 |
+
## The datasets
|
| 49 |
+
|
| 50 |
+
### AFIDs — 72 cases, T1w brain MRI, landmarks only
|
| 51 |
+
|
| 52 |
+
[Anatomical Fiducials](https://github.com/afids/afids-data), OpenNeuro `ds004470` (32 SNSX,
|
| 53 |
+
7T MP2RAGE) + `ds004471` (40 LHSCPD, 1.5T). The landmark coordinates are **CC BY 4.0** (per the
|
| 54 |
+
afids-data `LICENSE.md`); the accompanying imaging is CC0. CC BY 4.0 governs the combined product.
|
| 55 |
+
|
| 56 |
+
32 expert fiducials per case (anterior/posterior commissure, mammillary bodies, corpus callosum
|
| 57 |
+
genu and splenium, …). Parsed from `.fcsv` (`# CoordinateSystem = 0`, i.e. RAS world-mm) and
|
| 58 |
+
converted to 0-based voxel indices in the RAS+ volume. No segmentation masks exist, so AFIDs
|
| 59 |
+
publishes the **biometry task only** — 4 configs.
|
| 60 |
+
|
| 61 |
+
### PDDCA — 48 cases, head-and-neck CT
|
| 62 |
+
|
| 63 |
+
[PDDCA v1.4.1](http://www.imagenglab.com/newsite/pddca/), derived from the TCIA Head-Neck
|
| 64 |
+
Cetuximab collection. Public domain / CC BY 3.0.
|
| 65 |
+
|
| 66 |
+
9 organ-at-risk labels merged from per-structure NRRDs into one multi-label mask: mandible,
|
| 67 |
+
brainstem, both parotids, both submandibular glands, both optic nerves, optic chiasm.
|
| 68 |
+
|
| 69 |
+
Two properties worth knowing:
|
| 70 |
+
|
| 71 |
+
- **Structure availability is ragged.** 6 of the 9 structures appear in all 48 cases; the
|
| 72 |
+
submandibular glands and mandible in fewer (36–41). Mask building skips missing structures
|
| 73 |
+
rather than asserting — asserting would have rejected 8 otherwise-valid cases.
|
| 74 |
+
- **Only 33 cases ship landmarks upstream.** The biometry task therefore uses a 33-case subset
|
| 75 |
+
(`Images-landmark/`); segmentation and detection use all 48.
|
| 76 |
+
|
| 77 |
+
> **LPS fix.** PDDCA's NRRDs declare `space: left-posterior-superior`. Copying that direction
|
| 78 |
+
> matrix verbatim into a (RAS-by-definition) NIfTI affine mirrors the volume left-right and
|
| 79 |
+
> anterior-posterior and makes the RAS+ reorientation a silent no-op. The affine is corrected
|
| 80 |
+
> before reorientation. Evidence: the chin landmark sits **0.0 mm** from the mandible mask after
|
| 81 |
+
> the fix versus **181.9 mm** before, and all 48 cases now have `_R` structures right of `_L`.
|
| 82 |
+
|
| 83 |
+
### VerSe — 325 scans, spine CT
|
| 84 |
+
|
| 85 |
+
[VerSe'19 + VerSe'20](https://github.com/anjany/verse). **CC BY-SA 4.0** — note the ShareAlike
|
| 86 |
+
obligation propagates to derived annotations.
|
| 87 |
+
|
| 88 |
+
Per-vertebra masks for C1–L6 plus T13 (26 labels), and lumbar centroid landmarks
|
| 89 |
+
(L1–L5) for the 250 scans whose field of view contains all five.
|
| 90 |
+
|
| 91 |
+
- **Centroid convention.** The challenge `*_ctd.json` values are **voxel indices in the native
|
| 92 |
+
orientation**, not world-mm. Measured across all 374 scans / 4,522 centroids: read as voxel
|
| 93 |
+
indices, 98.8% land inside the correct vertebra label with 0 out of bounds; read as world-mm,
|
| 94 |
+
**94.7% fall outside the volume entirely**. The converter maps native ijk → world → RAS+ index.
|
| 95 |
+
- **QFORM geometry.** VerSe files carry `sform_code=0, qform_code=1`, so geometry is read through
|
| 96 |
+
nibabel's `.affine` (which resolves QFORM automatically). Reading SFORM directly returns zeros.
|
| 97 |
+
- **Field of view varies** from cervical-only to whole-body, which is why the lumbar biometry
|
| 98 |
+
subset (`Images-lumbar/`, 250) is smaller than the full set (325).
|
| 99 |
+
|
| 100 |
+
### PI-CAI — 425 cases, prostate T2-weighted MRI
|
| 101 |
+
|
| 102 |
+
[PI-CAI](https://pi-cai.grand-challenge.org/); imaging from
|
| 103 |
+
[Zenodo](https://zenodo.org/records/6624726), labels from
|
| 104 |
+
[`picai_labels`](https://github.com/DIAGNijmegen/picai_labels). CC BY-NC 4.0.
|
| 105 |
+
|
| 106 |
+
Clinically significant prostate cancer (csPCa) lesions. `picai_labels` publishes human-expert
|
| 107 |
+
delineations for **all 1500** cases, split across two disjoint folders — and MedVision uses both:
|
| 108 |
+
|
| 109 |
+
| Folder | Cases | Note |
|
| 110 |
+
| --- | ---: | --- |
|
| 111 |
+
| `human_expert/resampled/` | 1295 | original expert annotations, resampled onto the axial T2W grid |
|
| 112 |
+
| `human_expert/Pooch25/` | 205 | added 2025-07-01 by [Pooch et al., 2025](https://doi.org/10.1101/2025.05.13.25327456) for the positives that previously carried only an AI mask — **all 205 are positive** |
|
| 113 |
+
| **Kept (non-empty mask)** | **425** | 220 from `resampled/` + all 205 from `Pooch25/` |
|
| 114 |
+
|
| 115 |
+
Cases whose expert mask is all-zero are not redistributed: with no delineated lesion there is
|
| 116 |
+
nothing for the Tumor-Lesion-Size task to measure.
|
| 117 |
+
|
| 118 |
+
> An earlier draft of this note claimed the 205 carried "only AI-derived masks". That was true
|
| 119 |
+
> until 2025-07-01 and is now wrong — reading `resampled/` alone silently discarded 205
|
| 120 |
+
> expert-annotated positives, nearly halving the usable data.
|
| 121 |
+
|
| 122 |
+
**T2W only.** PI-CAI is biparametric (T2W + ADC + HBV). Per the upstream README the original
|
| 123 |
+
annotations were drawn at T2W, ADC *or* DWI/HBV resolution depending on the annotator, so the
|
| 124 |
+
T2W-resampled delineations are the ones with an exact image/mask correspondence. Diffusion
|
| 125 |
+
sequences are acquired far coarser (~2 mm in-plane) than these T2W scans (0.23–0.56 mm), so a
|
| 126 |
+
mask drawn on ADC and resampled up would carry ~2 mm of boundary quantisation into a millimetre
|
| 127 |
+
measurement — on lesions often under 10 mm. Only **2 of 425** masks needed resampling onto the
|
| 128 |
+
T2W grid; the rest matched exactly.
|
| 129 |
+
|
| 130 |
+
Masks encode the **ISUP grade** as the voxel value (`{2,3,4,5}`, with no label 1) and are
|
| 131 |
+
binarized to `{0,1}`.
|
| 132 |
+
|
| 133 |
+
### MAMA-MIA — 1,506 cases, breast DCE-MRI
|
| 134 |
+
|
| 135 |
+
[MAMA-MIA](https://github.com/LidiaGarrucho/MAMA-MIA) via
|
| 136 |
+
[Synapse syn60868042](https://www.synapse.org/Synapse:syn60868042). CC BY-NC 4.0. Four cohorts
|
| 137 |
+
(DUKE, ISPY1, ISPY2, NACT), each case with an expert primary-tumour mask.
|
| 138 |
+
|
| 139 |
+
**One DCE phase per case.** Each case ships a pre-contrast volume (`_0000`) plus several
|
| 140 |
+
post-contrast phases; the expert mask is drawn on the **first post-contrast** (`_0001`), so that
|
| 141 |
+
is the volume published. The convention was confirmed against the official
|
| 142 |
+
`MAMA-MIA/src/preprocessing.py::read_mri_phase_from_patient_id`.
|
| 143 |
+
|
| 144 |
+
### DEEP-PSMA — 100 cases × 2 tracers, PET
|
| 145 |
+
|
| 146 |
+
[DEEP-PSMA](https://deep-psma.grand-challenge.org/) via
|
| 147 |
+
[Zenodo](https://zenodo.org/records/15281784). CC BY-NC 4.0.
|
| 148 |
+
|
| 149 |
+
Total tumour burden (TTB) on **PSMA** and **FDG** PET. The two tracers are kept in separate
|
| 150 |
+
image/mask folders (`Images-PSMA`, `Images-FDG`, …) as **two task IDs**, so the subject-level
|
| 151 |
+
train/test split cannot place the same patient's two scans on opposite sides.
|
| 152 |
+
|
| 153 |
+
**PET only — no CT.** TTB is defined by SUV thresholding on the PET and delivered on the PET grid
|
| 154 |
+
(e.g. `192×192×335` at `2.87 × 2.87 × 3.27` mm). A PET/CT's CT component is acquired near 1 mm for
|
| 155 |
+
attenuation correction; using it as the image would require resampling the mask onto a ~3× finer
|
| 156 |
+
grid — inventing lesion boundary detail that was never annotated, and changing the physical
|
| 157 |
+
measurements the benchmark scores.
|
| 158 |
+
|
| 159 |
+
### LNQ2023 — 120 cases, mediastinal lymph nodes, chest CT
|
| 160 |
+
|
| 161 |
+
[LNQ2023](https://lnq2023.grand-challenge.org/), redistributed from the **TCIA** release
|
| 162 |
+
[MEDIASTINAL-LYMPH-NODE-SEG](https://www.cancerimagingarchive.net/collection/mediastinal-lymph-node-seg/)
|
| 163 |
+
(DOI 10.7937/QVAZ-JA09, **CC BY 4.0**) — deliberately *not* the Zenodo challenge copy, which is
|
| 164 |
+
CC BY-NC-ND and forbids derivative works.
|
| 165 |
+
|
| 166 |
+
MedVision's first DICOM + DICOM-SEG pipeline. CT series and SEG objects are paired via
|
| 167 |
+
`ReferencedSeriesSequence` rather than by filename order — verified correct on all 513 series of
|
| 168 |
+
the collection, before the completeness filter below reduces the shipped set to 120.
|
| 169 |
+
|
| 170 |
+
**Only exhaustively annotated cases are kept: 513 → 120.** Each SEG series in the TCIA release
|
| 171 |
+
declares its own completeness in the DICOM `SeriesDescription` tag — `Fully Annotated` (120) or
|
| 172 |
+
`Partially Annotated` (393). The partially annotated set is the challenge's *training* split,
|
| 173 |
+
where only a subset of the visible nodes was contoured. Measured over the masks themselves:
|
| 174 |
+
|
| 175 |
+
| `SeriesDescription` | cases | nodes/case (mean) | median | max | cases with exactly 1 node |
|
| 176 |
+
| --- | ---: | ---: | ---: | ---: | --- |
|
| 177 |
+
| `Fully Annotated` | 120 | **9.00** | 8 | 42 | 1 / 120 (1%) |
|
| 178 |
+
| `Partially Annotated` | 393 | **1.46** | 1 | 6 | 249 / 393 (63%) |
|
| 179 |
+
|
| 180 |
+
A **6.2×** gap: 63% of partially annotated cases carry exactly one segmented node against a
|
| 181 |
+
median of 8 for the fully annotated ones, so most true nodes there are unlabelled. **Unlabelled
|
| 182 |
+
is not negative** — a model that correctly detects such a node is scored as a false positive, and
|
| 183 |
+
a size measurement on it has no reference. Those cases cannot serve as benchmark ground truth, so
|
| 184 |
+
the downloader skips any SEG series not marked `Fully Annotated`.
|
| 185 |
+
|
| 186 |
+
### LIDC-IDRI — 1,013 scans, lung nodules, chest CT
|
| 187 |
+
|
| 188 |
+
[LIDC-IDRI](https://www.cancerimagingarchive.net/collection/lidc-idri/) (TCIA), CC BY 3.0. The
|
| 189 |
+
largest addition in this release.
|
| 190 |
+
|
| 191 |
+
MedVision's first multi-reader XML-contour pipeline. Masks are **consensus** binary nodule masks
|
| 192 |
+
built from four radiologists' contours via `pylidc` at the 50% consensus level. 880 of the 1,013
|
| 193 |
+
scans contain at least one nodule; the rest carry an all-zero mask. 8 patients contributed two CT
|
| 194 |
+
series, each getting a unique case ID.
|
| 195 |
+
|
| 196 |
+
Two exclusions apply:
|
| 197 |
+
|
| 198 |
+
- **CT only.** The 237 DX and 53 CR series in the same collection are projection radiographs, not
|
| 199 |
+
volumes, and carry no nodule contours. 1,018 CT series remain.
|
| 200 |
+
- **Duplicate-z series dropped (1,018 → 1,013).** `LIDC-IDRI-0085`, `-0146`, `-0418`, `-0572` and
|
| 201 |
+
`-0979` each contain two or more DICOM slices at the same `ImagePositionPatient` z, so the
|
| 202 |
+
series has no single well-defined volume. This matters here because the image and the mask are
|
| 203 |
+
built by *different* libraries — SimpleITK reconstructs the volume from an ordered file list,
|
| 204 |
+
while `pylidc`'s `consensus()` returns **array indices** into its own view of that volume. The
|
| 205 |
+
two reconstructions must agree index-for-index or a nodule contour lands on the wrong slice,
|
| 206 |
+
producing a correctly-shaped mask over the wrong anatomy: measured against pylidc's own slice
|
| 207 |
+
selection, a mismatched choice differs by up to **1,386 HU**, i.e. a completely different
|
| 208 |
+
structure rather than resampling noise. Reproducing pylidc's internal tie-break is possible but
|
| 209 |
+
makes correctness depend on an undocumented implementation detail of a third-party library, so
|
| 210 |
+
these five series are excluded instead.
|
| 211 |
+
|
| 212 |
+
## Distribution
|
| 213 |
+
|
| 214 |
+
**In plain English.** The heavy files — images and masks — live in a separate mirror repository
|
| 215 |
+
per dataset. The small files — the annotations that say what to measure — stay in the main
|
| 216 |
+
MedVision repository. The loader fetches from both and assembles one folder. Splitting them this
|
| 217 |
+
way is what lets an annotation correction ship without moving a single gigabyte of imaging.
|
| 218 |
+
|
| 219 |
+
**Technically.** Image and mask volumes are mirrored on the Hugging Face Hub so users skip the
|
| 220 |
+
from-source pipeline (VerSe alone is a 51 GB fetch plus hours of planning). **Annotations stay in
|
| 221 |
+
[`YongchengYAO/MedVision`](https://huggingface.co/datasets/YongchengYAO/MedVision)** and are the
|
| 222 |
+
only thing the `_v{X}` version in `benchmark_plan_*_v{X}.json.gz` tracks — which is why the
|
| 223 |
+
annotation version of a dataset can advance while its mirror commit stays pinned.
|
| 224 |
+
|
| 225 |
+
| Dataset | Image/mask mirror | Size | Shards | Pinned commit |
|
| 226 |
+
| --- | --- | ---: | ---: | --- |
|
| 227 |
+
| AFIDs | `YongchengYAO/AFIDs-Lite` | 1.3 GB | 1 | `c6b5568bd8a1` |
|
| 228 |
+
| PDDCA | `YongchengYAO/PDDCA-Lite` | 1.7 GB | 1 | `dd814c9679d6` |
|
| 229 |
+
| LNQ2023 | `YongchengYAO/LNQ2023-Lite` | 3.2 GB | 1 | `f7c7ef4f5ac1` |
|
| 230 |
+
| VerSe | `YongchengYAO/VerSe-Lite` | 45.5 GB | 5 | `d521b23100ea` |
|
| 231 |
+
| PI-CAI | `YongchengYAO/PI-CAI-Lite` | 3.3 GB | 1 | `c381f77130fa` |
|
| 232 |
+
| MAMA-MIA | `YongchengYAO/MAMA-MIA-Lite` | 17.7 GB | 2 | `989c74c2f1c4` |
|
| 233 |
+
| DEEP-PSMA | `YongchengYAO/DEEP-PSMA-Lite` | 3.2 GB | 1 | `f89fc6abd847` |
|
| 234 |
+
| LIDC-IDRI | `YongchengYAO/LIDC-IDRI-Lite` | 77.0 GB | 8 | `1488897f4df6` |
|
| 235 |
+
|
| 236 |
+
Volumes are stored as **uncompressed (`ZIP_STORED`) shards of ≤10 GiB** — `.nii.gz` is already
|
| 237 |
+
deflated, so re-compressing costs hours for no gain, and sharding is required because the Hub
|
| 238 |
+
caps a single LFS file at 50 GB.
|
| 239 |
+
|
| 240 |
+
Each `download_fast.py` pins its mirror by **commit SHA**, not by branch, so a later push to a
|
| 241 |
+
mirror cannot silently change what a given MedVision version resolves to.
|
| 242 |
+
|
| 243 |
+
### The `-Lite` suffix
|
| 244 |
+
|
| 245 |
+
**Every mirror carries `-Lite`**, because every one is a *derived* redistribution rather than a
|
| 246 |
+
copy of its source: all volumes are format-converted (NRRD / DICOM / `.mha` → `nii.gz`) and
|
| 247 |
+
reoriented to RAS+, and masks are normalised onto the image grid. The suffix is a provenance
|
| 248 |
+
marker, not a quality one — it says "reproduce MedVision from this, but cite the original
|
| 249 |
+
release".
|
| 250 |
+
|
| 251 |
+
Six mirrors additionally **exclude** part of their source. Every exclusion has a stated reason:
|
| 252 |
+
|
| 253 |
+
| Mirror | What is not mirrored |
|
| 254 |
+
| --- | --- |
|
| 255 |
+
| `VerSe-Lite` | 30 `sub-gl*` scans (CC BY-NC-ND — derivatives forbidden) and 19 duplicate `_split-verse<NNN>` series (would leak a subject across the train/test split). 374 → 344 redistributable → **325**. |
|
| 256 |
+
| `PI-CAI-Lite` | The ADC and HBV sequences, and cases whose expert mask is empty. Both expert folders (`resampled/` 1295 + `Pooch25/` 205) are used → **425** positives of 1500. |
|
| 257 |
+
| `MAMA-MIA-Lite` | DCE phases other than the annotated first post-contrast. |
|
| 258 |
+
| `DEEP-PSMA-Lite` | The companion CT and `totseg_24` volumes. |
|
| 259 |
+
| `LIDC-IDRI-Lite` | The 237 DX and 53 CR projection-radiograph series, plus 5 CT series with duplicate-z slices (1018 → **1013**). |
|
| 260 |
+
| `LNQ2023-Lite` | The 393 `Partially Annotated` cases — only the 120 `Fully Annotated` ones are kept (513 → **120**). |
|
| 261 |
+
|
| 262 |
+
`AFIDs-Lite` and `PDDCA-Lite` carry every case of their source — they are `-Lite` purely by
|
| 263 |
+
virtue of the preprocessing above.
|
| 264 |
+
|
| 265 |
+
### Subset folders are rebuilt, not mirrored
|
| 266 |
+
|
| 267 |
+
**In plain English.** Only some cases carry landmarks, so the landmark task needs its own image
|
| 268 |
+
folder containing exactly those cases and no others. Those folders hold copies of volumes that
|
| 269 |
+
are already in `Images/`, so mirroring them would upload and download the same data twice. They
|
| 270 |
+
are rebuilt locally instead, from the list of cases the annotations name.
|
| 271 |
+
|
| 272 |
+
**Technically.** `VerSe/Images-lumbar/` and `PDDCA/Images-landmark/` are strict subsets of
|
| 273 |
+
`Images/` that exist because the biometry planner requires its `image_folder` to be exactly 1:1
|
| 274 |
+
with `Landmarks/` (it raises `FileNotFoundError` on a case with no landmark file). Rather than
|
| 275 |
+
mirror ~38 GB of duplicate volumes, `download_fast.py` rebuilds them by hardlinking the cases
|
| 276 |
+
named in `Landmarks/`.
|
| 277 |
+
|
| 278 |
+
This depends on an ordering guarantee in the loader: step 3.1 extracts the annotation archive
|
| 279 |
+
**before** step 3.2 runs the downloader, so `Landmarks/` is already on disk when
|
| 280 |
+
`download_fast.py` reads it. Step 3.1 now also holds a per-dataset lock, so two configs of one
|
| 281 |
+
dataset prepared concurrently cannot race each other through that extraction.
|
| 282 |
+
|
| 283 |
+
## Loading
|
| 284 |
+
|
| 285 |
+
**In plain English.** Two environment variables must be set before the loader is imported: where
|
| 286 |
+
to put the data, and which annotation version you are willing to load. Neither has a default —
|
| 287 |
+
the loader refuses to guess, because guessing either one wrong is silent rather than loud.
|
| 288 |
+
|
| 289 |
+
**Technically.** `MedVision_DATA_DIR` is checked at module import and raises `ValueError` if
|
| 290 |
+
unset; `MedVision_PLANNER_VERSION` raises `EnvironmentError` during `_split_generators` if unset.
|
| 291 |
+
Both must therefore be in the environment before `load_dataset` runs.
|
| 292 |
+
|
| 293 |
+
```python
|
| 294 |
+
import os
|
| 295 |
+
os.environ["MedVision_DATA_DIR"] = "/path/to/data"
|
| 296 |
+
os.environ["MedVision_PLANNER_VERSION"] = "latest" # or "1.2.0"
|
| 297 |
+
|
| 298 |
+
from datasets import load_dataset
|
| 299 |
+
|
| 300 |
+
ds = load_dataset(
|
| 301 |
+
"YongchengYAO/MedVision",
|
| 302 |
+
"VerSe_BiometricsFromLandmarks_Task01_Sagittal_Test",
|
| 303 |
+
trust_remote_code=True,
|
| 304 |
+
)
|
| 305 |
+
```
|
| 306 |
+
|
| 307 |
+
Config names follow the existing grammar
|
| 308 |
+
`<Dataset>_<TaskType>_Task<NN>_<Plane>_<Split>`. DEEP-PSMA uses `Task01` for PSMA and `Task02`
|
| 309 |
+
for FDG. Full lists: `info/v1.2.0/ConfigurationsList_{All,Train,Test}.csv`.
|
| 310 |
+
|
| 311 |
+
`datasets==3.6.0` is required — `datasets>=4` removed loading-script support entirely.
|
| 312 |
+
|
| 313 |
+
Every one of these datasets resolves to annotation version `1.2.0`, since that is the only
|
| 314 |
+
version they publish. Loading them alongside pre-existing datasets at `latest` works and needs no
|
| 315 |
+
acknowledgement: `MedVision_ACK_RELEASE` is required only when your pin is *older* than a
|
| 316 |
+
dataset's newest annotation, which no pin of `latest` ever is. See
|
| 317 |
+
[How annotation versions are resolved](release-v1.2.0.md#how-annotation-versions-are-resolved).
|
| 318 |
+
|
| 319 |
+
## Provenance and verification
|
| 320 |
+
|
| 321 |
+
The shipped corpus is **28,060 files / 194.4 GiB** across the 8 datasets. Every mirror was
|
| 322 |
+
verified against the from-source pipeline output:
|
| 323 |
+
|
| 324 |
+
- **Round-trip verification, all 8 datasets.** Each mirror was re-downloaded into a fresh
|
| 325 |
+
directory exactly as `MedVision.py` step 3 does it — annotation zip first, then the package's
|
| 326 |
+
own `download_fast.py` chosen by the same first-match-wins rule the loader uses — and checked
|
| 327 |
+
against the pipeline output for **per-folder file counts**, **SHA-256 byte-identity** on
|
| 328 |
+
sampled volumes, and (for VerSe and PDDCA) that the rebuilt `Images-*` subset is exactly 1:1
|
| 329 |
+
with `Landmarks/`. **8/8 PASS.**
|
| 330 |
+
- **Exhaustive hash comparison** — an earlier full sweep SHA-256'd every file on both sides in
|
| 331 |
+
both directions (29,230 files / 208.9 GiB at that point, before the LNQ2023, PI-CAI and
|
| 332 |
+
LIDC-IDRI rebuilds): **zero content mismatches, zero one-sided files.**
|
| 333 |
+
- **Independent from-source re-run** — AFIDs and PDDCA re-downloaded from the original upstream
|
| 334 |
+
(OpenNeuro S3, imagenglab.com) with the Hub bypassed entirely; `Images/`, `Masks/` and
|
| 335 |
+
`Images-landmark/` byte-identical to both the pipeline output and the mirror. This is the only
|
| 336 |
+
non-circular evidence: the mirrors are built *from* the pipeline output, so comparing the two
|
| 337 |
+
proves the pack/upload/download cycle is lossless, not that the two code paths agree.
|
| 338 |
+
- **Splits** are subject-level 70/30 with `random_seed=1024`, `sorted()` before shuffle. Verified
|
| 339 |
+
after every rebuild — e.g. LIDC-IDRI's 1013 cases split 709/304 = exactly 0.700 across all
|
| 340 |
+
three plans.
|
| 341 |
+
- **Plan validation** — 22 plan files, 10,893 task-case entries: all splits within 66–74%,
|
| 342 |
+
sampled `image_file`/`mask_file`/`landmark_file` references resolve on disk, and each dataset's
|
| 343 |
+
`dataset_info` is byte-identical across its plans (required by `compile_dataset_info.py`).
|
| 344 |
+
|
| 345 |
+
Two reproducibility notes for anyone regenerating from source:
|
| 346 |
+
|
| 347 |
+
- `Landmarks/*.json.gz` regenerated locally differ from the published bytes **in the gzip MTIME
|
| 348 |
+
header field only** (RFC 1952 offsets 4–7); decompressed content is identical.
|
| 349 |
+
- `Landmarks-*fig*/` PNGs are matplotlib-version dependent. The published figures were rendered
|
| 350 |
+
with **matplotlib 3.11.1**; with that version, re-rendering reproduces them byte for byte.
|
| 351 |
+
|
| 352 |
+
## Citation and licence obligations
|
| 353 |
+
|
| 354 |
+
MedVision redistributes derived annotations and preprocessed volumes; the original licences
|
| 355 |
+
continue to govern. In particular:
|
| 356 |
+
|
| 357 |
+
- **VerSe is CC BY-SA 4.0** — ShareAlike propagates to anything derived from it.
|
| 358 |
+
- **PI-CAI, MAMA-MIA and DEEP-PSMA are CC BY-NC 4.0** — non-commercial use only.
|
| 359 |
+
- **AFIDs is CC BY 4.0** (landmarks; its imaging is CC0); PDDCA is public domain / CC BY 3.0;
|
| 360 |
+
LNQ2023 CC BY 4.0; LIDC-IDRI CC BY 3.0.
|
| 361 |
+
|
| 362 |
+
Cite the original dataset publications, not only MedVision. Each mirror's dataset card lists the
|
| 363 |
+
source papers. Three datasets need more than one citation:
|
| 364 |
+
|
| 365 |
+
- **VerSe** — all three of its papers (Löffler 2020, Liebl 2021, Sekuboyina 2021).
|
| 366 |
+
- **PI-CAI** — the challenge dataset *and*
|
| 367 |
+
[Pooch et al., 2025](https://doi.org/10.1101/2025.05.13.25327456), whose expert annotations
|
| 368 |
+
supply 205 of the 425 shipped cases.
|
| 369 |
+
- **MAMA-MIA** — the *Scientific Data* paper plus
|
| 370 |
+
[arXiv:2603.01250](https://arxiv.org/abs/2603.01250).
|
| 371 |
+
|
| 372 |
+
MedVision is for research and education. It is not a medical device and must not be used for
|
| 373 |
+
clinical decision-making.
|
| 374 |
+
|
| 375 |
+
## See also
|
| 376 |
+
|
| 377 |
+
- [`doc/release-v1.2.0.md`](release-v1.2.0.md) — loader changes, annotation-version resolution,
|
| 378 |
+
the acknowledgement gate, and the stale-cache fix
|
| 379 |
+
- [`doc/design-annotation-version-resolution.md`](design-annotation-version-resolution.md) —
|
| 380 |
+
why the version-resolution mechanism has the shape it has, and what was rejected
|
| 381 |
+
- [`doc/file-structure.md`](file-structure.md) — dataset directory layout
|
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Release v1.2.0
|
| 2 |
+
|
| 3 |
+
**v1.2.0 adds 8 datasets (130 configs) and changes no existing annotation.** Every dataset released before this version loads exactly the same annotation files it did at v1.1.1 — byte for byte.
|
| 4 |
+
|
| 5 |
+
`MedVision_PLANNER_VERSION` sets the newest annotations you are willing to load. To get v1.2.0:
|
| 6 |
+
|
| 7 |
+
```bash
|
| 8 |
+
export MedVision_PLANNER_VERSION=latest # resolves to 1.2.0
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
Throughout this note, a **pin** means `MedVision_PLANNER_VERSION` set to a specific version rather than `latest`.
|
| 12 |
+
|
| 13 |
+
## Summary
|
| 14 |
+
|
| 15 |
+
Seven changes, most important first. Each links to its own section below.
|
| 16 |
+
|
| 17 |
+
| | Change | In one line | Action |
|
| 18 |
+
| --- | --- | --- | --- |
|
| 19 |
+
| 1 | [New datasets](#new-datasets) | 8 datasets, 130 configs; the catalogue grows from 820 to 950 | none |
|
| 20 |
+
| 2 | [Fixed: cached data could be stale](#fixed-cached-data-could-be-stale) | `load_dataset` could hand back old rows after the annotations behind them changed — and this happened to a real, shipped change | **check 4 conditions** |
|
| 21 |
+
| 3 | [How annotation versions are resolved](#how-annotation-versions-are-resolved) | each dataset now loads its own newest annotation at or below the version you ask for, instead of one rule for the whole catalogue | none |
|
| 22 |
+
| 4 | [Acknowledgement is now per dataset](#changed-acknowledgement-is-now-per-dataset) | `MedVision_ACK_RELEASE` is demanded only when *the dataset you are loading* has moved past your pin | none — fewer prompts |
|
| 23 |
+
| 5 | [Fixed: two data roots could share one cache](#fixed-two-data-roots-could-share-one-cache) | pointing at a second `MedVision_DATA_DIR` could return rows whose file paths point into the first | **clear once**, if it applies |
|
| 24 |
+
| 6 | [Fixed: download reliability](#fixed-download-reliability) | four defects: a failed download recorded as finished, a crash when one dataset was prepared twice at once, a broken relative data root, and ~27 GiB of needless re-downloading | none |
|
| 25 |
+
| 7 | [Stricter `MedVision_PLANNER_VERSION`](#changed-stricter-medvision_planner_version-values) | values nobody published, like `1.1.5` or `v1.1.1`, are refused instead of silently resolving to something older | none unless you set one |
|
| 26 |
+
|
| 27 |
+
Items 2 and 5 are correctness fixes and are the only ones that can require anything of you. Everything else applies automatically.
|
| 28 |
+
|
| 29 |
+
## Do I need to do anything?
|
| 30 |
+
|
| 31 |
+
| Your situation | What to do |
|
| 32 |
+
| --- | --- |
|
| 33 |
+
| You use `latest` | Nothing |
|
| 34 |
+
| You pin `1.1.1` or older | Nothing breaks. You just cannot load the 8 new datasets — [details](#pinning-a-version-older-than-v120) |
|
| 35 |
+
| You built a `Tumor-Lesion-Size` cache before v1.1.1 shipped | Check four conditions, then clear that cache once — [details](#fixed-cached-data-could-be-stale) |
|
| 36 |
+
| You have used two or more `MedVision_DATA_DIR` values without a separate `HF_DATASETS_CACHE` for each | Clear those caches once — [details](#fixed-two-data-roots-could-share-one-cache) |
|
| 37 |
+
|
| 38 |
+
Landed here from a version error? Start with [How annotation versions are resolved](#how-annotation-versions-are-resolved).
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## New datasets
|
| 43 |
+
|
| 44 |
+
| Dataset | Tasks |
|
| 45 |
+
| --- | --- |
|
| 46 |
+
| AFIDs | Biometrics-From-Landmarks |
|
| 47 |
+
| DEEP-PSMA | Mask-Size, Box-Size, Tumor-Lesion-Size |
|
| 48 |
+
| LIDC-IDRI | Mask-Size, Box-Size, Tumor-Lesion-Size |
|
| 49 |
+
| LNQ2023 | Mask-Size, Box-Size, Tumor-Lesion-Size |
|
| 50 |
+
| MAMA-MIA | Mask-Size, Box-Size, Tumor-Lesion-Size |
|
| 51 |
+
| PDDCA | Mask-Size, Box-Size, Biometrics-From-Landmarks |
|
| 52 |
+
| PI-CAI | Mask-Size, Box-Size, Tumor-Lesion-Size |
|
| 53 |
+
| VerSe | Mask-Size, Box-Size, Biometrics-From-Landmarks |
|
| 54 |
+
|
| 55 |
+
All 8 publish annotation version `1.2.0`. Config lists live in the dataset repo under `info/`: `info/v1.2.0/` (950 configs) and `info/v1.0.0-v1.1.1/` (820 configs).
|
| 56 |
+
|
| 57 |
+
For what these datasets actually contain — anatomy, modality, case counts, licences, the preprocessing decisions behind each one, and the Hugging Face mirrors they download from — see [`doc/release-v1.2.0-datasets.md`](release-v1.2.0-datasets.md).
|
| 58 |
+
|
| 59 |
+
## Fixed: cached data could be stale
|
| 60 |
+
|
| 61 |
+
**This affects all versions before v1.2.0 and is worth two minutes of your time.**
|
| 62 |
+
|
| 63 |
+
**In plain English.** `load_dataset` keeps a local copy of the rows it built last time, so that loading the same thing again is fast. To decide whether that copy is still good, it compared the version you *asked for* (i.e., the version from `MedVision_PLANNER_VERSION`). But asking for a version does not pin down the data. The same request can point at different annotation files at different times, and several different requests can point at one file. When the data behind your request changed, the request did not — so you got the old copy back, and the new annotations never reached you. The annotation file sitting on your disk was not refreshed either, because that check compared the same two version strings.
|
| 64 |
+
|
| 65 |
+
**Technically.** The HuggingFace builder-cache fingerprint was derived from the value of `MedVision_PLANNER_VERSION`, not from the `benchmark_plan_{kind}_v{X}.json.gz` that value resolved to. The requested version is not an identity for the data; the resolved filename is. The download predicate had the same flaw, comparing the requested version against the version recorded in `.downloaded_datasets.json`, so neither the Arrow layer nor the on-disk layer noticed the change.
|
| 66 |
+
|
| 67 |
+
**This is not hypothetical.** The v1.1.1 release changed the already-published v1.1.0 annotations in place, with no version bump. It re-aligned the train/test split, relabelling about 41% of cases in six datasets: BraTS24, HNTSMRG24, KiPA22, KiTS23, MSD and autoPET-III. (See "Split alignment to v1.0.0" in `doc/release-v1.1.1.md`.)
|
| 68 |
+
|
| 69 |
+
The measurement values were byte-identical, so a stale cache looks completely normal. Only the train/test partition differs.
|
| 70 |
+
|
| 71 |
+
**You are affected only if all four are true:**
|
| 72 |
+
|
| 73 |
+
1. you loaded a `Tumor-Lesion-Size` config, and
|
| 74 |
+
2. the dataset was BraTS24, HNTSMRG24, KiPA22, KiTS23, MSD or autoPET-III, and
|
| 75 |
+
3. you built the cache *before* the v1.1.1 release, at `MedVision_PLANNER_VERSION=1.1.0` or at `latest` (which meant 1.1.0 then), and
|
| 76 |
+
4. you have reused that cache since.
|
| 77 |
+
|
| 78 |
+
If any one of them is false, you have nothing to do here.
|
| 79 |
+
|
| 80 |
+
**To clear it,** refresh both caches once: the annotation file on disk *and* the Arrow cache. Clearing the Arrow cache alone is not enough, because the annotation file is stale too.
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
import os
|
| 84 |
+
from datasets import load_dataset
|
| 85 |
+
|
| 86 |
+
config = "..." # one of your affected Tumor-Lesion-Size configs
|
| 87 |
+
split_name = "test" # repeat for each split you cached
|
| 88 |
+
|
| 89 |
+
os.environ["MedVision_FORCE_DOWNLOAD_DATA"] = "True" # refresh the annotation file
|
| 90 |
+
ds = load_dataset(
|
| 91 |
+
"YongchengYAO/MedVision",
|
| 92 |
+
name=config,
|
| 93 |
+
trust_remote_code=True,
|
| 94 |
+
split=split_name,
|
| 95 |
+
download_mode="force_redownload", # rebuild the Arrow cache
|
| 96 |
+
)
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
From v1.2.0 the cache key is the annotation version that **actually loads**. If the annotations behind your pin ever change, the key changes with them, and the stale cache is correctly missed.
|
| 100 |
+
|
| 101 |
+
**A published annotation file is never rewritten in place. Corrections always get a new version number** — the version string is the only identity the data has.
|
| 102 |
+
|
| 103 |
+
Two consequences of the new key are worth knowing:
|
| 104 |
+
|
| 105 |
+
- **Two pins that resolve to the same annotation file now share one cache** instead of building two. Pinning `1.1.1` and pinning `1.0.0` both load ACDC's only annotation, `1.0.0`, so they land in the same place.
|
| 106 |
+
- **One-time rebuild, for everyone.** Because the key changed, existing Arrow caches are orphaned and rebuild on next use. The rebuild reads the annotation plan file and re-emits the rows; it does not re-transfer any images or annotations, so it costs seconds per config.
|
| 107 |
+
|
| 108 |
+
Old cache directories are not deleted automatically. `<hf_cache>` below is your `HF_DATASETS_CACHE` (default `~/.cache/huggingface`); `datasets` snake-cases the builder name, hence `med_vision`. List before deleting:
|
| 109 |
+
|
| 110 |
+
```bash
|
| 111 |
+
ls -d <hf_cache>/datasets/*med_vision* # check first
|
| 112 |
+
rm -rf <hf_cache>/datasets/*med_vision*
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
## How annotation versions are resolved
|
| 116 |
+
|
| 117 |
+
📚 [Annotation Version Control](https://medvision-vlm.github.io/explorer.html)
|
| 118 |
+
|
| 119 |
+
**In plain English.** Two different things were both called "the version", and they moved at different speeds. One is the version of the *release* — it goes up every time anything ships. The other is the version of one dataset's *annotations for one task* — it goes up only when those particular annotations are regenerated, which is rare. Treating them as the same number meant that publishing a new release implied every dataset had new annotations, which was never true.
|
| 120 |
+
|
| 121 |
+
So `MedVision_PLANNER_VERSION` is now read as a **ceiling** rather than an exact match: *"give me the newest annotations that existed at or before this point"*. Each dataset answers that question for itself. `latest` means "the annotations as they stand now"; `1.1.1` means "the annotations as they stood at v1.1.1" — dataset by dataset.
|
| 122 |
+
|
| 123 |
+
**Technically.**
|
| 124 |
+
|
| 125 |
+
- The **release version** (`1.2.0`) is a property of the published `MedVision.py` and advances every release. It is deliberately hardcoded in the loader, so it reflects the remote release rather than whichever `medvision_ds` happens to be installed locally.
|
| 126 |
+
- The **annotation version** — the `_v{X}` in `benchmark_plan_{kind}_v{X}.json.gz`, where *kind* is `segmentation`, `detection` or `biometry` — is a property of a *(dataset, task)* pair.
|
| 127 |
+
|
| 128 |
+
`MedVision_PLANNER_VERSION` accepts **either kind of version** — a published annotation version such as `1.1.1`, or the `medvision_ds` release version — and resolves per (dataset, task) to the newest published annotation at or below it.
|
| 129 |
+
|
| 130 |
+
The accepted set is derived from the annotation index, so it is exactly:
|
| 131 |
+
|
| 132 |
+
| Value | |
|
| 133 |
+
| --- | --- |
|
| 134 |
+
| `latest` | resolves to the current release, `1.2.0` |
|
| 135 |
+
| `1.2.0` | adds 8 datasets; existing annotations unchanged — also the current release |
|
| 136 |
+
| `1.1.1` | fixes transposed in-plane voxel spacing in the TL ellipse fit |
|
| 137 |
+
| `1.1.0` | corrected TL filtering, cluster threshold 20px |
|
| 138 |
+
| `1.0.0` | original TL filtering, cluster threshold 200px |
|
| 139 |
+
|
| 140 |
+
Anything else is refused — see [Stricter `MedVision_PLANNER_VERSION` values](#changed-stricter-medvision_planner_version-values).
|
| 141 |
+
|
| 142 |
+
The release version stays acceptable even if a future release publishes no annotations of its own — otherwise `latest`, which resolves to it, would stop working.
|
| 143 |
+
|
| 144 |
+
Worked example, all at `MedVision_PLANNER_VERSION=latest`:
|
| 145 |
+
|
| 146 |
+
| Dataset / task | Published versions | Loads |
|
| 147 |
+
| --- | --- | --- |
|
| 148 |
+
| ACDC / Mask-Size | `1.0.0` | `1.0.0` |
|
| 149 |
+
| KiTS23 / Tumor-Lesion-Size | `1.0.0`, `1.1.0`, `1.1.1` | `1.1.1` |
|
| 150 |
+
| PDDCA / Mask-Size | `1.2.0` | `1.2.0` |
|
| 151 |
+
|
| 152 |
+
### Why the old rule had to go
|
| 153 |
+
|
| 154 |
+
For every task except Tumor-Lesion-Size (TL) the old loader fell back to `1.0.0`; for TL it did not fall back at all, and required an annotation file stamped with the exact release version.
|
| 155 |
+
|
| 156 |
+
Once the release became 1.2.0, `latest` would have gone looking for a `1.2.0` TL annotation for every dataset. The five new TL datasets publish one. **The 162 pre-existing TL configs do not, and would all have failed.**
|
| 157 |
+
|
| 158 |
+
The new rule also matches what v1.1.1 already documented: *"if a `1.1.x` plan is absent the loader transparently falls back"*. The behaviour for every combination that worked before is unchanged.
|
| 159 |
+
|
| 160 |
+
**A missing annotation is now caught up front.** The per-(dataset, task) rule replaces the hardcoded `1.0.0` fallback and its TL exclusion, so a missing file raises a named error at resolution time — before anything downloads — instead of crashing later, mid-way through generating rows.
|
| 161 |
+
|
| 162 |
+
The two kinds of version coincide today — every annotation version published so far is also a release version — so the distinction has not yet had to matter. It will the first time a correction ships as, say, `1.2.1` without a release of its own: that value becomes accepted as an annotation version, and reading the setting as a ceiling is what makes it behave sensibly.
|
| 163 |
+
|
| 164 |
+
## Changed: acknowledgement is now per dataset
|
| 165 |
+
|
| 166 |
+
**In plain English.** `MedVision_ACK_RELEASE` is the "yes, I know I am asking for something older than what exists" switch. Before, *older* was judged against the catalogue as a whole: publishing anything new made every pinned user set the switch, even for datasets the release never touched. Now it is judged against the dataset in front of you. Since v1.2.0 changed no existing annotation, nobody pinned at `1.1.1` is prompted at all.
|
| 167 |
+
|
| 168 |
+
**Technically.** The gate compares your pin against the newest annotation version published for *this* (dataset, task) pair, not against the release version.
|
| 169 |
+
|
| 170 |
+
```bash
|
| 171 |
+
export MedVision_PLANNER_VERSION=1.1.0 # older than KiTS23's newest TL annotation
|
| 172 |
+
|
| 173 |
+
# pick ONE of these two:
|
| 174 |
+
export MedVision_ACK_RELEASE=1.1.1 # KiTS23's newest TL annotation, or ...
|
| 175 |
+
# export MedVision_ACK_RELEASE=1.2.0 # ... the whole release
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
Two values are accepted, because they acknowledge different things:
|
| 179 |
+
|
| 180 |
+
- **The dataset's newest annotation** (`1.1.1` above) — "I know *this dataset* has moved past my pin." Use it when loading one dataset; it is the number the error message shows you. It stops working the next time that dataset is regenerated.
|
| 181 |
+
- **The release** (`1.2.0` above) — "I have read release 1.2.0." Use it for a catalogue sweep. It stops working at the next release.
|
| 182 |
+
|
| 183 |
+
A sweep cannot use the per-dataset value. Different datasets sit at different newest versions, so a sweep would need several values at once — and `MedVision_ACK_RELEASE` holds only one.
|
| 184 |
+
|
| 185 |
+
What changed is *when you are blocked*. Both columns assume the release is 1.2.0:
|
| 186 |
+
|
| 187 |
+
| Your pin | Config you load | Before | Now |
|
| 188 |
+
| --- | --- | --- | --- |
|
| 189 |
+
| `1.1.1` | ACDC / Mask-Size | blocked | loads — v1.2.0 did not touch ACDC |
|
| 190 |
+
| `1.1.1` | KiTS23 / Tumor-Lesion-Size | blocked | loads — `1.1.1` *is* its newest |
|
| 191 |
+
| `1.1.0` | KiTS23 / Tumor-Lesion-Size | blocked | still blocked — a newer TL annotation exists |
|
| 192 |
+
|
| 193 |
+
## Fixed: two data roots could share one cache
|
| 194 |
+
|
| 195 |
+
**In plain English.** Every row MedVision hands you contains absolute file paths, and those paths are built from `MedVision_DATA_DIR`. The data root was therefore baked into the rows — but it was not part of the name the cache was filed under, so a cache built for one root looked like a match for any other. Point at a second root and the first root's cache answered: nothing downloaded into the new location, and the paths you got back still led into the old one.
|
| 196 |
+
|
| 197 |
+
**Technically.** The canonicalised data root is now part of the builder-cache fingerprint, so each root keeps its own cache and two roots can be used side by side.
|
| 198 |
+
|
| 199 |
+
Whether this could ever have affected you depends on where your Arrow cache lives. For most users, it could not:
|
| 200 |
+
|
| 201 |
+
- **Never affected: [`medvision_bm`](https://github.com/YongchengYAO/MedVision) users** (the MedVision benchmark and finetuning codebase). `setup_env_hf_medvision_ds(data_dir)` sets `MedVision_DATA_DIR`, `HF_HOME` and `HF_DATASETS_CACHE` from the same `data_dir`, so the Arrow cache already moved with the data root. Every eval and training script goes through that call.
|
| 202 |
+
- **Never affected: setting `HF_HOME` / `HF_DATASETS_CACHE` yourself per data root, or passing `cache_dir=`** — for the same reason.
|
| 203 |
+
- **Exposed: calling `load_dataset` directly with only `MedVision_DATA_DIR` set** — the minimal usage shown on the dataset card. `HF_DATASETS_CACHE` then defaults to `~/.cache/huggingface/datasets`, which does not move with the data root, so both roots shared one cache.
|
| 204 |
+
|
| 205 |
+
If you are in that last group and you have used more than one data root, clear the affected caches once with `download_mode="force_redownload"`. Unlike the stale-annotation case above, the annotation files themselves were never wrong here, so rebuilding the Arrow layer is enough; the rebuild runs the loader, which downloads into the new root.
|
| 206 |
+
|
| 207 |
+
Setting `HF_DATASETS_CACHE` alongside each data root, as `medvision_bm` does, avoids the problem entirely and is worth doing regardless.
|
| 208 |
+
|
| 209 |
+
## Fixed: download reliability
|
| 210 |
+
|
| 211 |
+
Four defects in the download path. All are fixed automatically; none need action.
|
| 212 |
+
|
| 213 |
+
### A failed image download is no longer recorded as a finished install
|
| 214 |
+
|
| 215 |
+
**In plain English.** The loader writes a note saying "this dataset is fully installed", and every later load trusts that note and skips downloading. The note used to be written even when the image download had failed. So a dataset whose images never arrived was marked complete forever, and later loads produced rows pointing at files that do not exist.
|
| 216 |
+
|
| 217 |
+
**Technically.** The image step caught its own failure — a bare `except:` that blindly re-ran the entire multi-gigabyte transfer, wrapped by an outer `except subprocess.CalledProcessError` — and fell through to write the completion entry in `.downloaded_datasets.json` regardless of outcome. The failure now propagates and no entry is written, so the next load retries. The same bare handler also caught Ctrl-C, restarting a long download instead of stopping it.
|
| 218 |
+
|
| 219 |
+
### Two configs of one dataset can be prepared at the same time
|
| 220 |
+
|
| 221 |
+
**In plain English.** A dataset's annotations arrive as one zip file, which the loader downloads, unpacks, and deletes. But one dataset covers many configs — train and test of a single task are two of them, and BraTS24 has 228 in total — and HuggingFace prepares each config as an independent job. Two jobs for the same dataset therefore both downloaded that one zip, both unpacked it on top of each other, and whichever finished second crashed trying to delete a file the first had already removed. Loading a dataset's train and test splits in parallel was enough to trigger it.
|
| 222 |
+
|
| 223 |
+
**Technically.** HuggingFace's builder lock is per config, and the loader's own existing lock guards only `.downloaded_datasets.json` — which is not written until after the images finish, leaving the whole install unprotected. The download → unpack → delete sequence now runs under a per-dataset lock, with a re-check inside it so the waiting job skips the work instead of repeating it. The previous symptom was a bare `FileNotFoundError` on `Datasets/<name>.zip`.
|
| 224 |
+
|
| 225 |
+
### `MedVision_DATA_DIR` is resolved to an absolute path once
|
| 226 |
+
|
| 227 |
+
**In plain English.** A relative data root such as `./data` broke every download, because two different steps each changed the working directory and the second one then resolved against the first. Different spellings of one location also counted as different locations.
|
| 228 |
+
|
| 229 |
+
**Technically.** The root is canonicalised once, up front, with `expanduser` → `abspath` → `normpath`, so `~/data`, `/home/me/data` and `/home/me/data/` are one root rather than three — which also matters now that the root is part of the cache key. An empty value is rejected rather than silently promoting the current working directory to the data root.
|
| 230 |
+
|
| 231 |
+
### The download check now asks two separate questions
|
| 232 |
+
|
| 233 |
+
**In plain English.** "Which annotations do I have?" and "did the last install finish?" used to be answered by the same recorded number, which was the version you *requested* — a number the dataset might never have published. The first question is now answered by looking at the dataset directory; the second by whether the record exists at all.
|
| 234 |
+
|
| 235 |
+
**Technically.**
|
| 236 |
+
|
| 237 |
+
| Question | Now answered by | Previously answered by |
|
| 238 |
+
| --- | --- | --- |
|
| 239 |
+
| Which annotation version is on disk? | The dataset directory itself, compared against what is published for that dataset | The value recorded in `.downloaded_datasets.json`, compared against the version you requested |
|
| 240 |
+
| Did a previous install finish? | Whether a `.downloaded_datasets.json` entry exists | The same entry — but its *value* was also read as a version |
|
| 241 |
+
|
| 242 |
+
The entry is written only after the images download and the RAS+ reorientation completes, so a missing entry reliably marks a run that died partway. Under the old rule, a pin naming a version the dataset never published forced a full re-download — about 27 GiB of annotation archives across the 22 pre-existing datasets, plus a re-run of image download and reorientation over the whole corpus.
|
| 243 |
+
|
| 244 |
+
### `.downloaded_datasets.json` now records what is on disk
|
| 245 |
+
|
| 246 |
+
Before v1.2.0 this entry recorded the version you *requested*, not the version on disk. ACDC's only annotation is `1.0.0`, but loading it at `latest` under the v1.1.1 loader wrote `dataset_ACDC: "1.1.1"`, and pinning `1.2.0` wrote `"1.2.0"`. The entry now records the highest version actually present on disk.
|
| 247 |
+
|
| 248 |
+
| Dataset / plan kind | Versions on disk | Pin | Old entry | New entry |
|
| 249 |
+
| --- | --- | --- | --- | --- |
|
| 250 |
+
| KiTS23 / biometry | `1.0.0, 1.1.0, 1.1.1` | `1.2.0` | `1.2.0` ✗ | `1.1.1` |
|
| 251 |
+
| KiTS23 / biometry | `1.0.0, 1.1.0, 1.1.1` | `1.1.0` | `1.1.0` | `1.1.1` |
|
| 252 |
+
| ACDC / segmentation | `1.0.0` | `1.2.0` | `1.2.0` ✗ | `1.0.0` |
|
| 253 |
+
|
| 254 |
+
✗ marks an entry naming a version the directory does not contain.
|
| 255 |
+
|
| 256 |
+
The `1.1.0` pin row is deliberate. The entry describes what the directory *can serve*, not what this particular load asked for, so an older `MedVision.py` comparing `cached < requested` still reaches the right answer. (The entry is rewritten only when a download actually runs, so the "new entry" is what would be written on that dataset's next download.)
|
| 257 |
+
|
| 258 |
+
**You do not need to clean up old entries.** A wrong value is now inert — the version decision reads the dataset directory, not this field — and it is overwritten the next time that dataset downloads. The field's *presence* is what still matters: it is the "install finished" marker.
|
| 259 |
+
|
| 260 |
+
## Changed: stricter `MedVision_PLANNER_VERSION` values
|
| 261 |
+
|
| 262 |
+
**In plain English.** A version string nobody ever published is far more likely to be a typo than an intention, so it is now refused with the accepted values listed. Previously such a value was accepted and quietly resolved to something older — or left every config unloadable with no explanation.
|
| 263 |
+
|
| 264 |
+
**Technically.** Values are validated against the published annotation versions plus the current release ([the accepted set](#how-annotation-versions-are-resolved)). Two categories were previously mishandled:
|
| 265 |
+
|
| 266 |
+
*Malformed*, like `v1.1.1` or `1.2`. These matched no published annotation filename and fell through to the `1.0.0` fallback, which printed a banner naming the requested and loaded files — but only once per task type, so in a catalogue sweep later datasets degraded quietly. For Tumor-Lesion-Size, where there was no fallback at all, the same pin produced a missing path and a crash.
|
| 267 |
+
|
| 268 |
+
*Well-formed but never published*, like `1.1.5` or `0.0.0`. `1.1.5` silently resolved down to whatever each dataset published below it, and `0.0.0` left all 950 configs unloadable with no hint why.
|
| 269 |
+
|
| 270 |
+
Both are now refused at parse time. Surrounding whitespace is still stripped and accepted.
|
| 271 |
+
|
| 272 |
+
---
|
| 273 |
+
|
| 274 |
+
## Pinning a version older than v1.2.0
|
| 275 |
+
|
| 276 |
+
A dataset introduced in v1.2.0 cannot be loaded at an earlier pin — its annotations did not exist yet. Asking for one raises a clear error naming the dataset and the versions that do exist, instead of failing deep inside the loader.
|
| 277 |
+
|
| 278 |
+
Setting `MedVision_ACK_RELEASE` does not help here, and the error says so. To sweep the whole catalogue at a pinned version, iterate that release's config list instead. The path below is relative to a checkout of the dataset repo:
|
| 279 |
+
|
| 280 |
+
```python
|
| 281 |
+
configs = open("info/v1.0.0-v1.1.1/ConfigurationsList_All.csv").read().split()
|
| 282 |
+
```
|
| 283 |
+
|
| 284 |
+
## What did not change
|
| 285 |
+
|
| 286 |
+
**No pre-existing dataset was regenerated in this release.** Every (pin, dataset, task) combination that worked before yields byte-identical rows:
|
| 287 |
+
|
| 288 |
+
- Where your pin matched an annotation file exactly, it still resolves to that file.
|
| 289 |
+
- Where your pin fell back to `1.0.0` (every non-TL task), it still resolves to `1.0.0` — every non-TL dataset publishes exactly one annotation version.
|
| 290 |
+
- Legacy boolean `true` entries in `.downloaded_datasets.json` remain valid: their presence is read as "an install completed", which is what the download check now uses, so nothing re-downloads en masse. Their value is no longer interpreted as a version. See `doc/release-v1.1.0.md` for the original contract.
|
| 291 |
+
- No environment variable, config name, feature schema or split name changed.
|
| 292 |
+
|
| 293 |
+
Two behaviours changed deliberately, both from "silently wrong" to "explicitly refused": a malformed version string, and a dataset requested at a version predating its existence. Neither had a working counterpart before.
|
| 294 |
+
|
| 295 |
+
Verified with `scripts/test_annotation_resolution.py` (950 configs × every pin) and `scripts/test_tl_ack_gate.py`, both in the dataset repo.
|
| 296 |
+
|
| 297 |
+
## See also
|
| 298 |
+
|
| 299 |
+
- `doc/release-v1.2.0-datasets.md` — the 8 new datasets in detail
|
| 300 |
+
- `doc/release-v1.1.1.md` — TL ellipse-fit bugfix
|
| 301 |
+
- `doc/release-v1.1.0.md` — TL sample filtering; the legacy-boolean tracker contract
|
| 302 |
+
- `doc/design-annotation-version-resolution.md` — design notes for the resolution mechanism
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,950 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Sagittal_Train
|
| 2 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Sagittal_Test
|
| 3 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Coronal_Train
|
| 4 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Coronal_Test
|
| 5 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Axial_Train
|
| 6 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Axial_Test
|
| 7 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Sagittal_Train
|
| 8 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Sagittal_Test
|
| 9 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Coronal_Train
|
| 10 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Coronal_Test
|
| 11 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Axial_Train
|
| 12 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Axial_Test
|
| 13 |
+
AbdomenCT-1K_MaskSize_Task01_Sagittal_Train
|
| 14 |
+
AbdomenCT-1K_MaskSize_Task01_Sagittal_Test
|
| 15 |
+
AbdomenCT-1K_MaskSize_Task01_Coronal_Train
|
| 16 |
+
AbdomenCT-1K_MaskSize_Task01_Coronal_Test
|
| 17 |
+
AbdomenCT-1K_MaskSize_Task01_Axial_Train
|
| 18 |
+
AbdomenCT-1K_MaskSize_Task01_Axial_Test
|
| 19 |
+
AbdomenCT-1K_BoxSize_Task01_Sagittal_Train
|
| 20 |
+
AbdomenCT-1K_BoxSize_Task01_Sagittal_Test
|
| 21 |
+
AbdomenCT-1K_BoxSize_Task01_Coronal_Train
|
| 22 |
+
AbdomenCT-1K_BoxSize_Task01_Coronal_Test
|
| 23 |
+
AbdomenCT-1K_BoxSize_Task01_Axial_Train
|
| 24 |
+
AbdomenCT-1K_BoxSize_Task01_Axial_Test
|
| 25 |
+
ACDC_MaskSize_Task01_Sagittal_Train
|
| 26 |
+
ACDC_MaskSize_Task01_Sagittal_Test
|
| 27 |
+
ACDC_MaskSize_Task01_Coronal_Train
|
| 28 |
+
ACDC_MaskSize_Task01_Coronal_Test
|
| 29 |
+
ACDC_MaskSize_Task01_Axial_Train
|
| 30 |
+
ACDC_MaskSize_Task01_Axial_Test
|
| 31 |
+
ACDC_BoxSize_Task01_Sagittal_Train
|
| 32 |
+
ACDC_BoxSize_Task01_Sagittal_Test
|
| 33 |
+
ACDC_BoxSize_Task01_Coronal_Train
|
| 34 |
+
ACDC_BoxSize_Task01_Coronal_Test
|
| 35 |
+
ACDC_BoxSize_Task01_Axial_Train
|
| 36 |
+
ACDC_BoxSize_Task01_Axial_Test
|
| 37 |
+
AMOS22_MaskSize_Task01_Sagittal_Train
|
| 38 |
+
AMOS22_MaskSize_Task01_Sagittal_Test
|
| 39 |
+
AMOS22_MaskSize_Task01_Coronal_Train
|
| 40 |
+
AMOS22_MaskSize_Task01_Coronal_Test
|
| 41 |
+
AMOS22_MaskSize_Task01_Axial_Train
|
| 42 |
+
AMOS22_MaskSize_Task01_Axial_Test
|
| 43 |
+
AMOS22_MaskSize_Task02_Sagittal_Train
|
| 44 |
+
AMOS22_MaskSize_Task02_Sagittal_Test
|
| 45 |
+
AMOS22_MaskSize_Task02_Coronal_Train
|
| 46 |
+
AMOS22_MaskSize_Task02_Coronal_Test
|
| 47 |
+
AMOS22_MaskSize_Task02_Axial_Train
|
| 48 |
+
AMOS22_MaskSize_Task02_Axial_Test
|
| 49 |
+
AMOS22_BoxSize_Task01_Sagittal_Train
|
| 50 |
+
AMOS22_BoxSize_Task01_Sagittal_Test
|
| 51 |
+
AMOS22_BoxSize_Task01_Coronal_Train
|
| 52 |
+
AMOS22_BoxSize_Task01_Coronal_Test
|
| 53 |
+
AMOS22_BoxSize_Task01_Axial_Train
|
| 54 |
+
AMOS22_BoxSize_Task01_Axial_Test
|
| 55 |
+
AMOS22_BoxSize_Task02_Sagittal_Train
|
| 56 |
+
AMOS22_BoxSize_Task02_Sagittal_Test
|
| 57 |
+
AMOS22_BoxSize_Task02_Coronal_Train
|
| 58 |
+
AMOS22_BoxSize_Task02_Coronal_Test
|
| 59 |
+
AMOS22_BoxSize_Task02_Axial_Train
|
| 60 |
+
AMOS22_BoxSize_Task02_Axial_Test
|
| 61 |
+
autoPET-III_MaskSize_Task01_Sagittal_Train
|
| 62 |
+
autoPET-III_MaskSize_Task01_Sagittal_Test
|
| 63 |
+
autoPET-III_MaskSize_Task01_Coronal_Train
|
| 64 |
+
autoPET-III_MaskSize_Task01_Coronal_Test
|
| 65 |
+
autoPET-III_MaskSize_Task01_Axial_Train
|
| 66 |
+
autoPET-III_MaskSize_Task01_Axial_Test
|
| 67 |
+
autoPET-III_MaskSize_Task02_Sagittal_Train
|
| 68 |
+
autoPET-III_MaskSize_Task02_Sagittal_Test
|
| 69 |
+
autoPET-III_MaskSize_Task02_Coronal_Train
|
| 70 |
+
autoPET-III_MaskSize_Task02_Coronal_Test
|
| 71 |
+
autoPET-III_MaskSize_Task02_Axial_Train
|
| 72 |
+
autoPET-III_MaskSize_Task02_Axial_Test
|
| 73 |
+
autoPET-III_BoxSize_Task01_Sagittal_Train
|
| 74 |
+
autoPET-III_BoxSize_Task01_Sagittal_Test
|
| 75 |
+
autoPET-III_BoxSize_Task01_Coronal_Train
|
| 76 |
+
autoPET-III_BoxSize_Task01_Coronal_Test
|
| 77 |
+
autoPET-III_BoxSize_Task01_Axial_Train
|
| 78 |
+
autoPET-III_BoxSize_Task01_Axial_Test
|
| 79 |
+
autoPET-III_BoxSize_Task02_Sagittal_Train
|
| 80 |
+
autoPET-III_BoxSize_Task02_Sagittal_Test
|
| 81 |
+
autoPET-III_BoxSize_Task02_Coronal_Train
|
| 82 |
+
autoPET-III_BoxSize_Task02_Coronal_Test
|
| 83 |
+
autoPET-III_BoxSize_Task02_Axial_Train
|
| 84 |
+
autoPET-III_BoxSize_Task02_Axial_Test
|
| 85 |
+
autoPET-III_TumorLesionSize_Task01_Sagittal_Train
|
| 86 |
+
autoPET-III_TumorLesionSize_Task01_Sagittal_Test
|
| 87 |
+
autoPET-III_TumorLesionSize_Task01_Coronal_Train
|
| 88 |
+
autoPET-III_TumorLesionSize_Task01_Coronal_Test
|
| 89 |
+
autoPET-III_TumorLesionSize_Task01_Axial_Train
|
| 90 |
+
autoPET-III_TumorLesionSize_Task01_Axial_Test
|
| 91 |
+
BCV15_MaskSize_Task01_Sagittal_Train
|
| 92 |
+
BCV15_MaskSize_Task01_Sagittal_Test
|
| 93 |
+
BCV15_MaskSize_Task01_Coronal_Train
|
| 94 |
+
BCV15_MaskSize_Task01_Coronal_Test
|
| 95 |
+
BCV15_MaskSize_Task01_Axial_Train
|
| 96 |
+
BCV15_MaskSize_Task01_Axial_Test
|
| 97 |
+
BCV15_MaskSize_Task02_Sagittal_Train
|
| 98 |
+
BCV15_MaskSize_Task02_Sagittal_Test
|
| 99 |
+
BCV15_MaskSize_Task02_Coronal_Train
|
| 100 |
+
BCV15_MaskSize_Task02_Coronal_Test
|
| 101 |
+
BCV15_MaskSize_Task02_Axial_Train
|
| 102 |
+
BCV15_MaskSize_Task02_Axial_Test
|
| 103 |
+
BCV15_BoxSize_Task01_Sagittal_Train
|
| 104 |
+
BCV15_BoxSize_Task01_Sagittal_Test
|
| 105 |
+
BCV15_BoxSize_Task01_Coronal_Train
|
| 106 |
+
BCV15_BoxSize_Task01_Coronal_Test
|
| 107 |
+
BCV15_BoxSize_Task01_Axial_Train
|
| 108 |
+
BCV15_BoxSize_Task01_Axial_Test
|
| 109 |
+
BCV15_BoxSize_Task02_Sagittal_Train
|
| 110 |
+
BCV15_BoxSize_Task02_Sagittal_Test
|
| 111 |
+
BCV15_BoxSize_Task02_Coronal_Train
|
| 112 |
+
BCV15_BoxSize_Task02_Coronal_Test
|
| 113 |
+
BCV15_BoxSize_Task02_Axial_Train
|
| 114 |
+
BCV15_BoxSize_Task02_Axial_Test
|
| 115 |
+
BraTS24_MaskSize_Task01_Sagittal_Train
|
| 116 |
+
BraTS24_MaskSize_Task01_Sagittal_Test
|
| 117 |
+
BraTS24_MaskSize_Task01_Coronal_Train
|
| 118 |
+
BraTS24_MaskSize_Task01_Coronal_Test
|
| 119 |
+
BraTS24_MaskSize_Task01_Axial_Train
|
| 120 |
+
BraTS24_MaskSize_Task01_Axial_Test
|
| 121 |
+
BraTS24_MaskSize_Task02_Sagittal_Train
|
| 122 |
+
BraTS24_MaskSize_Task02_Sagittal_Test
|
| 123 |
+
BraTS24_MaskSize_Task02_Coronal_Train
|
| 124 |
+
BraTS24_MaskSize_Task02_Coronal_Test
|
| 125 |
+
BraTS24_MaskSize_Task02_Axial_Train
|
| 126 |
+
BraTS24_MaskSize_Task02_Axial_Test
|
| 127 |
+
BraTS24_MaskSize_Task03_Sagittal_Train
|
| 128 |
+
BraTS24_MaskSize_Task03_Sagittal_Test
|
| 129 |
+
BraTS24_MaskSize_Task03_Coronal_Train
|
| 130 |
+
BraTS24_MaskSize_Task03_Coronal_Test
|
| 131 |
+
BraTS24_MaskSize_Task03_Axial_Train
|
| 132 |
+
BraTS24_MaskSize_Task03_Axial_Test
|
| 133 |
+
BraTS24_MaskSize_Task04_Sagittal_Train
|
| 134 |
+
BraTS24_MaskSize_Task04_Sagittal_Test
|
| 135 |
+
BraTS24_MaskSize_Task04_Coronal_Train
|
| 136 |
+
BraTS24_MaskSize_Task04_Coronal_Test
|
| 137 |
+
BraTS24_MaskSize_Task04_Axial_Train
|
| 138 |
+
BraTS24_MaskSize_Task04_Axial_Test
|
| 139 |
+
BraTS24_MaskSize_Task05_Sagittal_Train
|
| 140 |
+
BraTS24_MaskSize_Task05_Sagittal_Test
|
| 141 |
+
BraTS24_MaskSize_Task05_Coronal_Train
|
| 142 |
+
BraTS24_MaskSize_Task05_Coronal_Test
|
| 143 |
+
BraTS24_MaskSize_Task05_Axial_Train
|
| 144 |
+
BraTS24_MaskSize_Task05_Axial_Test
|
| 145 |
+
BraTS24_MaskSize_Task06_Sagittal_Train
|
| 146 |
+
BraTS24_MaskSize_Task06_Sagittal_Test
|
| 147 |
+
BraTS24_MaskSize_Task06_Coronal_Train
|
| 148 |
+
BraTS24_MaskSize_Task06_Coronal_Test
|
| 149 |
+
BraTS24_MaskSize_Task06_Axial_Train
|
| 150 |
+
BraTS24_MaskSize_Task06_Axial_Test
|
| 151 |
+
BraTS24_MaskSize_Task07_Sagittal_Train
|
| 152 |
+
BraTS24_MaskSize_Task07_Sagittal_Test
|
| 153 |
+
BraTS24_MaskSize_Task07_Coronal_Train
|
| 154 |
+
BraTS24_MaskSize_Task07_Coronal_Test
|
| 155 |
+
BraTS24_MaskSize_Task07_Axial_Train
|
| 156 |
+
BraTS24_MaskSize_Task07_Axial_Test
|
| 157 |
+
BraTS24_MaskSize_Task08_Sagittal_Train
|
| 158 |
+
BraTS24_MaskSize_Task08_Sagittal_Test
|
| 159 |
+
BraTS24_MaskSize_Task08_Coronal_Train
|
| 160 |
+
BraTS24_MaskSize_Task08_Coronal_Test
|
| 161 |
+
BraTS24_MaskSize_Task08_Axial_Train
|
| 162 |
+
BraTS24_MaskSize_Task08_Axial_Test
|
| 163 |
+
BraTS24_MaskSize_Task09_Sagittal_Train
|
| 164 |
+
BraTS24_MaskSize_Task09_Sagittal_Test
|
| 165 |
+
BraTS24_MaskSize_Task09_Coronal_Train
|
| 166 |
+
BraTS24_MaskSize_Task09_Coronal_Test
|
| 167 |
+
BraTS24_MaskSize_Task09_Axial_Train
|
| 168 |
+
BraTS24_MaskSize_Task09_Axial_Test
|
| 169 |
+
BraTS24_MaskSize_Task10_Sagittal_Train
|
| 170 |
+
BraTS24_MaskSize_Task10_Sagittal_Test
|
| 171 |
+
BraTS24_MaskSize_Task10_Coronal_Train
|
| 172 |
+
BraTS24_MaskSize_Task10_Coronal_Test
|
| 173 |
+
BraTS24_MaskSize_Task10_Axial_Train
|
| 174 |
+
BraTS24_MaskSize_Task10_Axial_Test
|
| 175 |
+
BraTS24_MaskSize_Task11_Sagittal_Train
|
| 176 |
+
BraTS24_MaskSize_Task11_Sagittal_Test
|
| 177 |
+
BraTS24_MaskSize_Task11_Coronal_Train
|
| 178 |
+
BraTS24_MaskSize_Task11_Coronal_Test
|
| 179 |
+
BraTS24_MaskSize_Task11_Axial_Train
|
| 180 |
+
BraTS24_MaskSize_Task11_Axial_Test
|
| 181 |
+
BraTS24_MaskSize_Task12_Sagittal_Train
|
| 182 |
+
BraTS24_MaskSize_Task12_Sagittal_Test
|
| 183 |
+
BraTS24_MaskSize_Task12_Coronal_Train
|
| 184 |
+
BraTS24_MaskSize_Task12_Coronal_Test
|
| 185 |
+
BraTS24_MaskSize_Task12_Axial_Train
|
| 186 |
+
BraTS24_MaskSize_Task12_Axial_Test
|
| 187 |
+
BraTS24_MaskSize_Task13_Sagittal_Train
|
| 188 |
+
BraTS24_MaskSize_Task13_Sagittal_Test
|
| 189 |
+
BraTS24_MaskSize_Task13_Coronal_Train
|
| 190 |
+
BraTS24_MaskSize_Task13_Coronal_Test
|
| 191 |
+
BraTS24_MaskSize_Task13_Axial_Train
|
| 192 |
+
BraTS24_MaskSize_Task13_Axial_Test
|
| 193 |
+
BraTS24_BoxSize_Task01_Sagittal_Train
|
| 194 |
+
BraTS24_BoxSize_Task01_Sagittal_Test
|
| 195 |
+
BraTS24_BoxSize_Task01_Coronal_Train
|
| 196 |
+
BraTS24_BoxSize_Task01_Coronal_Test
|
| 197 |
+
BraTS24_BoxSize_Task01_Axial_Train
|
| 198 |
+
BraTS24_BoxSize_Task01_Axial_Test
|
| 199 |
+
BraTS24_BoxSize_Task02_Sagittal_Train
|
| 200 |
+
BraTS24_BoxSize_Task02_Sagittal_Test
|
| 201 |
+
BraTS24_BoxSize_Task02_Coronal_Train
|
| 202 |
+
BraTS24_BoxSize_Task02_Coronal_Test
|
| 203 |
+
BraTS24_BoxSize_Task02_Axial_Train
|
| 204 |
+
BraTS24_BoxSize_Task02_Axial_Test
|
| 205 |
+
BraTS24_BoxSize_Task03_Sagittal_Train
|
| 206 |
+
BraTS24_BoxSize_Task03_Sagittal_Test
|
| 207 |
+
BraTS24_BoxSize_Task03_Coronal_Train
|
| 208 |
+
BraTS24_BoxSize_Task03_Coronal_Test
|
| 209 |
+
BraTS24_BoxSize_Task03_Axial_Train
|
| 210 |
+
BraTS24_BoxSize_Task03_Axial_Test
|
| 211 |
+
BraTS24_BoxSize_Task04_Sagittal_Train
|
| 212 |
+
BraTS24_BoxSize_Task04_Sagittal_Test
|
| 213 |
+
BraTS24_BoxSize_Task04_Coronal_Train
|
| 214 |
+
BraTS24_BoxSize_Task04_Coronal_Test
|
| 215 |
+
BraTS24_BoxSize_Task04_Axial_Train
|
| 216 |
+
BraTS24_BoxSize_Task04_Axial_Test
|
| 217 |
+
BraTS24_BoxSize_Task05_Sagittal_Train
|
| 218 |
+
BraTS24_BoxSize_Task05_Sagittal_Test
|
| 219 |
+
BraTS24_BoxSize_Task05_Coronal_Train
|
| 220 |
+
BraTS24_BoxSize_Task05_Coronal_Test
|
| 221 |
+
BraTS24_BoxSize_Task05_Axial_Train
|
| 222 |
+
BraTS24_BoxSize_Task05_Axial_Test
|
| 223 |
+
BraTS24_BoxSize_Task06_Sagittal_Train
|
| 224 |
+
BraTS24_BoxSize_Task06_Sagittal_Test
|
| 225 |
+
BraTS24_BoxSize_Task06_Coronal_Train
|
| 226 |
+
BraTS24_BoxSize_Task06_Coronal_Test
|
| 227 |
+
BraTS24_BoxSize_Task06_Axial_Train
|
| 228 |
+
BraTS24_BoxSize_Task06_Axial_Test
|
| 229 |
+
BraTS24_BoxSize_Task07_Sagittal_Train
|
| 230 |
+
BraTS24_BoxSize_Task07_Sagittal_Test
|
| 231 |
+
BraTS24_BoxSize_Task07_Coronal_Train
|
| 232 |
+
BraTS24_BoxSize_Task07_Coronal_Test
|
| 233 |
+
BraTS24_BoxSize_Task07_Axial_Train
|
| 234 |
+
BraTS24_BoxSize_Task07_Axial_Test
|
| 235 |
+
BraTS24_BoxSize_Task08_Sagittal_Train
|
| 236 |
+
BraTS24_BoxSize_Task08_Sagittal_Test
|
| 237 |
+
BraTS24_BoxSize_Task08_Coronal_Train
|
| 238 |
+
BraTS24_BoxSize_Task08_Coronal_Test
|
| 239 |
+
BraTS24_BoxSize_Task08_Axial_Train
|
| 240 |
+
BraTS24_BoxSize_Task08_Axial_Test
|
| 241 |
+
BraTS24_BoxSize_Task09_Sagittal_Train
|
| 242 |
+
BraTS24_BoxSize_Task09_Sagittal_Test
|
| 243 |
+
BraTS24_BoxSize_Task09_Coronal_Train
|
| 244 |
+
BraTS24_BoxSize_Task09_Coronal_Test
|
| 245 |
+
BraTS24_BoxSize_Task09_Axial_Train
|
| 246 |
+
BraTS24_BoxSize_Task09_Axial_Test
|
| 247 |
+
BraTS24_BoxSize_Task10_Sagittal_Train
|
| 248 |
+
BraTS24_BoxSize_Task10_Sagittal_Test
|
| 249 |
+
BraTS24_BoxSize_Task10_Coronal_Train
|
| 250 |
+
BraTS24_BoxSize_Task10_Coronal_Test
|
| 251 |
+
BraTS24_BoxSize_Task10_Axial_Train
|
| 252 |
+
BraTS24_BoxSize_Task10_Axial_Test
|
| 253 |
+
BraTS24_BoxSize_Task11_Sagittal_Train
|
| 254 |
+
BraTS24_BoxSize_Task11_Sagittal_Test
|
| 255 |
+
BraTS24_BoxSize_Task11_Coronal_Train
|
| 256 |
+
BraTS24_BoxSize_Task11_Coronal_Test
|
| 257 |
+
BraTS24_BoxSize_Task11_Axial_Train
|
| 258 |
+
BraTS24_BoxSize_Task11_Axial_Test
|
| 259 |
+
BraTS24_BoxSize_Task12_Sagittal_Train
|
| 260 |
+
BraTS24_BoxSize_Task12_Sagittal_Test
|
| 261 |
+
BraTS24_BoxSize_Task12_Coronal_Train
|
| 262 |
+
BraTS24_BoxSize_Task12_Coronal_Test
|
| 263 |
+
BraTS24_BoxSize_Task12_Axial_Train
|
| 264 |
+
BraTS24_BoxSize_Task12_Axial_Test
|
| 265 |
+
BraTS24_BoxSize_Task13_Sagittal_Train
|
| 266 |
+
BraTS24_BoxSize_Task13_Sagittal_Test
|
| 267 |
+
BraTS24_BoxSize_Task13_Coronal_Train
|
| 268 |
+
BraTS24_BoxSize_Task13_Coronal_Test
|
| 269 |
+
BraTS24_BoxSize_Task13_Axial_Train
|
| 270 |
+
BraTS24_BoxSize_Task13_Axial_Test
|
| 271 |
+
BraTS24_TumorLesionSize_Task01_Sagittal_Train
|
| 272 |
+
BraTS24_TumorLesionSize_Task01_Sagittal_Test
|
| 273 |
+
BraTS24_TumorLesionSize_Task01_Coronal_Train
|
| 274 |
+
BraTS24_TumorLesionSize_Task01_Coronal_Test
|
| 275 |
+
BraTS24_TumorLesionSize_Task01_Axial_Train
|
| 276 |
+
BraTS24_TumorLesionSize_Task01_Axial_Test
|
| 277 |
+
BraTS24_TumorLesionSize_Task02_Sagittal_Train
|
| 278 |
+
BraTS24_TumorLesionSize_Task02_Sagittal_Test
|
| 279 |
+
BraTS24_TumorLesionSize_Task02_Coronal_Train
|
| 280 |
+
BraTS24_TumorLesionSize_Task02_Coronal_Test
|
| 281 |
+
BraTS24_TumorLesionSize_Task02_Axial_Train
|
| 282 |
+
BraTS24_TumorLesionSize_Task02_Axial_Test
|
| 283 |
+
BraTS24_TumorLesionSize_Task03_Sagittal_Train
|
| 284 |
+
BraTS24_TumorLesionSize_Task03_Sagittal_Test
|
| 285 |
+
BraTS24_TumorLesionSize_Task03_Coronal_Train
|
| 286 |
+
BraTS24_TumorLesionSize_Task03_Coronal_Test
|
| 287 |
+
BraTS24_TumorLesionSize_Task03_Axial_Train
|
| 288 |
+
BraTS24_TumorLesionSize_Task03_Axial_Test
|
| 289 |
+
BraTS24_TumorLesionSize_Task04_Sagittal_Train
|
| 290 |
+
BraTS24_TumorLesionSize_Task04_Sagittal_Test
|
| 291 |
+
BraTS24_TumorLesionSize_Task04_Coronal_Train
|
| 292 |
+
BraTS24_TumorLesionSize_Task04_Coronal_Test
|
| 293 |
+
BraTS24_TumorLesionSize_Task04_Axial_Train
|
| 294 |
+
BraTS24_TumorLesionSize_Task04_Axial_Test
|
| 295 |
+
BraTS24_TumorLesionSize_Task05_Sagittal_Train
|
| 296 |
+
BraTS24_TumorLesionSize_Task05_Sagittal_Test
|
| 297 |
+
BraTS24_TumorLesionSize_Task05_Coronal_Train
|
| 298 |
+
BraTS24_TumorLesionSize_Task05_Coronal_Test
|
| 299 |
+
BraTS24_TumorLesionSize_Task05_Axial_Train
|
| 300 |
+
BraTS24_TumorLesionSize_Task05_Axial_Test
|
| 301 |
+
BraTS24_TumorLesionSize_Task06_Sagittal_Train
|
| 302 |
+
BraTS24_TumorLesionSize_Task06_Sagittal_Test
|
| 303 |
+
BraTS24_TumorLesionSize_Task06_Coronal_Train
|
| 304 |
+
BraTS24_TumorLesionSize_Task06_Coronal_Test
|
| 305 |
+
BraTS24_TumorLesionSize_Task06_Axial_Train
|
| 306 |
+
BraTS24_TumorLesionSize_Task06_Axial_Test
|
| 307 |
+
BraTS24_TumorLesionSize_Task07_Sagittal_Train
|
| 308 |
+
BraTS24_TumorLesionSize_Task07_Sagittal_Test
|
| 309 |
+
BraTS24_TumorLesionSize_Task07_Coronal_Train
|
| 310 |
+
BraTS24_TumorLesionSize_Task07_Coronal_Test
|
| 311 |
+
BraTS24_TumorLesionSize_Task07_Axial_Train
|
| 312 |
+
BraTS24_TumorLesionSize_Task07_Axial_Test
|
| 313 |
+
BraTS24_TumorLesionSize_Task08_Sagittal_Train
|
| 314 |
+
BraTS24_TumorLesionSize_Task08_Sagittal_Test
|
| 315 |
+
BraTS24_TumorLesionSize_Task08_Coronal_Train
|
| 316 |
+
BraTS24_TumorLesionSize_Task08_Coronal_Test
|
| 317 |
+
BraTS24_TumorLesionSize_Task08_Axial_Train
|
| 318 |
+
BraTS24_TumorLesionSize_Task08_Axial_Test
|
| 319 |
+
BraTS24_TumorLesionSize_Task09_Sagittal_Train
|
| 320 |
+
BraTS24_TumorLesionSize_Task09_Sagittal_Test
|
| 321 |
+
BraTS24_TumorLesionSize_Task09_Coronal_Train
|
| 322 |
+
BraTS24_TumorLesionSize_Task09_Coronal_Test
|
| 323 |
+
BraTS24_TumorLesionSize_Task09_Axial_Train
|
| 324 |
+
BraTS24_TumorLesionSize_Task09_Axial_Test
|
| 325 |
+
BraTS24_TumorLesionSize_Task10_Sagittal_Train
|
| 326 |
+
BraTS24_TumorLesionSize_Task10_Sagittal_Test
|
| 327 |
+
BraTS24_TumorLesionSize_Task10_Coronal_Train
|
| 328 |
+
BraTS24_TumorLesionSize_Task10_Coronal_Test
|
| 329 |
+
BraTS24_TumorLesionSize_Task10_Axial_Train
|
| 330 |
+
BraTS24_TumorLesionSize_Task10_Axial_Test
|
| 331 |
+
BraTS24_TumorLesionSize_Task11_Sagittal_Train
|
| 332 |
+
BraTS24_TumorLesionSize_Task11_Sagittal_Test
|
| 333 |
+
BraTS24_TumorLesionSize_Task11_Coronal_Train
|
| 334 |
+
BraTS24_TumorLesionSize_Task11_Coronal_Test
|
| 335 |
+
BraTS24_TumorLesionSize_Task11_Axial_Train
|
| 336 |
+
BraTS24_TumorLesionSize_Task11_Axial_Test
|
| 337 |
+
BraTS24_TumorLesionSize_Task12_Sagittal_Train
|
| 338 |
+
BraTS24_TumorLesionSize_Task12_Sagittal_Test
|
| 339 |
+
BraTS24_TumorLesionSize_Task12_Coronal_Train
|
| 340 |
+
BraTS24_TumorLesionSize_Task12_Coronal_Test
|
| 341 |
+
BraTS24_TumorLesionSize_Task12_Axial_Train
|
| 342 |
+
BraTS24_TumorLesionSize_Task12_Axial_Test
|
| 343 |
+
CAMUS_MaskSize_Task01_Sagittal_Train
|
| 344 |
+
CAMUS_MaskSize_Task01_Sagittal_Test
|
| 345 |
+
CAMUS_MaskSize_Task01_Coronal_Train
|
| 346 |
+
CAMUS_MaskSize_Task01_Coronal_Test
|
| 347 |
+
CAMUS_MaskSize_Task01_Axial_Train
|
| 348 |
+
CAMUS_MaskSize_Task01_Axial_Test
|
| 349 |
+
CAMUS_BoxSize_Task01_Sagittal_Train
|
| 350 |
+
CAMUS_BoxSize_Task01_Sagittal_Test
|
| 351 |
+
CAMUS_BoxSize_Task01_Coronal_Train
|
| 352 |
+
CAMUS_BoxSize_Task01_Coronal_Test
|
| 353 |
+
CAMUS_BoxSize_Task01_Axial_Train
|
| 354 |
+
CAMUS_BoxSize_Task01_Axial_Test
|
| 355 |
+
Ceph-Biometrics-400_BiometricsFromLandmarks_Distance_Task01_Sagittal_Train
|
| 356 |
+
Ceph-Biometrics-400_BiometricsFromLandmarks_Distance_Task01_Sagittal_Test
|
| 357 |
+
Ceph-Biometrics-400_BiometricsFromLandmarks_Angle_Task01_Sagittal_Train
|
| 358 |
+
Ceph-Biometrics-400_BiometricsFromLandmarks_Angle_Task01_Sagittal_Test
|
| 359 |
+
CrossMoDA_MaskSize_Task01_Sagittal_Train
|
| 360 |
+
CrossMoDA_MaskSize_Task01_Sagittal_Test
|
| 361 |
+
CrossMoDA_MaskSize_Task01_Coronal_Train
|
| 362 |
+
CrossMoDA_MaskSize_Task01_Coronal_Test
|
| 363 |
+
CrossMoDA_MaskSize_Task01_Axial_Train
|
| 364 |
+
CrossMoDA_MaskSize_Task01_Axial_Test
|
| 365 |
+
CrossMoDA_BoxSize_Task01_Sagittal_Train
|
| 366 |
+
CrossMoDA_BoxSize_Task01_Sagittal_Test
|
| 367 |
+
CrossMoDA_BoxSize_Task01_Coronal_Train
|
| 368 |
+
CrossMoDA_BoxSize_Task01_Coronal_Test
|
| 369 |
+
CrossMoDA_BoxSize_Task01_Axial_Train
|
| 370 |
+
CrossMoDA_BoxSize_Task01_Axial_Test
|
| 371 |
+
FeTA24_MaskSize_Task01_Sagittal_Train
|
| 372 |
+
FeTA24_MaskSize_Task01_Sagittal_Test
|
| 373 |
+
FeTA24_MaskSize_Task01_Coronal_Train
|
| 374 |
+
FeTA24_MaskSize_Task01_Coronal_Test
|
| 375 |
+
FeTA24_MaskSize_Task01_Axial_Train
|
| 376 |
+
FeTA24_MaskSize_Task01_Axial_Test
|
| 377 |
+
FeTA24_BoxSize_Task01_Sagittal_Train
|
| 378 |
+
FeTA24_BoxSize_Task01_Sagittal_Test
|
| 379 |
+
FeTA24_BoxSize_Task01_Coronal_Train
|
| 380 |
+
FeTA24_BoxSize_Task01_Coronal_Test
|
| 381 |
+
FeTA24_BoxSize_Task01_Axial_Train
|
| 382 |
+
FeTA24_BoxSize_Task01_Axial_Test
|
| 383 |
+
FeTA24_BiometricsFromLandmarks_Task01_Sagittal_Train
|
| 384 |
+
FeTA24_BiometricsFromLandmarks_Task01_Sagittal_Test
|
| 385 |
+
FeTA24_BiometricsFromLandmarks_Task01_Coronal_Train
|
| 386 |
+
FeTA24_BiometricsFromLandmarks_Task01_Coronal_Test
|
| 387 |
+
FeTA24_BiometricsFromLandmarks_Task01_Axial_Train
|
| 388 |
+
FeTA24_BiometricsFromLandmarks_Task01_Axial_Test
|
| 389 |
+
FLARE22_MaskSize_Task01_Sagittal_Train
|
| 390 |
+
FLARE22_MaskSize_Task01_Sagittal_Test
|
| 391 |
+
FLARE22_MaskSize_Task01_Coronal_Train
|
| 392 |
+
FLARE22_MaskSize_Task01_Coronal_Test
|
| 393 |
+
FLARE22_MaskSize_Task01_Axial_Train
|
| 394 |
+
FLARE22_MaskSize_Task01_Axial_Test
|
| 395 |
+
FLARE22_BoxSize_Task01_Sagittal_Train
|
| 396 |
+
FLARE22_BoxSize_Task01_Sagittal_Test
|
| 397 |
+
FLARE22_BoxSize_Task01_Coronal_Train
|
| 398 |
+
FLARE22_BoxSize_Task01_Coronal_Test
|
| 399 |
+
FLARE22_BoxSize_Task01_Axial_Train
|
| 400 |
+
FLARE22_BoxSize_Task01_Axial_Test
|
| 401 |
+
HNTSMRG24_MaskSize_Task01_Sagittal_Train
|
| 402 |
+
HNTSMRG24_MaskSize_Task01_Sagittal_Test
|
| 403 |
+
HNTSMRG24_MaskSize_Task01_Coronal_Train
|
| 404 |
+
HNTSMRG24_MaskSize_Task01_Coronal_Test
|
| 405 |
+
HNTSMRG24_MaskSize_Task01_Axial_Train
|
| 406 |
+
HNTSMRG24_MaskSize_Task01_Axial_Test
|
| 407 |
+
HNTSMRG24_MaskSize_Task02_Sagittal_Train
|
| 408 |
+
HNTSMRG24_MaskSize_Task02_Sagittal_Test
|
| 409 |
+
HNTSMRG24_MaskSize_Task02_Coronal_Train
|
| 410 |
+
HNTSMRG24_MaskSize_Task02_Coronal_Test
|
| 411 |
+
HNTSMRG24_MaskSize_Task02_Axial_Train
|
| 412 |
+
HNTSMRG24_MaskSize_Task02_Axial_Test
|
| 413 |
+
HNTSMRG24_BoxSize_Task01_Sagittal_Train
|
| 414 |
+
HNTSMRG24_BoxSize_Task01_Sagittal_Test
|
| 415 |
+
HNTSMRG24_BoxSize_Task01_Coronal_Train
|
| 416 |
+
HNTSMRG24_BoxSize_Task01_Coronal_Test
|
| 417 |
+
HNTSMRG24_BoxSize_Task01_Axial_Train
|
| 418 |
+
HNTSMRG24_BoxSize_Task01_Axial_Test
|
| 419 |
+
HNTSMRG24_BoxSize_Task02_Sagittal_Train
|
| 420 |
+
HNTSMRG24_BoxSize_Task02_Sagittal_Test
|
| 421 |
+
HNTSMRG24_BoxSize_Task02_Coronal_Train
|
| 422 |
+
HNTSMRG24_BoxSize_Task02_Coronal_Test
|
| 423 |
+
HNTSMRG24_BoxSize_Task02_Axial_Train
|
| 424 |
+
HNTSMRG24_BoxSize_Task02_Axial_Test
|
| 425 |
+
HNTSMRG24_TumorLesionSize_Task01_Sagittal_Train
|
| 426 |
+
HNTSMRG24_TumorLesionSize_Task01_Sagittal_Test
|
| 427 |
+
HNTSMRG24_TumorLesionSize_Task01_Coronal_Train
|
| 428 |
+
HNTSMRG24_TumorLesionSize_Task01_Coronal_Test
|
| 429 |
+
HNTSMRG24_TumorLesionSize_Task01_Axial_Train
|
| 430 |
+
HNTSMRG24_TumorLesionSize_Task01_Axial_Test
|
| 431 |
+
HNTSMRG24_TumorLesionSize_Task02_Sagittal_Train
|
| 432 |
+
HNTSMRG24_TumorLesionSize_Task02_Sagittal_Test
|
| 433 |
+
HNTSMRG24_TumorLesionSize_Task02_Coronal_Train
|
| 434 |
+
HNTSMRG24_TumorLesionSize_Task02_Coronal_Test
|
| 435 |
+
HNTSMRG24_TumorLesionSize_Task02_Axial_Train
|
| 436 |
+
HNTSMRG24_TumorLesionSize_Task02_Axial_Test
|
| 437 |
+
HNTSMRG24_TumorLesionSize_Task03_Sagittal_Train
|
| 438 |
+
HNTSMRG24_TumorLesionSize_Task03_Sagittal_Test
|
| 439 |
+
HNTSMRG24_TumorLesionSize_Task03_Coronal_Train
|
| 440 |
+
HNTSMRG24_TumorLesionSize_Task03_Coronal_Test
|
| 441 |
+
HNTSMRG24_TumorLesionSize_Task03_Axial_Train
|
| 442 |
+
HNTSMRG24_TumorLesionSize_Task03_Axial_Test
|
| 443 |
+
HNTSMRG24_TumorLesionSize_Task04_Sagittal_Train
|
| 444 |
+
HNTSMRG24_TumorLesionSize_Task04_Sagittal_Test
|
| 445 |
+
HNTSMRG24_TumorLesionSize_Task04_Coronal_Train
|
| 446 |
+
HNTSMRG24_TumorLesionSize_Task04_Coronal_Test
|
| 447 |
+
HNTSMRG24_TumorLesionSize_Task04_Axial_Train
|
| 448 |
+
HNTSMRG24_TumorLesionSize_Task04_Axial_Test
|
| 449 |
+
ISLES24_MaskSize_Task01_Sagittal_Train
|
| 450 |
+
ISLES24_MaskSize_Task01_Sagittal_Test
|
| 451 |
+
ISLES24_MaskSize_Task01_Coronal_Train
|
| 452 |
+
ISLES24_MaskSize_Task01_Coronal_Test
|
| 453 |
+
ISLES24_MaskSize_Task01_Axial_Train
|
| 454 |
+
ISLES24_MaskSize_Task01_Axial_Test
|
| 455 |
+
ISLES24_MaskSize_Task02_Sagittal_Train
|
| 456 |
+
ISLES24_MaskSize_Task02_Sagittal_Test
|
| 457 |
+
ISLES24_MaskSize_Task02_Coronal_Train
|
| 458 |
+
ISLES24_MaskSize_Task02_Coronal_Test
|
| 459 |
+
ISLES24_MaskSize_Task02_Axial_Train
|
| 460 |
+
ISLES24_MaskSize_Task02_Axial_Test
|
| 461 |
+
ISLES24_BoxSize_Task01_Sagittal_Train
|
| 462 |
+
ISLES24_BoxSize_Task01_Sagittal_Test
|
| 463 |
+
ISLES24_BoxSize_Task01_Coronal_Train
|
| 464 |
+
ISLES24_BoxSize_Task01_Coronal_Test
|
| 465 |
+
ISLES24_BoxSize_Task01_Axial_Train
|
| 466 |
+
ISLES24_BoxSize_Task01_Axial_Test
|
| 467 |
+
ISLES24_BoxSize_Task02_Sagittal_Train
|
| 468 |
+
ISLES24_BoxSize_Task02_Sagittal_Test
|
| 469 |
+
ISLES24_BoxSize_Task02_Coronal_Train
|
| 470 |
+
ISLES24_BoxSize_Task02_Coronal_Test
|
| 471 |
+
ISLES24_BoxSize_Task02_Axial_Train
|
| 472 |
+
ISLES24_BoxSize_Task02_Axial_Test
|
| 473 |
+
KiPA22_MaskSize_Task01_Sagittal_Train
|
| 474 |
+
KiPA22_MaskSize_Task01_Sagittal_Test
|
| 475 |
+
KiPA22_MaskSize_Task01_Coronal_Train
|
| 476 |
+
KiPA22_MaskSize_Task01_Coronal_Test
|
| 477 |
+
KiPA22_MaskSize_Task01_Axial_Train
|
| 478 |
+
KiPA22_MaskSize_Task01_Axial_Test
|
| 479 |
+
KiPA22_BoxSize_Task01_Sagittal_Train
|
| 480 |
+
KiPA22_BoxSize_Task01_Sagittal_Test
|
| 481 |
+
KiPA22_BoxSize_Task01_Coronal_Train
|
| 482 |
+
KiPA22_BoxSize_Task01_Coronal_Test
|
| 483 |
+
KiPA22_BoxSize_Task01_Axial_Train
|
| 484 |
+
KiPA22_BoxSize_Task01_Axial_Test
|
| 485 |
+
KiPA22_TumorLesionSize_Task01_Sagittal_Train
|
| 486 |
+
KiPA22_TumorLesionSize_Task01_Sagittal_Test
|
| 487 |
+
KiPA22_TumorLesionSize_Task01_Coronal_Train
|
| 488 |
+
KiPA22_TumorLesionSize_Task01_Coronal_Test
|
| 489 |
+
KiPA22_TumorLesionSize_Task01_Axial_Train
|
| 490 |
+
KiPA22_TumorLesionSize_Task01_Axial_Test
|
| 491 |
+
KiTS23_MaskSize_Task01_Sagittal_Train
|
| 492 |
+
KiTS23_MaskSize_Task01_Sagittal_Test
|
| 493 |
+
KiTS23_MaskSize_Task01_Coronal_Train
|
| 494 |
+
KiTS23_MaskSize_Task01_Coronal_Test
|
| 495 |
+
KiTS23_MaskSize_Task01_Axial_Train
|
| 496 |
+
KiTS23_MaskSize_Task01_Axial_Test
|
| 497 |
+
KiTS23_BoxSize_Task01_Sagittal_Train
|
| 498 |
+
KiTS23_BoxSize_Task01_Sagittal_Test
|
| 499 |
+
KiTS23_BoxSize_Task01_Coronal_Train
|
| 500 |
+
KiTS23_BoxSize_Task01_Coronal_Test
|
| 501 |
+
KiTS23_BoxSize_Task01_Axial_Train
|
| 502 |
+
KiTS23_BoxSize_Task01_Axial_Test
|
| 503 |
+
KiTS23_TumorLesionSize_Task01_Sagittal_Train
|
| 504 |
+
KiTS23_TumorLesionSize_Task01_Sagittal_Test
|
| 505 |
+
KiTS23_TumorLesionSize_Task01_Coronal_Train
|
| 506 |
+
KiTS23_TumorLesionSize_Task01_Coronal_Test
|
| 507 |
+
KiTS23_TumorLesionSize_Task01_Axial_Train
|
| 508 |
+
KiTS23_TumorLesionSize_Task01_Axial_Test
|
| 509 |
+
MSD_MaskSize_Task01_Sagittal_Train
|
| 510 |
+
MSD_MaskSize_Task01_Sagittal_Test
|
| 511 |
+
MSD_MaskSize_Task01_Coronal_Train
|
| 512 |
+
MSD_MaskSize_Task01_Coronal_Test
|
| 513 |
+
MSD_MaskSize_Task01_Axial_Train
|
| 514 |
+
MSD_MaskSize_Task01_Axial_Test
|
| 515 |
+
MSD_MaskSize_Task02_Sagittal_Train
|
| 516 |
+
MSD_MaskSize_Task02_Sagittal_Test
|
| 517 |
+
MSD_MaskSize_Task02_Coronal_Train
|
| 518 |
+
MSD_MaskSize_Task02_Coronal_Test
|
| 519 |
+
MSD_MaskSize_Task02_Axial_Train
|
| 520 |
+
MSD_MaskSize_Task02_Axial_Test
|
| 521 |
+
MSD_MaskSize_Task03_Sagittal_Train
|
| 522 |
+
MSD_MaskSize_Task03_Sagittal_Test
|
| 523 |
+
MSD_MaskSize_Task03_Coronal_Train
|
| 524 |
+
MSD_MaskSize_Task03_Coronal_Test
|
| 525 |
+
MSD_MaskSize_Task03_Axial_Train
|
| 526 |
+
MSD_MaskSize_Task03_Axial_Test
|
| 527 |
+
MSD_MaskSize_Task04_Sagittal_Train
|
| 528 |
+
MSD_MaskSize_Task04_Sagittal_Test
|
| 529 |
+
MSD_MaskSize_Task04_Coronal_Train
|
| 530 |
+
MSD_MaskSize_Task04_Coronal_Test
|
| 531 |
+
MSD_MaskSize_Task04_Axial_Train
|
| 532 |
+
MSD_MaskSize_Task04_Axial_Test
|
| 533 |
+
MSD_MaskSize_Task05_Sagittal_Train
|
| 534 |
+
MSD_MaskSize_Task05_Sagittal_Test
|
| 535 |
+
MSD_MaskSize_Task05_Coronal_Train
|
| 536 |
+
MSD_MaskSize_Task05_Coronal_Test
|
| 537 |
+
MSD_MaskSize_Task05_Axial_Train
|
| 538 |
+
MSD_MaskSize_Task05_Axial_Test
|
| 539 |
+
MSD_MaskSize_Task06_Sagittal_Train
|
| 540 |
+
MSD_MaskSize_Task06_Sagittal_Test
|
| 541 |
+
MSD_MaskSize_Task06_Coronal_Train
|
| 542 |
+
MSD_MaskSize_Task06_Coronal_Test
|
| 543 |
+
MSD_MaskSize_Task06_Axial_Train
|
| 544 |
+
MSD_MaskSize_Task06_Axial_Test
|
| 545 |
+
MSD_MaskSize_Task07_Sagittal_Train
|
| 546 |
+
MSD_MaskSize_Task07_Sagittal_Test
|
| 547 |
+
MSD_MaskSize_Task07_Coronal_Train
|
| 548 |
+
MSD_MaskSize_Task07_Coronal_Test
|
| 549 |
+
MSD_MaskSize_Task07_Axial_Train
|
| 550 |
+
MSD_MaskSize_Task07_Axial_Test
|
| 551 |
+
MSD_MaskSize_Task08_Sagittal_Train
|
| 552 |
+
MSD_MaskSize_Task08_Sagittal_Test
|
| 553 |
+
MSD_MaskSize_Task08_Coronal_Train
|
| 554 |
+
MSD_MaskSize_Task08_Coronal_Test
|
| 555 |
+
MSD_MaskSize_Task08_Axial_Train
|
| 556 |
+
MSD_MaskSize_Task08_Axial_Test
|
| 557 |
+
MSD_MaskSize_Task09_Sagittal_Train
|
| 558 |
+
MSD_MaskSize_Task09_Sagittal_Test
|
| 559 |
+
MSD_MaskSize_Task09_Coronal_Train
|
| 560 |
+
MSD_MaskSize_Task09_Coronal_Test
|
| 561 |
+
MSD_MaskSize_Task09_Axial_Train
|
| 562 |
+
MSD_MaskSize_Task09_Axial_Test
|
| 563 |
+
MSD_MaskSize_Task10_Sagittal_Train
|
| 564 |
+
MSD_MaskSize_Task10_Sagittal_Test
|
| 565 |
+
MSD_MaskSize_Task10_Coronal_Train
|
| 566 |
+
MSD_MaskSize_Task10_Coronal_Test
|
| 567 |
+
MSD_MaskSize_Task10_Axial_Train
|
| 568 |
+
MSD_MaskSize_Task10_Axial_Test
|
| 569 |
+
MSD_MaskSize_Task11_Sagittal_Train
|
| 570 |
+
MSD_MaskSize_Task11_Sagittal_Test
|
| 571 |
+
MSD_MaskSize_Task11_Coronal_Train
|
| 572 |
+
MSD_MaskSize_Task11_Coronal_Test
|
| 573 |
+
MSD_MaskSize_Task11_Axial_Train
|
| 574 |
+
MSD_MaskSize_Task11_Axial_Test
|
| 575 |
+
MSD_MaskSize_Task12_Sagittal_Train
|
| 576 |
+
MSD_MaskSize_Task12_Sagittal_Test
|
| 577 |
+
MSD_MaskSize_Task12_Coronal_Train
|
| 578 |
+
MSD_MaskSize_Task12_Coronal_Test
|
| 579 |
+
MSD_MaskSize_Task12_Axial_Train
|
| 580 |
+
MSD_MaskSize_Task12_Axial_Test
|
| 581 |
+
MSD_MaskSize_Task13_Sagittal_Train
|
| 582 |
+
MSD_MaskSize_Task13_Sagittal_Test
|
| 583 |
+
MSD_MaskSize_Task13_Coronal_Train
|
| 584 |
+
MSD_MaskSize_Task13_Coronal_Test
|
| 585 |
+
MSD_MaskSize_Task13_Axial_Train
|
| 586 |
+
MSD_MaskSize_Task13_Axial_Test
|
| 587 |
+
MSD_MaskSize_Task14_Sagittal_Train
|
| 588 |
+
MSD_MaskSize_Task14_Sagittal_Test
|
| 589 |
+
MSD_MaskSize_Task14_Coronal_Train
|
| 590 |
+
MSD_MaskSize_Task14_Coronal_Test
|
| 591 |
+
MSD_MaskSize_Task14_Axial_Train
|
| 592 |
+
MSD_MaskSize_Task14_Axial_Test
|
| 593 |
+
MSD_BoxSize_Task01_Sagittal_Train
|
| 594 |
+
MSD_BoxSize_Task01_Sagittal_Test
|
| 595 |
+
MSD_BoxSize_Task01_Coronal_Train
|
| 596 |
+
MSD_BoxSize_Task01_Coronal_Test
|
| 597 |
+
MSD_BoxSize_Task01_Axial_Train
|
| 598 |
+
MSD_BoxSize_Task01_Axial_Test
|
| 599 |
+
MSD_BoxSize_Task02_Sagittal_Train
|
| 600 |
+
MSD_BoxSize_Task02_Sagittal_Test
|
| 601 |
+
MSD_BoxSize_Task02_Coronal_Train
|
| 602 |
+
MSD_BoxSize_Task02_Coronal_Test
|
| 603 |
+
MSD_BoxSize_Task02_Axial_Train
|
| 604 |
+
MSD_BoxSize_Task02_Axial_Test
|
| 605 |
+
MSD_BoxSize_Task03_Sagittal_Train
|
| 606 |
+
MSD_BoxSize_Task03_Sagittal_Test
|
| 607 |
+
MSD_BoxSize_Task03_Coronal_Train
|
| 608 |
+
MSD_BoxSize_Task03_Coronal_Test
|
| 609 |
+
MSD_BoxSize_Task03_Axial_Train
|
| 610 |
+
MSD_BoxSize_Task03_Axial_Test
|
| 611 |
+
MSD_BoxSize_Task04_Sagittal_Train
|
| 612 |
+
MSD_BoxSize_Task04_Sagittal_Test
|
| 613 |
+
MSD_BoxSize_Task04_Coronal_Train
|
| 614 |
+
MSD_BoxSize_Task04_Coronal_Test
|
| 615 |
+
MSD_BoxSize_Task04_Axial_Train
|
| 616 |
+
MSD_BoxSize_Task04_Axial_Test
|
| 617 |
+
MSD_BoxSize_Task05_Sagittal_Train
|
| 618 |
+
MSD_BoxSize_Task05_Sagittal_Test
|
| 619 |
+
MSD_BoxSize_Task05_Coronal_Train
|
| 620 |
+
MSD_BoxSize_Task05_Coronal_Test
|
| 621 |
+
MSD_BoxSize_Task05_Axial_Train
|
| 622 |
+
MSD_BoxSize_Task05_Axial_Test
|
| 623 |
+
MSD_BoxSize_Task06_Sagittal_Train
|
| 624 |
+
MSD_BoxSize_Task06_Sagittal_Test
|
| 625 |
+
MSD_BoxSize_Task06_Coronal_Train
|
| 626 |
+
MSD_BoxSize_Task06_Coronal_Test
|
| 627 |
+
MSD_BoxSize_Task06_Axial_Train
|
| 628 |
+
MSD_BoxSize_Task06_Axial_Test
|
| 629 |
+
MSD_BoxSize_Task07_Sagittal_Train
|
| 630 |
+
MSD_BoxSize_Task07_Sagittal_Test
|
| 631 |
+
MSD_BoxSize_Task07_Coronal_Train
|
| 632 |
+
MSD_BoxSize_Task07_Coronal_Test
|
| 633 |
+
MSD_BoxSize_Task07_Axial_Train
|
| 634 |
+
MSD_BoxSize_Task07_Axial_Test
|
| 635 |
+
MSD_BoxSize_Task08_Sagittal_Train
|
| 636 |
+
MSD_BoxSize_Task08_Sagittal_Test
|
| 637 |
+
MSD_BoxSize_Task08_Coronal_Train
|
| 638 |
+
MSD_BoxSize_Task08_Coronal_Test
|
| 639 |
+
MSD_BoxSize_Task08_Axial_Train
|
| 640 |
+
MSD_BoxSize_Task08_Axial_Test
|
| 641 |
+
MSD_BoxSize_Task09_Sagittal_Train
|
| 642 |
+
MSD_BoxSize_Task09_Sagittal_Test
|
| 643 |
+
MSD_BoxSize_Task09_Coronal_Train
|
| 644 |
+
MSD_BoxSize_Task09_Coronal_Test
|
| 645 |
+
MSD_BoxSize_Task09_Axial_Train
|
| 646 |
+
MSD_BoxSize_Task09_Axial_Test
|
| 647 |
+
MSD_BoxSize_Task10_Sagittal_Train
|
| 648 |
+
MSD_BoxSize_Task10_Sagittal_Test
|
| 649 |
+
MSD_BoxSize_Task10_Coronal_Train
|
| 650 |
+
MSD_BoxSize_Task10_Coronal_Test
|
| 651 |
+
MSD_BoxSize_Task10_Axial_Train
|
| 652 |
+
MSD_BoxSize_Task10_Axial_Test
|
| 653 |
+
MSD_BoxSize_Task11_Sagittal_Train
|
| 654 |
+
MSD_BoxSize_Task11_Sagittal_Test
|
| 655 |
+
MSD_BoxSize_Task11_Coronal_Train
|
| 656 |
+
MSD_BoxSize_Task11_Coronal_Test
|
| 657 |
+
MSD_BoxSize_Task11_Axial_Train
|
| 658 |
+
MSD_BoxSize_Task11_Axial_Test
|
| 659 |
+
MSD_BoxSize_Task12_Sagittal_Train
|
| 660 |
+
MSD_BoxSize_Task12_Sagittal_Test
|
| 661 |
+
MSD_BoxSize_Task12_Coronal_Train
|
| 662 |
+
MSD_BoxSize_Task12_Coronal_Test
|
| 663 |
+
MSD_BoxSize_Task12_Axial_Train
|
| 664 |
+
MSD_BoxSize_Task12_Axial_Test
|
| 665 |
+
MSD_BoxSize_Task13_Sagittal_Train
|
| 666 |
+
MSD_BoxSize_Task13_Sagittal_Test
|
| 667 |
+
MSD_BoxSize_Task13_Coronal_Train
|
| 668 |
+
MSD_BoxSize_Task13_Coronal_Test
|
| 669 |
+
MSD_BoxSize_Task13_Axial_Train
|
| 670 |
+
MSD_BoxSize_Task13_Axial_Test
|
| 671 |
+
MSD_BoxSize_Task14_Sagittal_Train
|
| 672 |
+
MSD_BoxSize_Task14_Sagittal_Test
|
| 673 |
+
MSD_BoxSize_Task14_Coronal_Train
|
| 674 |
+
MSD_BoxSize_Task14_Coronal_Test
|
| 675 |
+
MSD_BoxSize_Task14_Axial_Train
|
| 676 |
+
MSD_BoxSize_Task14_Axial_Test
|
| 677 |
+
MSD_TumorLesionSize_Task01_Sagittal_Train
|
| 678 |
+
MSD_TumorLesionSize_Task01_Sagittal_Test
|
| 679 |
+
MSD_TumorLesionSize_Task01_Coronal_Train
|
| 680 |
+
MSD_TumorLesionSize_Task01_Coronal_Test
|
| 681 |
+
MSD_TumorLesionSize_Task01_Axial_Train
|
| 682 |
+
MSD_TumorLesionSize_Task01_Axial_Test
|
| 683 |
+
MSD_TumorLesionSize_Task02_Sagittal_Train
|
| 684 |
+
MSD_TumorLesionSize_Task02_Sagittal_Test
|
| 685 |
+
MSD_TumorLesionSize_Task02_Coronal_Train
|
| 686 |
+
MSD_TumorLesionSize_Task02_Coronal_Test
|
| 687 |
+
MSD_TumorLesionSize_Task02_Axial_Train
|
| 688 |
+
MSD_TumorLesionSize_Task02_Axial_Test
|
| 689 |
+
MSD_TumorLesionSize_Task03_Sagittal_Train
|
| 690 |
+
MSD_TumorLesionSize_Task03_Sagittal_Test
|
| 691 |
+
MSD_TumorLesionSize_Task03_Coronal_Train
|
| 692 |
+
MSD_TumorLesionSize_Task03_Coronal_Test
|
| 693 |
+
MSD_TumorLesionSize_Task03_Axial_Train
|
| 694 |
+
MSD_TumorLesionSize_Task03_Axial_Test
|
| 695 |
+
MSD_TumorLesionSize_Task04_Sagittal_Train
|
| 696 |
+
MSD_TumorLesionSize_Task04_Sagittal_Test
|
| 697 |
+
MSD_TumorLesionSize_Task04_Coronal_Train
|
| 698 |
+
MSD_TumorLesionSize_Task04_Coronal_Test
|
| 699 |
+
MSD_TumorLesionSize_Task04_Axial_Train
|
| 700 |
+
MSD_TumorLesionSize_Task04_Axial_Test
|
| 701 |
+
MSD_TumorLesionSize_Task05_Sagittal_Train
|
| 702 |
+
MSD_TumorLesionSize_Task05_Sagittal_Test
|
| 703 |
+
MSD_TumorLesionSize_Task05_Coronal_Train
|
| 704 |
+
MSD_TumorLesionSize_Task05_Coronal_Test
|
| 705 |
+
MSD_TumorLesionSize_Task05_Axial_Train
|
| 706 |
+
MSD_TumorLesionSize_Task05_Axial_Test
|
| 707 |
+
MSD_TumorLesionSize_Task06_Sagittal_Train
|
| 708 |
+
MSD_TumorLesionSize_Task06_Sagittal_Test
|
| 709 |
+
MSD_TumorLesionSize_Task06_Coronal_Train
|
| 710 |
+
MSD_TumorLesionSize_Task06_Coronal_Test
|
| 711 |
+
MSD_TumorLesionSize_Task06_Axial_Train
|
| 712 |
+
MSD_TumorLesionSize_Task06_Axial_Test
|
| 713 |
+
MSD_TumorLesionSize_Task07_Sagittal_Train
|
| 714 |
+
MSD_TumorLesionSize_Task07_Sagittal_Test
|
| 715 |
+
MSD_TumorLesionSize_Task07_Coronal_Train
|
| 716 |
+
MSD_TumorLesionSize_Task07_Coronal_Test
|
| 717 |
+
MSD_TumorLesionSize_Task07_Axial_Train
|
| 718 |
+
MSD_TumorLesionSize_Task07_Axial_Test
|
| 719 |
+
MSD_TumorLesionSize_Task08_Sagittal_Train
|
| 720 |
+
MSD_TumorLesionSize_Task08_Sagittal_Test
|
| 721 |
+
MSD_TumorLesionSize_Task08_Coronal_Train
|
| 722 |
+
MSD_TumorLesionSize_Task08_Coronal_Test
|
| 723 |
+
MSD_TumorLesionSize_Task08_Axial_Train
|
| 724 |
+
MSD_TumorLesionSize_Task08_Axial_Test
|
| 725 |
+
OAIZIB-CM_MaskSize_Task01_Sagittal_Train
|
| 726 |
+
OAIZIB-CM_MaskSize_Task01_Sagittal_Test
|
| 727 |
+
OAIZIB-CM_MaskSize_Task01_Coronal_Train
|
| 728 |
+
OAIZIB-CM_MaskSize_Task01_Coronal_Test
|
| 729 |
+
OAIZIB-CM_MaskSize_Task01_Axial_Train
|
| 730 |
+
OAIZIB-CM_MaskSize_Task01_Axial_Test
|
| 731 |
+
OAIZIB-CM_BoxSize_Task01_Sagittal_Train
|
| 732 |
+
OAIZIB-CM_BoxSize_Task01_Sagittal_Test
|
| 733 |
+
OAIZIB-CM_BoxSize_Task01_Coronal_Train
|
| 734 |
+
OAIZIB-CM_BoxSize_Task01_Coronal_Test
|
| 735 |
+
OAIZIB-CM_BoxSize_Task01_Axial_Train
|
| 736 |
+
OAIZIB-CM_BoxSize_Task01_Axial_Test
|
| 737 |
+
SKM-TEA_MaskSize_Task01_Sagittal_Train
|
| 738 |
+
SKM-TEA_MaskSize_Task01_Sagittal_Test
|
| 739 |
+
SKM-TEA_MaskSize_Task01_Coronal_Train
|
| 740 |
+
SKM-TEA_MaskSize_Task01_Coronal_Test
|
| 741 |
+
SKM-TEA_MaskSize_Task01_Axial_Train
|
| 742 |
+
SKM-TEA_MaskSize_Task01_Axial_Test
|
| 743 |
+
SKM-TEA_MaskSize_Task02_Sagittal_Train
|
| 744 |
+
SKM-TEA_MaskSize_Task02_Sagittal_Test
|
| 745 |
+
SKM-TEA_MaskSize_Task02_Coronal_Train
|
| 746 |
+
SKM-TEA_MaskSize_Task02_Coronal_Test
|
| 747 |
+
SKM-TEA_MaskSize_Task02_Axial_Train
|
| 748 |
+
SKM-TEA_MaskSize_Task02_Axial_Test
|
| 749 |
+
SKM-TEA_BoxSize_Task01_Sagittal_Train
|
| 750 |
+
SKM-TEA_BoxSize_Task01_Sagittal_Test
|
| 751 |
+
SKM-TEA_BoxSize_Task01_Coronal_Train
|
| 752 |
+
SKM-TEA_BoxSize_Task01_Coronal_Test
|
| 753 |
+
SKM-TEA_BoxSize_Task01_Axial_Train
|
| 754 |
+
SKM-TEA_BoxSize_Task01_Axial_Test
|
| 755 |
+
SKM-TEA_BoxSize_Task02_Sagittal_Train
|
| 756 |
+
SKM-TEA_BoxSize_Task02_Sagittal_Test
|
| 757 |
+
SKM-TEA_BoxSize_Task02_Coronal_Train
|
| 758 |
+
SKM-TEA_BoxSize_Task02_Coronal_Test
|
| 759 |
+
SKM-TEA_BoxSize_Task02_Axial_Train
|
| 760 |
+
SKM-TEA_BoxSize_Task02_Axial_Test
|
| 761 |
+
ToothFairy2_MaskSize_Task01_Sagittal_Train
|
| 762 |
+
ToothFairy2_MaskSize_Task01_Sagittal_Test
|
| 763 |
+
ToothFairy2_MaskSize_Task01_Coronal_Train
|
| 764 |
+
ToothFairy2_MaskSize_Task01_Coronal_Test
|
| 765 |
+
ToothFairy2_MaskSize_Task01_Axial_Train
|
| 766 |
+
ToothFairy2_MaskSize_Task01_Axial_Test
|
| 767 |
+
ToothFairy2_BoxSize_Task01_Sagittal_Train
|
| 768 |
+
ToothFairy2_BoxSize_Task01_Sagittal_Test
|
| 769 |
+
ToothFairy2_BoxSize_Task01_Coronal_Train
|
| 770 |
+
ToothFairy2_BoxSize_Task01_Coronal_Test
|
| 771 |
+
ToothFairy2_BoxSize_Task01_Axial_Train
|
| 772 |
+
ToothFairy2_BoxSize_Task01_Axial_Test
|
| 773 |
+
TopCoW24_MaskSize_Task01_Sagittal_Train
|
| 774 |
+
TopCoW24_MaskSize_Task01_Sagittal_Test
|
| 775 |
+
TopCoW24_MaskSize_Task01_Coronal_Train
|
| 776 |
+
TopCoW24_MaskSize_Task01_Coronal_Test
|
| 777 |
+
TopCoW24_MaskSize_Task01_Axial_Train
|
| 778 |
+
TopCoW24_MaskSize_Task01_Axial_Test
|
| 779 |
+
TopCoW24_MaskSize_Task02_Sagittal_Train
|
| 780 |
+
TopCoW24_MaskSize_Task02_Sagittal_Test
|
| 781 |
+
TopCoW24_MaskSize_Task02_Coronal_Train
|
| 782 |
+
TopCoW24_MaskSize_Task02_Coronal_Test
|
| 783 |
+
TopCoW24_MaskSize_Task02_Axial_Train
|
| 784 |
+
TopCoW24_MaskSize_Task02_Axial_Test
|
| 785 |
+
TopCoW24_BoxSize_Task01_Sagittal_Train
|
| 786 |
+
TopCoW24_BoxSize_Task01_Sagittal_Test
|
| 787 |
+
TopCoW24_BoxSize_Task01_Coronal_Train
|
| 788 |
+
TopCoW24_BoxSize_Task01_Coronal_Test
|
| 789 |
+
TopCoW24_BoxSize_Task01_Axial_Train
|
| 790 |
+
TopCoW24_BoxSize_Task01_Axial_Test
|
| 791 |
+
TopCoW24_BoxSize_Task02_Sagittal_Train
|
| 792 |
+
TopCoW24_BoxSize_Task02_Sagittal_Test
|
| 793 |
+
TopCoW24_BoxSize_Task02_Coronal_Train
|
| 794 |
+
TopCoW24_BoxSize_Task02_Coronal_Test
|
| 795 |
+
TopCoW24_BoxSize_Task02_Axial_Train
|
| 796 |
+
TopCoW24_BoxSize_Task02_Axial_Test
|
| 797 |
+
TotalSegmentator_MaskSize_Task01_Sagittal_Train
|
| 798 |
+
TotalSegmentator_MaskSize_Task01_Sagittal_Test
|
| 799 |
+
TotalSegmentator_MaskSize_Task01_Coronal_Train
|
| 800 |
+
TotalSegmentator_MaskSize_Task01_Coronal_Test
|
| 801 |
+
TotalSegmentator_MaskSize_Task01_Axial_Train
|
| 802 |
+
TotalSegmentator_MaskSize_Task01_Axial_Test
|
| 803 |
+
TotalSegmentator_MaskSize_Task02_Sagittal_Train
|
| 804 |
+
TotalSegmentator_MaskSize_Task02_Sagittal_Test
|
| 805 |
+
TotalSegmentator_MaskSize_Task02_Coronal_Train
|
| 806 |
+
TotalSegmentator_MaskSize_Task02_Coronal_Test
|
| 807 |
+
TotalSegmentator_MaskSize_Task02_Axial_Train
|
| 808 |
+
TotalSegmentator_MaskSize_Task02_Axial_Test
|
| 809 |
+
TotalSegmentator_BoxSize_Task01_Sagittal_Train
|
| 810 |
+
TotalSegmentator_BoxSize_Task01_Sagittal_Test
|
| 811 |
+
TotalSegmentator_BoxSize_Task01_Coronal_Train
|
| 812 |
+
TotalSegmentator_BoxSize_Task01_Coronal_Test
|
| 813 |
+
TotalSegmentator_BoxSize_Task01_Axial_Train
|
| 814 |
+
TotalSegmentator_BoxSize_Task01_Axial_Test
|
| 815 |
+
TotalSegmentator_BoxSize_Task02_Sagittal_Train
|
| 816 |
+
TotalSegmentator_BoxSize_Task02_Sagittal_Test
|
| 817 |
+
TotalSegmentator_BoxSize_Task02_Coronal_Train
|
| 818 |
+
TotalSegmentator_BoxSize_Task02_Coronal_Test
|
| 819 |
+
TotalSegmentator_BoxSize_Task02_Axial_Train
|
| 820 |
+
TotalSegmentator_BoxSize_Task02_Axial_Test
|
| 821 |
+
AFIDs_BiometricsFromLandmarks_Task01_Sagittal_Train
|
| 822 |
+
AFIDs_BiometricsFromLandmarks_Task01_Sagittal_Test
|
| 823 |
+
AFIDs_BiometricsFromLandmarks_Task01_Axial_Train
|
| 824 |
+
AFIDs_BiometricsFromLandmarks_Task01_Axial_Test
|
| 825 |
+
DEEP-PSMA_MaskSize_Task01_Sagittal_Train
|
| 826 |
+
DEEP-PSMA_MaskSize_Task01_Sagittal_Test
|
| 827 |
+
DEEP-PSMA_MaskSize_Task01_Coronal_Train
|
| 828 |
+
DEEP-PSMA_MaskSize_Task01_Coronal_Test
|
| 829 |
+
DEEP-PSMA_MaskSize_Task01_Axial_Train
|
| 830 |
+
DEEP-PSMA_MaskSize_Task01_Axial_Test
|
| 831 |
+
DEEP-PSMA_MaskSize_Task02_Sagittal_Train
|
| 832 |
+
DEEP-PSMA_MaskSize_Task02_Sagittal_Test
|
| 833 |
+
DEEP-PSMA_MaskSize_Task02_Coronal_Train
|
| 834 |
+
DEEP-PSMA_MaskSize_Task02_Coronal_Test
|
| 835 |
+
DEEP-PSMA_MaskSize_Task02_Axial_Train
|
| 836 |
+
DEEP-PSMA_MaskSize_Task02_Axial_Test
|
| 837 |
+
DEEP-PSMA_BoxSize_Task01_Sagittal_Train
|
| 838 |
+
DEEP-PSMA_BoxSize_Task01_Sagittal_Test
|
| 839 |
+
DEEP-PSMA_BoxSize_Task01_Coronal_Train
|
| 840 |
+
DEEP-PSMA_BoxSize_Task01_Coronal_Test
|
| 841 |
+
DEEP-PSMA_BoxSize_Task01_Axial_Train
|
| 842 |
+
DEEP-PSMA_BoxSize_Task01_Axial_Test
|
| 843 |
+
DEEP-PSMA_BoxSize_Task02_Sagittal_Train
|
| 844 |
+
DEEP-PSMA_BoxSize_Task02_Sagittal_Test
|
| 845 |
+
DEEP-PSMA_BoxSize_Task02_Coronal_Train
|
| 846 |
+
DEEP-PSMA_BoxSize_Task02_Coronal_Test
|
| 847 |
+
DEEP-PSMA_BoxSize_Task02_Axial_Train
|
| 848 |
+
DEEP-PSMA_BoxSize_Task02_Axial_Test
|
| 849 |
+
DEEP-PSMA_TumorLesionSize_Task01_Axial_Train
|
| 850 |
+
DEEP-PSMA_TumorLesionSize_Task01_Axial_Test
|
| 851 |
+
DEEP-PSMA_TumorLesionSize_Task02_Axial_Train
|
| 852 |
+
DEEP-PSMA_TumorLesionSize_Task02_Axial_Test
|
| 853 |
+
LIDC-IDRI_BoxSize_Task01_Sagittal_Train
|
| 854 |
+
LIDC-IDRI_BoxSize_Task01_Sagittal_Test
|
| 855 |
+
LIDC-IDRI_BoxSize_Task01_Coronal_Train
|
| 856 |
+
LIDC-IDRI_BoxSize_Task01_Coronal_Test
|
| 857 |
+
LIDC-IDRI_BoxSize_Task01_Axial_Train
|
| 858 |
+
LIDC-IDRI_BoxSize_Task01_Axial_Test
|
| 859 |
+
LIDC-IDRI_MaskSize_Task01_Sagittal_Train
|
| 860 |
+
LIDC-IDRI_MaskSize_Task01_Sagittal_Test
|
| 861 |
+
LIDC-IDRI_MaskSize_Task01_Coronal_Train
|
| 862 |
+
LIDC-IDRI_MaskSize_Task01_Coronal_Test
|
| 863 |
+
LIDC-IDRI_MaskSize_Task01_Axial_Train
|
| 864 |
+
LIDC-IDRI_MaskSize_Task01_Axial_Test
|
| 865 |
+
LIDC-IDRI_TumorLesionSize_Task01_Sagittal_Train
|
| 866 |
+
LIDC-IDRI_TumorLesionSize_Task01_Sagittal_Test
|
| 867 |
+
LIDC-IDRI_TumorLesionSize_Task01_Coronal_Train
|
| 868 |
+
LIDC-IDRI_TumorLesionSize_Task01_Coronal_Test
|
| 869 |
+
LIDC-IDRI_TumorLesionSize_Task01_Axial_Train
|
| 870 |
+
LIDC-IDRI_TumorLesionSize_Task01_Axial_Test
|
| 871 |
+
LNQ2023_BoxSize_Task01_Sagittal_Train
|
| 872 |
+
LNQ2023_BoxSize_Task01_Sagittal_Test
|
| 873 |
+
LNQ2023_BoxSize_Task01_Coronal_Train
|
| 874 |
+
LNQ2023_BoxSize_Task01_Coronal_Test
|
| 875 |
+
LNQ2023_BoxSize_Task01_Axial_Train
|
| 876 |
+
LNQ2023_BoxSize_Task01_Axial_Test
|
| 877 |
+
LNQ2023_MaskSize_Task01_Sagittal_Train
|
| 878 |
+
LNQ2023_MaskSize_Task01_Sagittal_Test
|
| 879 |
+
LNQ2023_MaskSize_Task01_Coronal_Train
|
| 880 |
+
LNQ2023_MaskSize_Task01_Coronal_Test
|
| 881 |
+
LNQ2023_MaskSize_Task01_Axial_Train
|
| 882 |
+
LNQ2023_MaskSize_Task01_Axial_Test
|
| 883 |
+
LNQ2023_TumorLesionSize_Task01_Axial_Train
|
| 884 |
+
LNQ2023_TumorLesionSize_Task01_Axial_Test
|
| 885 |
+
MAMA-MIA_BoxSize_Task01_Sagittal_Train
|
| 886 |
+
MAMA-MIA_BoxSize_Task01_Sagittal_Test
|
| 887 |
+
MAMA-MIA_BoxSize_Task01_Coronal_Train
|
| 888 |
+
MAMA-MIA_BoxSize_Task01_Coronal_Test
|
| 889 |
+
MAMA-MIA_BoxSize_Task01_Axial_Train
|
| 890 |
+
MAMA-MIA_BoxSize_Task01_Axial_Test
|
| 891 |
+
MAMA-MIA_MaskSize_Task01_Sagittal_Train
|
| 892 |
+
MAMA-MIA_MaskSize_Task01_Sagittal_Test
|
| 893 |
+
MAMA-MIA_MaskSize_Task01_Coronal_Train
|
| 894 |
+
MAMA-MIA_MaskSize_Task01_Coronal_Test
|
| 895 |
+
MAMA-MIA_MaskSize_Task01_Axial_Train
|
| 896 |
+
MAMA-MIA_MaskSize_Task01_Axial_Test
|
| 897 |
+
MAMA-MIA_TumorLesionSize_Task01_Sagittal_Train
|
| 898 |
+
MAMA-MIA_TumorLesionSize_Task01_Sagittal_Test
|
| 899 |
+
MAMA-MIA_TumorLesionSize_Task01_Coronal_Train
|
| 900 |
+
MAMA-MIA_TumorLesionSize_Task01_Coronal_Test
|
| 901 |
+
MAMA-MIA_TumorLesionSize_Task01_Axial_Train
|
| 902 |
+
MAMA-MIA_TumorLesionSize_Task01_Axial_Test
|
| 903 |
+
PDDCA_MaskSize_Task01_Sagittal_Train
|
| 904 |
+
PDDCA_MaskSize_Task01_Sagittal_Test
|
| 905 |
+
PDDCA_MaskSize_Task01_Coronal_Train
|
| 906 |
+
PDDCA_MaskSize_Task01_Coronal_Test
|
| 907 |
+
PDDCA_MaskSize_Task01_Axial_Train
|
| 908 |
+
PDDCA_MaskSize_Task01_Axial_Test
|
| 909 |
+
PDDCA_BoxSize_Task01_Sagittal_Train
|
| 910 |
+
PDDCA_BoxSize_Task01_Sagittal_Test
|
| 911 |
+
PDDCA_BoxSize_Task01_Coronal_Train
|
| 912 |
+
PDDCA_BoxSize_Task01_Coronal_Test
|
| 913 |
+
PDDCA_BoxSize_Task01_Axial_Train
|
| 914 |
+
PDDCA_BoxSize_Task01_Axial_Test
|
| 915 |
+
PDDCA_BiometricsFromLandmarks_Task01_Sagittal_Train
|
| 916 |
+
PDDCA_BiometricsFromLandmarks_Task01_Sagittal_Test
|
| 917 |
+
PDDCA_BiometricsFromLandmarks_Task01_Axial_Train
|
| 918 |
+
PDDCA_BiometricsFromLandmarks_Task01_Axial_Test
|
| 919 |
+
PI-CAI_BoxSize_Task01_Sagittal_Train
|
| 920 |
+
PI-CAI_BoxSize_Task01_Sagittal_Test
|
| 921 |
+
PI-CAI_BoxSize_Task01_Coronal_Train
|
| 922 |
+
PI-CAI_BoxSize_Task01_Coronal_Test
|
| 923 |
+
PI-CAI_BoxSize_Task01_Axial_Train
|
| 924 |
+
PI-CAI_BoxSize_Task01_Axial_Test
|
| 925 |
+
PI-CAI_MaskSize_Task01_Sagittal_Train
|
| 926 |
+
PI-CAI_MaskSize_Task01_Sagittal_Test
|
| 927 |
+
PI-CAI_MaskSize_Task01_Coronal_Train
|
| 928 |
+
PI-CAI_MaskSize_Task01_Coronal_Test
|
| 929 |
+
PI-CAI_MaskSize_Task01_Axial_Train
|
| 930 |
+
PI-CAI_MaskSize_Task01_Axial_Test
|
| 931 |
+
PI-CAI_TumorLesionSize_Task01_Sagittal_Train
|
| 932 |
+
PI-CAI_TumorLesionSize_Task01_Sagittal_Test
|
| 933 |
+
PI-CAI_TumorLesionSize_Task01_Coronal_Train
|
| 934 |
+
PI-CAI_TumorLesionSize_Task01_Coronal_Test
|
| 935 |
+
PI-CAI_TumorLesionSize_Task01_Axial_Train
|
| 936 |
+
PI-CAI_TumorLesionSize_Task01_Axial_Test
|
| 937 |
+
VerSe_MaskSize_Task01_Sagittal_Train
|
| 938 |
+
VerSe_MaskSize_Task01_Sagittal_Test
|
| 939 |
+
VerSe_MaskSize_Task01_Coronal_Train
|
| 940 |
+
VerSe_MaskSize_Task01_Coronal_Test
|
| 941 |
+
VerSe_MaskSize_Task01_Axial_Train
|
| 942 |
+
VerSe_MaskSize_Task01_Axial_Test
|
| 943 |
+
VerSe_BoxSize_Task01_Sagittal_Train
|
| 944 |
+
VerSe_BoxSize_Task01_Sagittal_Test
|
| 945 |
+
VerSe_BoxSize_Task01_Coronal_Train
|
| 946 |
+
VerSe_BoxSize_Task01_Coronal_Test
|
| 947 |
+
VerSe_BoxSize_Task01_Axial_Train
|
| 948 |
+
VerSe_BoxSize_Task01_Axial_Test
|
| 949 |
+
VerSe_BiometricsFromLandmarks_Task01_Sagittal_Train
|
| 950 |
+
VerSe_BiometricsFromLandmarks_Task01_Sagittal_Test
|
|
@@ -0,0 +1,475 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Sagittal_Test
|
| 2 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Coronal_Test
|
| 3 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Axial_Test
|
| 4 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Sagittal_Test
|
| 5 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Coronal_Test
|
| 6 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Axial_Test
|
| 7 |
+
AbdomenCT-1K_MaskSize_Task01_Sagittal_Test
|
| 8 |
+
AbdomenCT-1K_MaskSize_Task01_Coronal_Test
|
| 9 |
+
AbdomenCT-1K_MaskSize_Task01_Axial_Test
|
| 10 |
+
AbdomenCT-1K_BoxSize_Task01_Sagittal_Test
|
| 11 |
+
AbdomenCT-1K_BoxSize_Task01_Coronal_Test
|
| 12 |
+
AbdomenCT-1K_BoxSize_Task01_Axial_Test
|
| 13 |
+
ACDC_MaskSize_Task01_Sagittal_Test
|
| 14 |
+
ACDC_MaskSize_Task01_Coronal_Test
|
| 15 |
+
ACDC_MaskSize_Task01_Axial_Test
|
| 16 |
+
ACDC_BoxSize_Task01_Sagittal_Test
|
| 17 |
+
ACDC_BoxSize_Task01_Coronal_Test
|
| 18 |
+
ACDC_BoxSize_Task01_Axial_Test
|
| 19 |
+
AMOS22_MaskSize_Task01_Sagittal_Test
|
| 20 |
+
AMOS22_MaskSize_Task01_Coronal_Test
|
| 21 |
+
AMOS22_MaskSize_Task01_Axial_Test
|
| 22 |
+
AMOS22_MaskSize_Task02_Sagittal_Test
|
| 23 |
+
AMOS22_MaskSize_Task02_Coronal_Test
|
| 24 |
+
AMOS22_MaskSize_Task02_Axial_Test
|
| 25 |
+
AMOS22_BoxSize_Task01_Sagittal_Test
|
| 26 |
+
AMOS22_BoxSize_Task01_Coronal_Test
|
| 27 |
+
AMOS22_BoxSize_Task01_Axial_Test
|
| 28 |
+
AMOS22_BoxSize_Task02_Sagittal_Test
|
| 29 |
+
AMOS22_BoxSize_Task02_Coronal_Test
|
| 30 |
+
AMOS22_BoxSize_Task02_Axial_Test
|
| 31 |
+
autoPET-III_MaskSize_Task01_Sagittal_Test
|
| 32 |
+
autoPET-III_MaskSize_Task01_Coronal_Test
|
| 33 |
+
autoPET-III_MaskSize_Task01_Axial_Test
|
| 34 |
+
autoPET-III_MaskSize_Task02_Sagittal_Test
|
| 35 |
+
autoPET-III_MaskSize_Task02_Coronal_Test
|
| 36 |
+
autoPET-III_MaskSize_Task02_Axial_Test
|
| 37 |
+
autoPET-III_BoxSize_Task01_Sagittal_Test
|
| 38 |
+
autoPET-III_BoxSize_Task01_Coronal_Test
|
| 39 |
+
autoPET-III_BoxSize_Task01_Axial_Test
|
| 40 |
+
autoPET-III_BoxSize_Task02_Sagittal_Test
|
| 41 |
+
autoPET-III_BoxSize_Task02_Coronal_Test
|
| 42 |
+
autoPET-III_BoxSize_Task02_Axial_Test
|
| 43 |
+
autoPET-III_TumorLesionSize_Task01_Sagittal_Test
|
| 44 |
+
autoPET-III_TumorLesionSize_Task01_Coronal_Test
|
| 45 |
+
autoPET-III_TumorLesionSize_Task01_Axial_Test
|
| 46 |
+
BCV15_MaskSize_Task01_Sagittal_Test
|
| 47 |
+
BCV15_MaskSize_Task01_Coronal_Test
|
| 48 |
+
BCV15_MaskSize_Task01_Axial_Test
|
| 49 |
+
BCV15_MaskSize_Task02_Sagittal_Test
|
| 50 |
+
BCV15_MaskSize_Task02_Coronal_Test
|
| 51 |
+
BCV15_MaskSize_Task02_Axial_Test
|
| 52 |
+
BCV15_BoxSize_Task01_Sagittal_Test
|
| 53 |
+
BCV15_BoxSize_Task01_Coronal_Test
|
| 54 |
+
BCV15_BoxSize_Task01_Axial_Test
|
| 55 |
+
BCV15_BoxSize_Task02_Sagittal_Test
|
| 56 |
+
BCV15_BoxSize_Task02_Coronal_Test
|
| 57 |
+
BCV15_BoxSize_Task02_Axial_Test
|
| 58 |
+
BraTS24_MaskSize_Task01_Sagittal_Test
|
| 59 |
+
BraTS24_MaskSize_Task01_Coronal_Test
|
| 60 |
+
BraTS24_MaskSize_Task01_Axial_Test
|
| 61 |
+
BraTS24_MaskSize_Task02_Sagittal_Test
|
| 62 |
+
BraTS24_MaskSize_Task02_Coronal_Test
|
| 63 |
+
BraTS24_MaskSize_Task02_Axial_Test
|
| 64 |
+
BraTS24_MaskSize_Task03_Sagittal_Test
|
| 65 |
+
BraTS24_MaskSize_Task03_Coronal_Test
|
| 66 |
+
BraTS24_MaskSize_Task03_Axial_Test
|
| 67 |
+
BraTS24_MaskSize_Task04_Sagittal_Test
|
| 68 |
+
BraTS24_MaskSize_Task04_Coronal_Test
|
| 69 |
+
BraTS24_MaskSize_Task04_Axial_Test
|
| 70 |
+
BraTS24_MaskSize_Task05_Sagittal_Test
|
| 71 |
+
BraTS24_MaskSize_Task05_Coronal_Test
|
| 72 |
+
BraTS24_MaskSize_Task05_Axial_Test
|
| 73 |
+
BraTS24_MaskSize_Task06_Sagittal_Test
|
| 74 |
+
BraTS24_MaskSize_Task06_Coronal_Test
|
| 75 |
+
BraTS24_MaskSize_Task06_Axial_Test
|
| 76 |
+
BraTS24_MaskSize_Task07_Sagittal_Test
|
| 77 |
+
BraTS24_MaskSize_Task07_Coronal_Test
|
| 78 |
+
BraTS24_MaskSize_Task07_Axial_Test
|
| 79 |
+
BraTS24_MaskSize_Task08_Sagittal_Test
|
| 80 |
+
BraTS24_MaskSize_Task08_Coronal_Test
|
| 81 |
+
BraTS24_MaskSize_Task08_Axial_Test
|
| 82 |
+
BraTS24_MaskSize_Task09_Sagittal_Test
|
| 83 |
+
BraTS24_MaskSize_Task09_Coronal_Test
|
| 84 |
+
BraTS24_MaskSize_Task09_Axial_Test
|
| 85 |
+
BraTS24_MaskSize_Task10_Sagittal_Test
|
| 86 |
+
BraTS24_MaskSize_Task10_Coronal_Test
|
| 87 |
+
BraTS24_MaskSize_Task10_Axial_Test
|
| 88 |
+
BraTS24_MaskSize_Task11_Sagittal_Test
|
| 89 |
+
BraTS24_MaskSize_Task11_Coronal_Test
|
| 90 |
+
BraTS24_MaskSize_Task11_Axial_Test
|
| 91 |
+
BraTS24_MaskSize_Task12_Sagittal_Test
|
| 92 |
+
BraTS24_MaskSize_Task12_Coronal_Test
|
| 93 |
+
BraTS24_MaskSize_Task12_Axial_Test
|
| 94 |
+
BraTS24_MaskSize_Task13_Sagittal_Test
|
| 95 |
+
BraTS24_MaskSize_Task13_Coronal_Test
|
| 96 |
+
BraTS24_MaskSize_Task13_Axial_Test
|
| 97 |
+
BraTS24_BoxSize_Task01_Sagittal_Test
|
| 98 |
+
BraTS24_BoxSize_Task01_Coronal_Test
|
| 99 |
+
BraTS24_BoxSize_Task01_Axial_Test
|
| 100 |
+
BraTS24_BoxSize_Task02_Sagittal_Test
|
| 101 |
+
BraTS24_BoxSize_Task02_Coronal_Test
|
| 102 |
+
BraTS24_BoxSize_Task02_Axial_Test
|
| 103 |
+
BraTS24_BoxSize_Task03_Sagittal_Test
|
| 104 |
+
BraTS24_BoxSize_Task03_Coronal_Test
|
| 105 |
+
BraTS24_BoxSize_Task03_Axial_Test
|
| 106 |
+
BraTS24_BoxSize_Task04_Sagittal_Test
|
| 107 |
+
BraTS24_BoxSize_Task04_Coronal_Test
|
| 108 |
+
BraTS24_BoxSize_Task04_Axial_Test
|
| 109 |
+
BraTS24_BoxSize_Task05_Sagittal_Test
|
| 110 |
+
BraTS24_BoxSize_Task05_Coronal_Test
|
| 111 |
+
BraTS24_BoxSize_Task05_Axial_Test
|
| 112 |
+
BraTS24_BoxSize_Task06_Sagittal_Test
|
| 113 |
+
BraTS24_BoxSize_Task06_Coronal_Test
|
| 114 |
+
BraTS24_BoxSize_Task06_Axial_Test
|
| 115 |
+
BraTS24_BoxSize_Task07_Sagittal_Test
|
| 116 |
+
BraTS24_BoxSize_Task07_Coronal_Test
|
| 117 |
+
BraTS24_BoxSize_Task07_Axial_Test
|
| 118 |
+
BraTS24_BoxSize_Task08_Sagittal_Test
|
| 119 |
+
BraTS24_BoxSize_Task08_Coronal_Test
|
| 120 |
+
BraTS24_BoxSize_Task08_Axial_Test
|
| 121 |
+
BraTS24_BoxSize_Task09_Sagittal_Test
|
| 122 |
+
BraTS24_BoxSize_Task09_Coronal_Test
|
| 123 |
+
BraTS24_BoxSize_Task09_Axial_Test
|
| 124 |
+
BraTS24_BoxSize_Task10_Sagittal_Test
|
| 125 |
+
BraTS24_BoxSize_Task10_Coronal_Test
|
| 126 |
+
BraTS24_BoxSize_Task10_Axial_Test
|
| 127 |
+
BraTS24_BoxSize_Task11_Sagittal_Test
|
| 128 |
+
BraTS24_BoxSize_Task11_Coronal_Test
|
| 129 |
+
BraTS24_BoxSize_Task11_Axial_Test
|
| 130 |
+
BraTS24_BoxSize_Task12_Sagittal_Test
|
| 131 |
+
BraTS24_BoxSize_Task12_Coronal_Test
|
| 132 |
+
BraTS24_BoxSize_Task12_Axial_Test
|
| 133 |
+
BraTS24_BoxSize_Task13_Sagittal_Test
|
| 134 |
+
BraTS24_BoxSize_Task13_Coronal_Test
|
| 135 |
+
BraTS24_BoxSize_Task13_Axial_Test
|
| 136 |
+
BraTS24_TumorLesionSize_Task01_Sagittal_Test
|
| 137 |
+
BraTS24_TumorLesionSize_Task01_Coronal_Test
|
| 138 |
+
BraTS24_TumorLesionSize_Task01_Axial_Test
|
| 139 |
+
BraTS24_TumorLesionSize_Task02_Sagittal_Test
|
| 140 |
+
BraTS24_TumorLesionSize_Task02_Coronal_Test
|
| 141 |
+
BraTS24_TumorLesionSize_Task02_Axial_Test
|
| 142 |
+
BraTS24_TumorLesionSize_Task03_Sagittal_Test
|
| 143 |
+
BraTS24_TumorLesionSize_Task03_Coronal_Test
|
| 144 |
+
BraTS24_TumorLesionSize_Task03_Axial_Test
|
| 145 |
+
BraTS24_TumorLesionSize_Task04_Sagittal_Test
|
| 146 |
+
BraTS24_TumorLesionSize_Task04_Coronal_Test
|
| 147 |
+
BraTS24_TumorLesionSize_Task04_Axial_Test
|
| 148 |
+
BraTS24_TumorLesionSize_Task05_Sagittal_Test
|
| 149 |
+
BraTS24_TumorLesionSize_Task05_Coronal_Test
|
| 150 |
+
BraTS24_TumorLesionSize_Task05_Axial_Test
|
| 151 |
+
BraTS24_TumorLesionSize_Task06_Sagittal_Test
|
| 152 |
+
BraTS24_TumorLesionSize_Task06_Coronal_Test
|
| 153 |
+
BraTS24_TumorLesionSize_Task06_Axial_Test
|
| 154 |
+
BraTS24_TumorLesionSize_Task07_Sagittal_Test
|
| 155 |
+
BraTS24_TumorLesionSize_Task07_Coronal_Test
|
| 156 |
+
BraTS24_TumorLesionSize_Task07_Axial_Test
|
| 157 |
+
BraTS24_TumorLesionSize_Task08_Sagittal_Test
|
| 158 |
+
BraTS24_TumorLesionSize_Task08_Coronal_Test
|
| 159 |
+
BraTS24_TumorLesionSize_Task08_Axial_Test
|
| 160 |
+
BraTS24_TumorLesionSize_Task09_Sagittal_Test
|
| 161 |
+
BraTS24_TumorLesionSize_Task09_Coronal_Test
|
| 162 |
+
BraTS24_TumorLesionSize_Task09_Axial_Test
|
| 163 |
+
BraTS24_TumorLesionSize_Task10_Sagittal_Test
|
| 164 |
+
BraTS24_TumorLesionSize_Task10_Coronal_Test
|
| 165 |
+
BraTS24_TumorLesionSize_Task10_Axial_Test
|
| 166 |
+
BraTS24_TumorLesionSize_Task11_Sagittal_Test
|
| 167 |
+
BraTS24_TumorLesionSize_Task11_Coronal_Test
|
| 168 |
+
BraTS24_TumorLesionSize_Task11_Axial_Test
|
| 169 |
+
BraTS24_TumorLesionSize_Task12_Sagittal_Test
|
| 170 |
+
BraTS24_TumorLesionSize_Task12_Coronal_Test
|
| 171 |
+
BraTS24_TumorLesionSize_Task12_Axial_Test
|
| 172 |
+
CAMUS_MaskSize_Task01_Sagittal_Test
|
| 173 |
+
CAMUS_MaskSize_Task01_Coronal_Test
|
| 174 |
+
CAMUS_MaskSize_Task01_Axial_Test
|
| 175 |
+
CAMUS_BoxSize_Task01_Sagittal_Test
|
| 176 |
+
CAMUS_BoxSize_Task01_Coronal_Test
|
| 177 |
+
CAMUS_BoxSize_Task01_Axial_Test
|
| 178 |
+
Ceph-Biometrics-400_BiometricsFromLandmarks_Distance_Task01_Sagittal_Test
|
| 179 |
+
Ceph-Biometrics-400_BiometricsFromLandmarks_Angle_Task01_Sagittal_Test
|
| 180 |
+
CrossMoDA_MaskSize_Task01_Sagittal_Test
|
| 181 |
+
CrossMoDA_MaskSize_Task01_Coronal_Test
|
| 182 |
+
CrossMoDA_MaskSize_Task01_Axial_Test
|
| 183 |
+
CrossMoDA_BoxSize_Task01_Sagittal_Test
|
| 184 |
+
CrossMoDA_BoxSize_Task01_Coronal_Test
|
| 185 |
+
CrossMoDA_BoxSize_Task01_Axial_Test
|
| 186 |
+
FeTA24_MaskSize_Task01_Sagittal_Test
|
| 187 |
+
FeTA24_MaskSize_Task01_Coronal_Test
|
| 188 |
+
FeTA24_MaskSize_Task01_Axial_Test
|
| 189 |
+
FeTA24_BoxSize_Task01_Sagittal_Test
|
| 190 |
+
FeTA24_BoxSize_Task01_Coronal_Test
|
| 191 |
+
FeTA24_BoxSize_Task01_Axial_Test
|
| 192 |
+
FeTA24_BiometricsFromLandmarks_Task01_Sagittal_Test
|
| 193 |
+
FeTA24_BiometricsFromLandmarks_Task01_Coronal_Test
|
| 194 |
+
FeTA24_BiometricsFromLandmarks_Task01_Axial_Test
|
| 195 |
+
FLARE22_MaskSize_Task01_Sagittal_Test
|
| 196 |
+
FLARE22_MaskSize_Task01_Coronal_Test
|
| 197 |
+
FLARE22_MaskSize_Task01_Axial_Test
|
| 198 |
+
FLARE22_BoxSize_Task01_Sagittal_Test
|
| 199 |
+
FLARE22_BoxSize_Task01_Coronal_Test
|
| 200 |
+
FLARE22_BoxSize_Task01_Axial_Test
|
| 201 |
+
HNTSMRG24_MaskSize_Task01_Sagittal_Test
|
| 202 |
+
HNTSMRG24_MaskSize_Task01_Coronal_Test
|
| 203 |
+
HNTSMRG24_MaskSize_Task01_Axial_Test
|
| 204 |
+
HNTSMRG24_MaskSize_Task02_Sagittal_Test
|
| 205 |
+
HNTSMRG24_MaskSize_Task02_Coronal_Test
|
| 206 |
+
HNTSMRG24_MaskSize_Task02_Axial_Test
|
| 207 |
+
HNTSMRG24_BoxSize_Task01_Sagittal_Test
|
| 208 |
+
HNTSMRG24_BoxSize_Task01_Coronal_Test
|
| 209 |
+
HNTSMRG24_BoxSize_Task01_Axial_Test
|
| 210 |
+
HNTSMRG24_BoxSize_Task02_Sagittal_Test
|
| 211 |
+
HNTSMRG24_BoxSize_Task02_Coronal_Test
|
| 212 |
+
HNTSMRG24_BoxSize_Task02_Axial_Test
|
| 213 |
+
HNTSMRG24_TumorLesionSize_Task01_Sagittal_Test
|
| 214 |
+
HNTSMRG24_TumorLesionSize_Task01_Coronal_Test
|
| 215 |
+
HNTSMRG24_TumorLesionSize_Task01_Axial_Test
|
| 216 |
+
HNTSMRG24_TumorLesionSize_Task02_Sagittal_Test
|
| 217 |
+
HNTSMRG24_TumorLesionSize_Task02_Coronal_Test
|
| 218 |
+
HNTSMRG24_TumorLesionSize_Task02_Axial_Test
|
| 219 |
+
HNTSMRG24_TumorLesionSize_Task03_Sagittal_Test
|
| 220 |
+
HNTSMRG24_TumorLesionSize_Task03_Coronal_Test
|
| 221 |
+
HNTSMRG24_TumorLesionSize_Task03_Axial_Test
|
| 222 |
+
HNTSMRG24_TumorLesionSize_Task04_Sagittal_Test
|
| 223 |
+
HNTSMRG24_TumorLesionSize_Task04_Coronal_Test
|
| 224 |
+
HNTSMRG24_TumorLesionSize_Task04_Axial_Test
|
| 225 |
+
ISLES24_MaskSize_Task01_Sagittal_Test
|
| 226 |
+
ISLES24_MaskSize_Task01_Coronal_Test
|
| 227 |
+
ISLES24_MaskSize_Task01_Axial_Test
|
| 228 |
+
ISLES24_MaskSize_Task02_Sagittal_Test
|
| 229 |
+
ISLES24_MaskSize_Task02_Coronal_Test
|
| 230 |
+
ISLES24_MaskSize_Task02_Axial_Test
|
| 231 |
+
ISLES24_BoxSize_Task01_Sagittal_Test
|
| 232 |
+
ISLES24_BoxSize_Task01_Coronal_Test
|
| 233 |
+
ISLES24_BoxSize_Task01_Axial_Test
|
| 234 |
+
ISLES24_BoxSize_Task02_Sagittal_Test
|
| 235 |
+
ISLES24_BoxSize_Task02_Coronal_Test
|
| 236 |
+
ISLES24_BoxSize_Task02_Axial_Test
|
| 237 |
+
KiPA22_MaskSize_Task01_Sagittal_Test
|
| 238 |
+
KiPA22_MaskSize_Task01_Coronal_Test
|
| 239 |
+
KiPA22_MaskSize_Task01_Axial_Test
|
| 240 |
+
KiPA22_BoxSize_Task01_Sagittal_Test
|
| 241 |
+
KiPA22_BoxSize_Task01_Coronal_Test
|
| 242 |
+
KiPA22_BoxSize_Task01_Axial_Test
|
| 243 |
+
KiPA22_TumorLesionSize_Task01_Sagittal_Test
|
| 244 |
+
KiPA22_TumorLesionSize_Task01_Coronal_Test
|
| 245 |
+
KiPA22_TumorLesionSize_Task01_Axial_Test
|
| 246 |
+
KiTS23_MaskSize_Task01_Sagittal_Test
|
| 247 |
+
KiTS23_MaskSize_Task01_Coronal_Test
|
| 248 |
+
KiTS23_MaskSize_Task01_Axial_Test
|
| 249 |
+
KiTS23_BoxSize_Task01_Sagittal_Test
|
| 250 |
+
KiTS23_BoxSize_Task01_Coronal_Test
|
| 251 |
+
KiTS23_BoxSize_Task01_Axial_Test
|
| 252 |
+
KiTS23_TumorLesionSize_Task01_Sagittal_Test
|
| 253 |
+
KiTS23_TumorLesionSize_Task01_Coronal_Test
|
| 254 |
+
KiTS23_TumorLesionSize_Task01_Axial_Test
|
| 255 |
+
MSD_MaskSize_Task01_Sagittal_Test
|
| 256 |
+
MSD_MaskSize_Task01_Coronal_Test
|
| 257 |
+
MSD_MaskSize_Task01_Axial_Test
|
| 258 |
+
MSD_MaskSize_Task02_Sagittal_Test
|
| 259 |
+
MSD_MaskSize_Task02_Coronal_Test
|
| 260 |
+
MSD_MaskSize_Task02_Axial_Test
|
| 261 |
+
MSD_MaskSize_Task03_Sagittal_Test
|
| 262 |
+
MSD_MaskSize_Task03_Coronal_Test
|
| 263 |
+
MSD_MaskSize_Task03_Axial_Test
|
| 264 |
+
MSD_MaskSize_Task04_Sagittal_Test
|
| 265 |
+
MSD_MaskSize_Task04_Coronal_Test
|
| 266 |
+
MSD_MaskSize_Task04_Axial_Test
|
| 267 |
+
MSD_MaskSize_Task05_Sagittal_Test
|
| 268 |
+
MSD_MaskSize_Task05_Coronal_Test
|
| 269 |
+
MSD_MaskSize_Task05_Axial_Test
|
| 270 |
+
MSD_MaskSize_Task06_Sagittal_Test
|
| 271 |
+
MSD_MaskSize_Task06_Coronal_Test
|
| 272 |
+
MSD_MaskSize_Task06_Axial_Test
|
| 273 |
+
MSD_MaskSize_Task07_Sagittal_Test
|
| 274 |
+
MSD_MaskSize_Task07_Coronal_Test
|
| 275 |
+
MSD_MaskSize_Task07_Axial_Test
|
| 276 |
+
MSD_MaskSize_Task08_Sagittal_Test
|
| 277 |
+
MSD_MaskSize_Task08_Coronal_Test
|
| 278 |
+
MSD_MaskSize_Task08_Axial_Test
|
| 279 |
+
MSD_MaskSize_Task09_Sagittal_Test
|
| 280 |
+
MSD_MaskSize_Task09_Coronal_Test
|
| 281 |
+
MSD_MaskSize_Task09_Axial_Test
|
| 282 |
+
MSD_MaskSize_Task10_Sagittal_Test
|
| 283 |
+
MSD_MaskSize_Task10_Coronal_Test
|
| 284 |
+
MSD_MaskSize_Task10_Axial_Test
|
| 285 |
+
MSD_MaskSize_Task11_Sagittal_Test
|
| 286 |
+
MSD_MaskSize_Task11_Coronal_Test
|
| 287 |
+
MSD_MaskSize_Task11_Axial_Test
|
| 288 |
+
MSD_MaskSize_Task12_Sagittal_Test
|
| 289 |
+
MSD_MaskSize_Task12_Coronal_Test
|
| 290 |
+
MSD_MaskSize_Task12_Axial_Test
|
| 291 |
+
MSD_MaskSize_Task13_Sagittal_Test
|
| 292 |
+
MSD_MaskSize_Task13_Coronal_Test
|
| 293 |
+
MSD_MaskSize_Task13_Axial_Test
|
| 294 |
+
MSD_MaskSize_Task14_Sagittal_Test
|
| 295 |
+
MSD_MaskSize_Task14_Coronal_Test
|
| 296 |
+
MSD_MaskSize_Task14_Axial_Test
|
| 297 |
+
MSD_BoxSize_Task01_Sagittal_Test
|
| 298 |
+
MSD_BoxSize_Task01_Coronal_Test
|
| 299 |
+
MSD_BoxSize_Task01_Axial_Test
|
| 300 |
+
MSD_BoxSize_Task02_Sagittal_Test
|
| 301 |
+
MSD_BoxSize_Task02_Coronal_Test
|
| 302 |
+
MSD_BoxSize_Task02_Axial_Test
|
| 303 |
+
MSD_BoxSize_Task03_Sagittal_Test
|
| 304 |
+
MSD_BoxSize_Task03_Coronal_Test
|
| 305 |
+
MSD_BoxSize_Task03_Axial_Test
|
| 306 |
+
MSD_BoxSize_Task04_Sagittal_Test
|
| 307 |
+
MSD_BoxSize_Task04_Coronal_Test
|
| 308 |
+
MSD_BoxSize_Task04_Axial_Test
|
| 309 |
+
MSD_BoxSize_Task05_Sagittal_Test
|
| 310 |
+
MSD_BoxSize_Task05_Coronal_Test
|
| 311 |
+
MSD_BoxSize_Task05_Axial_Test
|
| 312 |
+
MSD_BoxSize_Task06_Sagittal_Test
|
| 313 |
+
MSD_BoxSize_Task06_Coronal_Test
|
| 314 |
+
MSD_BoxSize_Task06_Axial_Test
|
| 315 |
+
MSD_BoxSize_Task07_Sagittal_Test
|
| 316 |
+
MSD_BoxSize_Task07_Coronal_Test
|
| 317 |
+
MSD_BoxSize_Task07_Axial_Test
|
| 318 |
+
MSD_BoxSize_Task08_Sagittal_Test
|
| 319 |
+
MSD_BoxSize_Task08_Coronal_Test
|
| 320 |
+
MSD_BoxSize_Task08_Axial_Test
|
| 321 |
+
MSD_BoxSize_Task09_Sagittal_Test
|
| 322 |
+
MSD_BoxSize_Task09_Coronal_Test
|
| 323 |
+
MSD_BoxSize_Task09_Axial_Test
|
| 324 |
+
MSD_BoxSize_Task10_Sagittal_Test
|
| 325 |
+
MSD_BoxSize_Task10_Coronal_Test
|
| 326 |
+
MSD_BoxSize_Task10_Axial_Test
|
| 327 |
+
MSD_BoxSize_Task11_Sagittal_Test
|
| 328 |
+
MSD_BoxSize_Task11_Coronal_Test
|
| 329 |
+
MSD_BoxSize_Task11_Axial_Test
|
| 330 |
+
MSD_BoxSize_Task12_Sagittal_Test
|
| 331 |
+
MSD_BoxSize_Task12_Coronal_Test
|
| 332 |
+
MSD_BoxSize_Task12_Axial_Test
|
| 333 |
+
MSD_BoxSize_Task13_Sagittal_Test
|
| 334 |
+
MSD_BoxSize_Task13_Coronal_Test
|
| 335 |
+
MSD_BoxSize_Task13_Axial_Test
|
| 336 |
+
MSD_BoxSize_Task14_Sagittal_Test
|
| 337 |
+
MSD_BoxSize_Task14_Coronal_Test
|
| 338 |
+
MSD_BoxSize_Task14_Axial_Test
|
| 339 |
+
MSD_TumorLesionSize_Task01_Sagittal_Test
|
| 340 |
+
MSD_TumorLesionSize_Task01_Coronal_Test
|
| 341 |
+
MSD_TumorLesionSize_Task01_Axial_Test
|
| 342 |
+
MSD_TumorLesionSize_Task02_Sagittal_Test
|
| 343 |
+
MSD_TumorLesionSize_Task02_Coronal_Test
|
| 344 |
+
MSD_TumorLesionSize_Task02_Axial_Test
|
| 345 |
+
MSD_TumorLesionSize_Task03_Sagittal_Test
|
| 346 |
+
MSD_TumorLesionSize_Task03_Coronal_Test
|
| 347 |
+
MSD_TumorLesionSize_Task03_Axial_Test
|
| 348 |
+
MSD_TumorLesionSize_Task04_Sagittal_Test
|
| 349 |
+
MSD_TumorLesionSize_Task04_Coronal_Test
|
| 350 |
+
MSD_TumorLesionSize_Task04_Axial_Test
|
| 351 |
+
MSD_TumorLesionSize_Task05_Sagittal_Test
|
| 352 |
+
MSD_TumorLesionSize_Task05_Coronal_Test
|
| 353 |
+
MSD_TumorLesionSize_Task05_Axial_Test
|
| 354 |
+
MSD_TumorLesionSize_Task06_Sagittal_Test
|
| 355 |
+
MSD_TumorLesionSize_Task06_Coronal_Test
|
| 356 |
+
MSD_TumorLesionSize_Task06_Axial_Test
|
| 357 |
+
MSD_TumorLesionSize_Task07_Sagittal_Test
|
| 358 |
+
MSD_TumorLesionSize_Task07_Coronal_Test
|
| 359 |
+
MSD_TumorLesionSize_Task07_Axial_Test
|
| 360 |
+
MSD_TumorLesionSize_Task08_Sagittal_Test
|
| 361 |
+
MSD_TumorLesionSize_Task08_Coronal_Test
|
| 362 |
+
MSD_TumorLesionSize_Task08_Axial_Test
|
| 363 |
+
OAIZIB-CM_MaskSize_Task01_Sagittal_Test
|
| 364 |
+
OAIZIB-CM_MaskSize_Task01_Coronal_Test
|
| 365 |
+
OAIZIB-CM_MaskSize_Task01_Axial_Test
|
| 366 |
+
OAIZIB-CM_BoxSize_Task01_Sagittal_Test
|
| 367 |
+
OAIZIB-CM_BoxSize_Task01_Coronal_Test
|
| 368 |
+
OAIZIB-CM_BoxSize_Task01_Axial_Test
|
| 369 |
+
SKM-TEA_MaskSize_Task01_Sagittal_Test
|
| 370 |
+
SKM-TEA_MaskSize_Task01_Coronal_Test
|
| 371 |
+
SKM-TEA_MaskSize_Task01_Axial_Test
|
| 372 |
+
SKM-TEA_MaskSize_Task02_Sagittal_Test
|
| 373 |
+
SKM-TEA_MaskSize_Task02_Coronal_Test
|
| 374 |
+
SKM-TEA_MaskSize_Task02_Axial_Test
|
| 375 |
+
SKM-TEA_BoxSize_Task01_Sagittal_Test
|
| 376 |
+
SKM-TEA_BoxSize_Task01_Coronal_Test
|
| 377 |
+
SKM-TEA_BoxSize_Task01_Axial_Test
|
| 378 |
+
SKM-TEA_BoxSize_Task02_Sagittal_Test
|
| 379 |
+
SKM-TEA_BoxSize_Task02_Coronal_Test
|
| 380 |
+
SKM-TEA_BoxSize_Task02_Axial_Test
|
| 381 |
+
ToothFairy2_MaskSize_Task01_Sagittal_Test
|
| 382 |
+
ToothFairy2_MaskSize_Task01_Coronal_Test
|
| 383 |
+
ToothFairy2_MaskSize_Task01_Axial_Test
|
| 384 |
+
ToothFairy2_BoxSize_Task01_Sagittal_Test
|
| 385 |
+
ToothFairy2_BoxSize_Task01_Coronal_Test
|
| 386 |
+
ToothFairy2_BoxSize_Task01_Axial_Test
|
| 387 |
+
TopCoW24_MaskSize_Task01_Sagittal_Test
|
| 388 |
+
TopCoW24_MaskSize_Task01_Coronal_Test
|
| 389 |
+
TopCoW24_MaskSize_Task01_Axial_Test
|
| 390 |
+
TopCoW24_MaskSize_Task02_Sagittal_Test
|
| 391 |
+
TopCoW24_MaskSize_Task02_Coronal_Test
|
| 392 |
+
TopCoW24_MaskSize_Task02_Axial_Test
|
| 393 |
+
TopCoW24_BoxSize_Task01_Sagittal_Test
|
| 394 |
+
TopCoW24_BoxSize_Task01_Coronal_Test
|
| 395 |
+
TopCoW24_BoxSize_Task01_Axial_Test
|
| 396 |
+
TopCoW24_BoxSize_Task02_Sagittal_Test
|
| 397 |
+
TopCoW24_BoxSize_Task02_Coronal_Test
|
| 398 |
+
TopCoW24_BoxSize_Task02_Axial_Test
|
| 399 |
+
TotalSegmentator_MaskSize_Task01_Sagittal_Test
|
| 400 |
+
TotalSegmentator_MaskSize_Task01_Coronal_Test
|
| 401 |
+
TotalSegmentator_MaskSize_Task01_Axial_Test
|
| 402 |
+
TotalSegmentator_MaskSize_Task02_Sagittal_Test
|
| 403 |
+
TotalSegmentator_MaskSize_Task02_Coronal_Test
|
| 404 |
+
TotalSegmentator_MaskSize_Task02_Axial_Test
|
| 405 |
+
TotalSegmentator_BoxSize_Task01_Sagittal_Test
|
| 406 |
+
TotalSegmentator_BoxSize_Task01_Coronal_Test
|
| 407 |
+
TotalSegmentator_BoxSize_Task01_Axial_Test
|
| 408 |
+
TotalSegmentator_BoxSize_Task02_Sagittal_Test
|
| 409 |
+
TotalSegmentator_BoxSize_Task02_Coronal_Test
|
| 410 |
+
TotalSegmentator_BoxSize_Task02_Axial_Test
|
| 411 |
+
AFIDs_BiometricsFromLandmarks_Task01_Sagittal_Test
|
| 412 |
+
AFIDs_BiometricsFromLandmarks_Task01_Axial_Test
|
| 413 |
+
DEEP-PSMA_MaskSize_Task01_Sagittal_Test
|
| 414 |
+
DEEP-PSMA_MaskSize_Task01_Coronal_Test
|
| 415 |
+
DEEP-PSMA_MaskSize_Task01_Axial_Test
|
| 416 |
+
DEEP-PSMA_MaskSize_Task02_Sagittal_Test
|
| 417 |
+
DEEP-PSMA_MaskSize_Task02_Coronal_Test
|
| 418 |
+
DEEP-PSMA_MaskSize_Task02_Axial_Test
|
| 419 |
+
DEEP-PSMA_BoxSize_Task01_Sagittal_Test
|
| 420 |
+
DEEP-PSMA_BoxSize_Task01_Coronal_Test
|
| 421 |
+
DEEP-PSMA_BoxSize_Task01_Axial_Test
|
| 422 |
+
DEEP-PSMA_BoxSize_Task02_Sagittal_Test
|
| 423 |
+
DEEP-PSMA_BoxSize_Task02_Coronal_Test
|
| 424 |
+
DEEP-PSMA_BoxSize_Task02_Axial_Test
|
| 425 |
+
DEEP-PSMA_TumorLesionSize_Task01_Axial_Test
|
| 426 |
+
DEEP-PSMA_TumorLesionSize_Task02_Axial_Test
|
| 427 |
+
LIDC-IDRI_BoxSize_Task01_Sagittal_Test
|
| 428 |
+
LIDC-IDRI_BoxSize_Task01_Coronal_Test
|
| 429 |
+
LIDC-IDRI_BoxSize_Task01_Axial_Test
|
| 430 |
+
LIDC-IDRI_MaskSize_Task01_Sagittal_Test
|
| 431 |
+
LIDC-IDRI_MaskSize_Task01_Coronal_Test
|
| 432 |
+
LIDC-IDRI_MaskSize_Task01_Axial_Test
|
| 433 |
+
LIDC-IDRI_TumorLesionSize_Task01_Sagittal_Test
|
| 434 |
+
LIDC-IDRI_TumorLesionSize_Task01_Coronal_Test
|
| 435 |
+
LIDC-IDRI_TumorLesionSize_Task01_Axial_Test
|
| 436 |
+
LNQ2023_BoxSize_Task01_Sagittal_Test
|
| 437 |
+
LNQ2023_BoxSize_Task01_Coronal_Test
|
| 438 |
+
LNQ2023_BoxSize_Task01_Axial_Test
|
| 439 |
+
LNQ2023_MaskSize_Task01_Sagittal_Test
|
| 440 |
+
LNQ2023_MaskSize_Task01_Coronal_Test
|
| 441 |
+
LNQ2023_MaskSize_Task01_Axial_Test
|
| 442 |
+
LNQ2023_TumorLesionSize_Task01_Axial_Test
|
| 443 |
+
MAMA-MIA_BoxSize_Task01_Sagittal_Test
|
| 444 |
+
MAMA-MIA_BoxSize_Task01_Coronal_Test
|
| 445 |
+
MAMA-MIA_BoxSize_Task01_Axial_Test
|
| 446 |
+
MAMA-MIA_MaskSize_Task01_Sagittal_Test
|
| 447 |
+
MAMA-MIA_MaskSize_Task01_Coronal_Test
|
| 448 |
+
MAMA-MIA_MaskSize_Task01_Axial_Test
|
| 449 |
+
MAMA-MIA_TumorLesionSize_Task01_Sagittal_Test
|
| 450 |
+
MAMA-MIA_TumorLesionSize_Task01_Coronal_Test
|
| 451 |
+
MAMA-MIA_TumorLesionSize_Task01_Axial_Test
|
| 452 |
+
PDDCA_MaskSize_Task01_Sagittal_Test
|
| 453 |
+
PDDCA_MaskSize_Task01_Coronal_Test
|
| 454 |
+
PDDCA_MaskSize_Task01_Axial_Test
|
| 455 |
+
PDDCA_BoxSize_Task01_Sagittal_Test
|
| 456 |
+
PDDCA_BoxSize_Task01_Coronal_Test
|
| 457 |
+
PDDCA_BoxSize_Task01_Axial_Test
|
| 458 |
+
PDDCA_BiometricsFromLandmarks_Task01_Sagittal_Test
|
| 459 |
+
PDDCA_BiometricsFromLandmarks_Task01_Axial_Test
|
| 460 |
+
PI-CAI_BoxSize_Task01_Sagittal_Test
|
| 461 |
+
PI-CAI_BoxSize_Task01_Coronal_Test
|
| 462 |
+
PI-CAI_BoxSize_Task01_Axial_Test
|
| 463 |
+
PI-CAI_MaskSize_Task01_Sagittal_Test
|
| 464 |
+
PI-CAI_MaskSize_Task01_Coronal_Test
|
| 465 |
+
PI-CAI_MaskSize_Task01_Axial_Test
|
| 466 |
+
PI-CAI_TumorLesionSize_Task01_Sagittal_Test
|
| 467 |
+
PI-CAI_TumorLesionSize_Task01_Coronal_Test
|
| 468 |
+
PI-CAI_TumorLesionSize_Task01_Axial_Test
|
| 469 |
+
VerSe_MaskSize_Task01_Sagittal_Test
|
| 470 |
+
VerSe_MaskSize_Task01_Coronal_Test
|
| 471 |
+
VerSe_MaskSize_Task01_Axial_Test
|
| 472 |
+
VerSe_BoxSize_Task01_Sagittal_Test
|
| 473 |
+
VerSe_BoxSize_Task01_Coronal_Test
|
| 474 |
+
VerSe_BoxSize_Task01_Axial_Test
|
| 475 |
+
VerSe_BiometricsFromLandmarks_Task01_Sagittal_Test
|
|
@@ -0,0 +1,475 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Sagittal_Train
|
| 2 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Coronal_Train
|
| 3 |
+
AbdomenAtlas1.0Mini_MaskSize_Task01_Axial_Train
|
| 4 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Sagittal_Train
|
| 5 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Coronal_Train
|
| 6 |
+
AbdomenAtlas1.0Mini_BoxSize_Task01_Axial_Train
|
| 7 |
+
AbdomenCT-1K_MaskSize_Task01_Sagittal_Train
|
| 8 |
+
AbdomenCT-1K_MaskSize_Task01_Coronal_Train
|
| 9 |
+
AbdomenCT-1K_MaskSize_Task01_Axial_Train
|
| 10 |
+
AbdomenCT-1K_BoxSize_Task01_Sagittal_Train
|
| 11 |
+
AbdomenCT-1K_BoxSize_Task01_Coronal_Train
|
| 12 |
+
AbdomenCT-1K_BoxSize_Task01_Axial_Train
|
| 13 |
+
ACDC_MaskSize_Task01_Sagittal_Train
|
| 14 |
+
ACDC_MaskSize_Task01_Coronal_Train
|
| 15 |
+
ACDC_MaskSize_Task01_Axial_Train
|
| 16 |
+
ACDC_BoxSize_Task01_Sagittal_Train
|
| 17 |
+
ACDC_BoxSize_Task01_Coronal_Train
|
| 18 |
+
ACDC_BoxSize_Task01_Axial_Train
|
| 19 |
+
AMOS22_MaskSize_Task01_Sagittal_Train
|
| 20 |
+
AMOS22_MaskSize_Task01_Coronal_Train
|
| 21 |
+
AMOS22_MaskSize_Task01_Axial_Train
|
| 22 |
+
AMOS22_MaskSize_Task02_Sagittal_Train
|
| 23 |
+
AMOS22_MaskSize_Task02_Coronal_Train
|
| 24 |
+
AMOS22_MaskSize_Task02_Axial_Train
|
| 25 |
+
AMOS22_BoxSize_Task01_Sagittal_Train
|
| 26 |
+
AMOS22_BoxSize_Task01_Coronal_Train
|
| 27 |
+
AMOS22_BoxSize_Task01_Axial_Train
|
| 28 |
+
AMOS22_BoxSize_Task02_Sagittal_Train
|
| 29 |
+
AMOS22_BoxSize_Task02_Coronal_Train
|
| 30 |
+
AMOS22_BoxSize_Task02_Axial_Train
|
| 31 |
+
autoPET-III_MaskSize_Task01_Sagittal_Train
|
| 32 |
+
autoPET-III_MaskSize_Task01_Coronal_Train
|
| 33 |
+
autoPET-III_MaskSize_Task01_Axial_Train
|
| 34 |
+
autoPET-III_MaskSize_Task02_Sagittal_Train
|
| 35 |
+
autoPET-III_MaskSize_Task02_Coronal_Train
|
| 36 |
+
autoPET-III_MaskSize_Task02_Axial_Train
|
| 37 |
+
autoPET-III_BoxSize_Task01_Sagittal_Train
|
| 38 |
+
autoPET-III_BoxSize_Task01_Coronal_Train
|
| 39 |
+
autoPET-III_BoxSize_Task01_Axial_Train
|
| 40 |
+
autoPET-III_BoxSize_Task02_Sagittal_Train
|
| 41 |
+
autoPET-III_BoxSize_Task02_Coronal_Train
|
| 42 |
+
autoPET-III_BoxSize_Task02_Axial_Train
|
| 43 |
+
autoPET-III_TumorLesionSize_Task01_Sagittal_Train
|
| 44 |
+
autoPET-III_TumorLesionSize_Task01_Coronal_Train
|
| 45 |
+
autoPET-III_TumorLesionSize_Task01_Axial_Train
|
| 46 |
+
BCV15_MaskSize_Task01_Sagittal_Train
|
| 47 |
+
BCV15_MaskSize_Task01_Coronal_Train
|
| 48 |
+
BCV15_MaskSize_Task01_Axial_Train
|
| 49 |
+
BCV15_MaskSize_Task02_Sagittal_Train
|
| 50 |
+
BCV15_MaskSize_Task02_Coronal_Train
|
| 51 |
+
BCV15_MaskSize_Task02_Axial_Train
|
| 52 |
+
BCV15_BoxSize_Task01_Sagittal_Train
|
| 53 |
+
BCV15_BoxSize_Task01_Coronal_Train
|
| 54 |
+
BCV15_BoxSize_Task01_Axial_Train
|
| 55 |
+
BCV15_BoxSize_Task02_Sagittal_Train
|
| 56 |
+
BCV15_BoxSize_Task02_Coronal_Train
|
| 57 |
+
BCV15_BoxSize_Task02_Axial_Train
|
| 58 |
+
BraTS24_MaskSize_Task01_Sagittal_Train
|
| 59 |
+
BraTS24_MaskSize_Task01_Coronal_Train
|
| 60 |
+
BraTS24_MaskSize_Task01_Axial_Train
|
| 61 |
+
BraTS24_MaskSize_Task02_Sagittal_Train
|
| 62 |
+
BraTS24_MaskSize_Task02_Coronal_Train
|
| 63 |
+
BraTS24_MaskSize_Task02_Axial_Train
|
| 64 |
+
BraTS24_MaskSize_Task03_Sagittal_Train
|
| 65 |
+
BraTS24_MaskSize_Task03_Coronal_Train
|
| 66 |
+
BraTS24_MaskSize_Task03_Axial_Train
|
| 67 |
+
BraTS24_MaskSize_Task04_Sagittal_Train
|
| 68 |
+
BraTS24_MaskSize_Task04_Coronal_Train
|
| 69 |
+
BraTS24_MaskSize_Task04_Axial_Train
|
| 70 |
+
BraTS24_MaskSize_Task05_Sagittal_Train
|
| 71 |
+
BraTS24_MaskSize_Task05_Coronal_Train
|
| 72 |
+
BraTS24_MaskSize_Task05_Axial_Train
|
| 73 |
+
BraTS24_MaskSize_Task06_Sagittal_Train
|
| 74 |
+
BraTS24_MaskSize_Task06_Coronal_Train
|
| 75 |
+
BraTS24_MaskSize_Task06_Axial_Train
|
| 76 |
+
BraTS24_MaskSize_Task07_Sagittal_Train
|
| 77 |
+
BraTS24_MaskSize_Task07_Coronal_Train
|
| 78 |
+
BraTS24_MaskSize_Task07_Axial_Train
|
| 79 |
+
BraTS24_MaskSize_Task08_Sagittal_Train
|
| 80 |
+
BraTS24_MaskSize_Task08_Coronal_Train
|
| 81 |
+
BraTS24_MaskSize_Task08_Axial_Train
|
| 82 |
+
BraTS24_MaskSize_Task09_Sagittal_Train
|
| 83 |
+
BraTS24_MaskSize_Task09_Coronal_Train
|
| 84 |
+
BraTS24_MaskSize_Task09_Axial_Train
|
| 85 |
+
BraTS24_MaskSize_Task10_Sagittal_Train
|
| 86 |
+
BraTS24_MaskSize_Task10_Coronal_Train
|
| 87 |
+
BraTS24_MaskSize_Task10_Axial_Train
|
| 88 |
+
BraTS24_MaskSize_Task11_Sagittal_Train
|
| 89 |
+
BraTS24_MaskSize_Task11_Coronal_Train
|
| 90 |
+
BraTS24_MaskSize_Task11_Axial_Train
|
| 91 |
+
BraTS24_MaskSize_Task12_Sagittal_Train
|
| 92 |
+
BraTS24_MaskSize_Task12_Coronal_Train
|
| 93 |
+
BraTS24_MaskSize_Task12_Axial_Train
|
| 94 |
+
BraTS24_MaskSize_Task13_Sagittal_Train
|
| 95 |
+
BraTS24_MaskSize_Task13_Coronal_Train
|
| 96 |
+
BraTS24_MaskSize_Task13_Axial_Train
|
| 97 |
+
BraTS24_BoxSize_Task01_Sagittal_Train
|
| 98 |
+
BraTS24_BoxSize_Task01_Coronal_Train
|
| 99 |
+
BraTS24_BoxSize_Task01_Axial_Train
|
| 100 |
+
BraTS24_BoxSize_Task02_Sagittal_Train
|
| 101 |
+
BraTS24_BoxSize_Task02_Coronal_Train
|
| 102 |
+
BraTS24_BoxSize_Task02_Axial_Train
|
| 103 |
+
BraTS24_BoxSize_Task03_Sagittal_Train
|
| 104 |
+
BraTS24_BoxSize_Task03_Coronal_Train
|
| 105 |
+
BraTS24_BoxSize_Task03_Axial_Train
|
| 106 |
+
BraTS24_BoxSize_Task04_Sagittal_Train
|
| 107 |
+
BraTS24_BoxSize_Task04_Coronal_Train
|
| 108 |
+
BraTS24_BoxSize_Task04_Axial_Train
|
| 109 |
+
BraTS24_BoxSize_Task05_Sagittal_Train
|
| 110 |
+
BraTS24_BoxSize_Task05_Coronal_Train
|
| 111 |
+
BraTS24_BoxSize_Task05_Axial_Train
|
| 112 |
+
BraTS24_BoxSize_Task06_Sagittal_Train
|
| 113 |
+
BraTS24_BoxSize_Task06_Coronal_Train
|
| 114 |
+
BraTS24_BoxSize_Task06_Axial_Train
|
| 115 |
+
BraTS24_BoxSize_Task07_Sagittal_Train
|
| 116 |
+
BraTS24_BoxSize_Task07_Coronal_Train
|
| 117 |
+
BraTS24_BoxSize_Task07_Axial_Train
|
| 118 |
+
BraTS24_BoxSize_Task08_Sagittal_Train
|
| 119 |
+
BraTS24_BoxSize_Task08_Coronal_Train
|
| 120 |
+
BraTS24_BoxSize_Task08_Axial_Train
|
| 121 |
+
BraTS24_BoxSize_Task09_Sagittal_Train
|
| 122 |
+
BraTS24_BoxSize_Task09_Coronal_Train
|
| 123 |
+
BraTS24_BoxSize_Task09_Axial_Train
|
| 124 |
+
BraTS24_BoxSize_Task10_Sagittal_Train
|
| 125 |
+
BraTS24_BoxSize_Task10_Coronal_Train
|
| 126 |
+
BraTS24_BoxSize_Task10_Axial_Train
|
| 127 |
+
BraTS24_BoxSize_Task11_Sagittal_Train
|
| 128 |
+
BraTS24_BoxSize_Task11_Coronal_Train
|
| 129 |
+
BraTS24_BoxSize_Task11_Axial_Train
|
| 130 |
+
BraTS24_BoxSize_Task12_Sagittal_Train
|
| 131 |
+
BraTS24_BoxSize_Task12_Coronal_Train
|
| 132 |
+
BraTS24_BoxSize_Task12_Axial_Train
|
| 133 |
+
BraTS24_BoxSize_Task13_Sagittal_Train
|
| 134 |
+
BraTS24_BoxSize_Task13_Coronal_Train
|
| 135 |
+
BraTS24_BoxSize_Task13_Axial_Train
|
| 136 |
+
BraTS24_TumorLesionSize_Task01_Sagittal_Train
|
| 137 |
+
BraTS24_TumorLesionSize_Task01_Coronal_Train
|
| 138 |
+
BraTS24_TumorLesionSize_Task01_Axial_Train
|
| 139 |
+
BraTS24_TumorLesionSize_Task02_Sagittal_Train
|
| 140 |
+
BraTS24_TumorLesionSize_Task02_Coronal_Train
|
| 141 |
+
BraTS24_TumorLesionSize_Task02_Axial_Train
|
| 142 |
+
BraTS24_TumorLesionSize_Task03_Sagittal_Train
|
| 143 |
+
BraTS24_TumorLesionSize_Task03_Coronal_Train
|
| 144 |
+
BraTS24_TumorLesionSize_Task03_Axial_Train
|
| 145 |
+
BraTS24_TumorLesionSize_Task04_Sagittal_Train
|
| 146 |
+
BraTS24_TumorLesionSize_Task04_Coronal_Train
|
| 147 |
+
BraTS24_TumorLesionSize_Task04_Axial_Train
|
| 148 |
+
BraTS24_TumorLesionSize_Task05_Sagittal_Train
|
| 149 |
+
BraTS24_TumorLesionSize_Task05_Coronal_Train
|
| 150 |
+
BraTS24_TumorLesionSize_Task05_Axial_Train
|
| 151 |
+
BraTS24_TumorLesionSize_Task06_Sagittal_Train
|
| 152 |
+
BraTS24_TumorLesionSize_Task06_Coronal_Train
|
| 153 |
+
BraTS24_TumorLesionSize_Task06_Axial_Train
|
| 154 |
+
BraTS24_TumorLesionSize_Task07_Sagittal_Train
|
| 155 |
+
BraTS24_TumorLesionSize_Task07_Coronal_Train
|
| 156 |
+
BraTS24_TumorLesionSize_Task07_Axial_Train
|
| 157 |
+
BraTS24_TumorLesionSize_Task08_Sagittal_Train
|
| 158 |
+
BraTS24_TumorLesionSize_Task08_Coronal_Train
|
| 159 |
+
BraTS24_TumorLesionSize_Task08_Axial_Train
|
| 160 |
+
BraTS24_TumorLesionSize_Task09_Sagittal_Train
|
| 161 |
+
BraTS24_TumorLesionSize_Task09_Coronal_Train
|
| 162 |
+
BraTS24_TumorLesionSize_Task09_Axial_Train
|
| 163 |
+
BraTS24_TumorLesionSize_Task10_Sagittal_Train
|
| 164 |
+
BraTS24_TumorLesionSize_Task10_Coronal_Train
|
| 165 |
+
BraTS24_TumorLesionSize_Task10_Axial_Train
|
| 166 |
+
BraTS24_TumorLesionSize_Task11_Sagittal_Train
|
| 167 |
+
BraTS24_TumorLesionSize_Task11_Coronal_Train
|
| 168 |
+
BraTS24_TumorLesionSize_Task11_Axial_Train
|
| 169 |
+
BraTS24_TumorLesionSize_Task12_Sagittal_Train
|
| 170 |
+
BraTS24_TumorLesionSize_Task12_Coronal_Train
|
| 171 |
+
BraTS24_TumorLesionSize_Task12_Axial_Train
|
| 172 |
+
CAMUS_MaskSize_Task01_Sagittal_Train
|
| 173 |
+
CAMUS_MaskSize_Task01_Coronal_Train
|
| 174 |
+
CAMUS_MaskSize_Task01_Axial_Train
|
| 175 |
+
CAMUS_BoxSize_Task01_Sagittal_Train
|
| 176 |
+
CAMUS_BoxSize_Task01_Coronal_Train
|
| 177 |
+
CAMUS_BoxSize_Task01_Axial_Train
|
| 178 |
+
Ceph-Biometrics-400_BiometricsFromLandmarks_Distance_Task01_Sagittal_Train
|
| 179 |
+
Ceph-Biometrics-400_BiometricsFromLandmarks_Angle_Task01_Sagittal_Train
|
| 180 |
+
CrossMoDA_MaskSize_Task01_Sagittal_Train
|
| 181 |
+
CrossMoDA_MaskSize_Task01_Coronal_Train
|
| 182 |
+
CrossMoDA_MaskSize_Task01_Axial_Train
|
| 183 |
+
CrossMoDA_BoxSize_Task01_Sagittal_Train
|
| 184 |
+
CrossMoDA_BoxSize_Task01_Coronal_Train
|
| 185 |
+
CrossMoDA_BoxSize_Task01_Axial_Train
|
| 186 |
+
FeTA24_MaskSize_Task01_Sagittal_Train
|
| 187 |
+
FeTA24_MaskSize_Task01_Coronal_Train
|
| 188 |
+
FeTA24_MaskSize_Task01_Axial_Train
|
| 189 |
+
FeTA24_BoxSize_Task01_Sagittal_Train
|
| 190 |
+
FeTA24_BoxSize_Task01_Coronal_Train
|
| 191 |
+
FeTA24_BoxSize_Task01_Axial_Train
|
| 192 |
+
FeTA24_BiometricsFromLandmarks_Task01_Sagittal_Train
|
| 193 |
+
FeTA24_BiometricsFromLandmarks_Task01_Coronal_Train
|
| 194 |
+
FeTA24_BiometricsFromLandmarks_Task01_Axial_Train
|
| 195 |
+
FLARE22_MaskSize_Task01_Sagittal_Train
|
| 196 |
+
FLARE22_MaskSize_Task01_Coronal_Train
|
| 197 |
+
FLARE22_MaskSize_Task01_Axial_Train
|
| 198 |
+
FLARE22_BoxSize_Task01_Sagittal_Train
|
| 199 |
+
FLARE22_BoxSize_Task01_Coronal_Train
|
| 200 |
+
FLARE22_BoxSize_Task01_Axial_Train
|
| 201 |
+
HNTSMRG24_MaskSize_Task01_Sagittal_Train
|
| 202 |
+
HNTSMRG24_MaskSize_Task01_Coronal_Train
|
| 203 |
+
HNTSMRG24_MaskSize_Task01_Axial_Train
|
| 204 |
+
HNTSMRG24_MaskSize_Task02_Sagittal_Train
|
| 205 |
+
HNTSMRG24_MaskSize_Task02_Coronal_Train
|
| 206 |
+
HNTSMRG24_MaskSize_Task02_Axial_Train
|
| 207 |
+
HNTSMRG24_BoxSize_Task01_Sagittal_Train
|
| 208 |
+
HNTSMRG24_BoxSize_Task01_Coronal_Train
|
| 209 |
+
HNTSMRG24_BoxSize_Task01_Axial_Train
|
| 210 |
+
HNTSMRG24_BoxSize_Task02_Sagittal_Train
|
| 211 |
+
HNTSMRG24_BoxSize_Task02_Coronal_Train
|
| 212 |
+
HNTSMRG24_BoxSize_Task02_Axial_Train
|
| 213 |
+
HNTSMRG24_TumorLesionSize_Task01_Sagittal_Train
|
| 214 |
+
HNTSMRG24_TumorLesionSize_Task01_Coronal_Train
|
| 215 |
+
HNTSMRG24_TumorLesionSize_Task01_Axial_Train
|
| 216 |
+
HNTSMRG24_TumorLesionSize_Task02_Sagittal_Train
|
| 217 |
+
HNTSMRG24_TumorLesionSize_Task02_Coronal_Train
|
| 218 |
+
HNTSMRG24_TumorLesionSize_Task02_Axial_Train
|
| 219 |
+
HNTSMRG24_TumorLesionSize_Task03_Sagittal_Train
|
| 220 |
+
HNTSMRG24_TumorLesionSize_Task03_Coronal_Train
|
| 221 |
+
HNTSMRG24_TumorLesionSize_Task03_Axial_Train
|
| 222 |
+
HNTSMRG24_TumorLesionSize_Task04_Sagittal_Train
|
| 223 |
+
HNTSMRG24_TumorLesionSize_Task04_Coronal_Train
|
| 224 |
+
HNTSMRG24_TumorLesionSize_Task04_Axial_Train
|
| 225 |
+
ISLES24_MaskSize_Task01_Sagittal_Train
|
| 226 |
+
ISLES24_MaskSize_Task01_Coronal_Train
|
| 227 |
+
ISLES24_MaskSize_Task01_Axial_Train
|
| 228 |
+
ISLES24_MaskSize_Task02_Sagittal_Train
|
| 229 |
+
ISLES24_MaskSize_Task02_Coronal_Train
|
| 230 |
+
ISLES24_MaskSize_Task02_Axial_Train
|
| 231 |
+
ISLES24_BoxSize_Task01_Sagittal_Train
|
| 232 |
+
ISLES24_BoxSize_Task01_Coronal_Train
|
| 233 |
+
ISLES24_BoxSize_Task01_Axial_Train
|
| 234 |
+
ISLES24_BoxSize_Task02_Sagittal_Train
|
| 235 |
+
ISLES24_BoxSize_Task02_Coronal_Train
|
| 236 |
+
ISLES24_BoxSize_Task02_Axial_Train
|
| 237 |
+
KiPA22_MaskSize_Task01_Sagittal_Train
|
| 238 |
+
KiPA22_MaskSize_Task01_Coronal_Train
|
| 239 |
+
KiPA22_MaskSize_Task01_Axial_Train
|
| 240 |
+
KiPA22_BoxSize_Task01_Sagittal_Train
|
| 241 |
+
KiPA22_BoxSize_Task01_Coronal_Train
|
| 242 |
+
KiPA22_BoxSize_Task01_Axial_Train
|
| 243 |
+
KiPA22_TumorLesionSize_Task01_Sagittal_Train
|
| 244 |
+
KiPA22_TumorLesionSize_Task01_Coronal_Train
|
| 245 |
+
KiPA22_TumorLesionSize_Task01_Axial_Train
|
| 246 |
+
KiTS23_MaskSize_Task01_Sagittal_Train
|
| 247 |
+
KiTS23_MaskSize_Task01_Coronal_Train
|
| 248 |
+
KiTS23_MaskSize_Task01_Axial_Train
|
| 249 |
+
KiTS23_BoxSize_Task01_Sagittal_Train
|
| 250 |
+
KiTS23_BoxSize_Task01_Coronal_Train
|
| 251 |
+
KiTS23_BoxSize_Task01_Axial_Train
|
| 252 |
+
KiTS23_TumorLesionSize_Task01_Sagittal_Train
|
| 253 |
+
KiTS23_TumorLesionSize_Task01_Coronal_Train
|
| 254 |
+
KiTS23_TumorLesionSize_Task01_Axial_Train
|
| 255 |
+
MSD_MaskSize_Task01_Sagittal_Train
|
| 256 |
+
MSD_MaskSize_Task01_Coronal_Train
|
| 257 |
+
MSD_MaskSize_Task01_Axial_Train
|
| 258 |
+
MSD_MaskSize_Task02_Sagittal_Train
|
| 259 |
+
MSD_MaskSize_Task02_Coronal_Train
|
| 260 |
+
MSD_MaskSize_Task02_Axial_Train
|
| 261 |
+
MSD_MaskSize_Task03_Sagittal_Train
|
| 262 |
+
MSD_MaskSize_Task03_Coronal_Train
|
| 263 |
+
MSD_MaskSize_Task03_Axial_Train
|
| 264 |
+
MSD_MaskSize_Task04_Sagittal_Train
|
| 265 |
+
MSD_MaskSize_Task04_Coronal_Train
|
| 266 |
+
MSD_MaskSize_Task04_Axial_Train
|
| 267 |
+
MSD_MaskSize_Task05_Sagittal_Train
|
| 268 |
+
MSD_MaskSize_Task05_Coronal_Train
|
| 269 |
+
MSD_MaskSize_Task05_Axial_Train
|
| 270 |
+
MSD_MaskSize_Task06_Sagittal_Train
|
| 271 |
+
MSD_MaskSize_Task06_Coronal_Train
|
| 272 |
+
MSD_MaskSize_Task06_Axial_Train
|
| 273 |
+
MSD_MaskSize_Task07_Sagittal_Train
|
| 274 |
+
MSD_MaskSize_Task07_Coronal_Train
|
| 275 |
+
MSD_MaskSize_Task07_Axial_Train
|
| 276 |
+
MSD_MaskSize_Task08_Sagittal_Train
|
| 277 |
+
MSD_MaskSize_Task08_Coronal_Train
|
| 278 |
+
MSD_MaskSize_Task08_Axial_Train
|
| 279 |
+
MSD_MaskSize_Task09_Sagittal_Train
|
| 280 |
+
MSD_MaskSize_Task09_Coronal_Train
|
| 281 |
+
MSD_MaskSize_Task09_Axial_Train
|
| 282 |
+
MSD_MaskSize_Task10_Sagittal_Train
|
| 283 |
+
MSD_MaskSize_Task10_Coronal_Train
|
| 284 |
+
MSD_MaskSize_Task10_Axial_Train
|
| 285 |
+
MSD_MaskSize_Task11_Sagittal_Train
|
| 286 |
+
MSD_MaskSize_Task11_Coronal_Train
|
| 287 |
+
MSD_MaskSize_Task11_Axial_Train
|
| 288 |
+
MSD_MaskSize_Task12_Sagittal_Train
|
| 289 |
+
MSD_MaskSize_Task12_Coronal_Train
|
| 290 |
+
MSD_MaskSize_Task12_Axial_Train
|
| 291 |
+
MSD_MaskSize_Task13_Sagittal_Train
|
| 292 |
+
MSD_MaskSize_Task13_Coronal_Train
|
| 293 |
+
MSD_MaskSize_Task13_Axial_Train
|
| 294 |
+
MSD_MaskSize_Task14_Sagittal_Train
|
| 295 |
+
MSD_MaskSize_Task14_Coronal_Train
|
| 296 |
+
MSD_MaskSize_Task14_Axial_Train
|
| 297 |
+
MSD_BoxSize_Task01_Sagittal_Train
|
| 298 |
+
MSD_BoxSize_Task01_Coronal_Train
|
| 299 |
+
MSD_BoxSize_Task01_Axial_Train
|
| 300 |
+
MSD_BoxSize_Task02_Sagittal_Train
|
| 301 |
+
MSD_BoxSize_Task02_Coronal_Train
|
| 302 |
+
MSD_BoxSize_Task02_Axial_Train
|
| 303 |
+
MSD_BoxSize_Task03_Sagittal_Train
|
| 304 |
+
MSD_BoxSize_Task03_Coronal_Train
|
| 305 |
+
MSD_BoxSize_Task03_Axial_Train
|
| 306 |
+
MSD_BoxSize_Task04_Sagittal_Train
|
| 307 |
+
MSD_BoxSize_Task04_Coronal_Train
|
| 308 |
+
MSD_BoxSize_Task04_Axial_Train
|
| 309 |
+
MSD_BoxSize_Task05_Sagittal_Train
|
| 310 |
+
MSD_BoxSize_Task05_Coronal_Train
|
| 311 |
+
MSD_BoxSize_Task05_Axial_Train
|
| 312 |
+
MSD_BoxSize_Task06_Sagittal_Train
|
| 313 |
+
MSD_BoxSize_Task06_Coronal_Train
|
| 314 |
+
MSD_BoxSize_Task06_Axial_Train
|
| 315 |
+
MSD_BoxSize_Task07_Sagittal_Train
|
| 316 |
+
MSD_BoxSize_Task07_Coronal_Train
|
| 317 |
+
MSD_BoxSize_Task07_Axial_Train
|
| 318 |
+
MSD_BoxSize_Task08_Sagittal_Train
|
| 319 |
+
MSD_BoxSize_Task08_Coronal_Train
|
| 320 |
+
MSD_BoxSize_Task08_Axial_Train
|
| 321 |
+
MSD_BoxSize_Task09_Sagittal_Train
|
| 322 |
+
MSD_BoxSize_Task09_Coronal_Train
|
| 323 |
+
MSD_BoxSize_Task09_Axial_Train
|
| 324 |
+
MSD_BoxSize_Task10_Sagittal_Train
|
| 325 |
+
MSD_BoxSize_Task10_Coronal_Train
|
| 326 |
+
MSD_BoxSize_Task10_Axial_Train
|
| 327 |
+
MSD_BoxSize_Task11_Sagittal_Train
|
| 328 |
+
MSD_BoxSize_Task11_Coronal_Train
|
| 329 |
+
MSD_BoxSize_Task11_Axial_Train
|
| 330 |
+
MSD_BoxSize_Task12_Sagittal_Train
|
| 331 |
+
MSD_BoxSize_Task12_Coronal_Train
|
| 332 |
+
MSD_BoxSize_Task12_Axial_Train
|
| 333 |
+
MSD_BoxSize_Task13_Sagittal_Train
|
| 334 |
+
MSD_BoxSize_Task13_Coronal_Train
|
| 335 |
+
MSD_BoxSize_Task13_Axial_Train
|
| 336 |
+
MSD_BoxSize_Task14_Sagittal_Train
|
| 337 |
+
MSD_BoxSize_Task14_Coronal_Train
|
| 338 |
+
MSD_BoxSize_Task14_Axial_Train
|
| 339 |
+
MSD_TumorLesionSize_Task01_Sagittal_Train
|
| 340 |
+
MSD_TumorLesionSize_Task01_Coronal_Train
|
| 341 |
+
MSD_TumorLesionSize_Task01_Axial_Train
|
| 342 |
+
MSD_TumorLesionSize_Task02_Sagittal_Train
|
| 343 |
+
MSD_TumorLesionSize_Task02_Coronal_Train
|
| 344 |
+
MSD_TumorLesionSize_Task02_Axial_Train
|
| 345 |
+
MSD_TumorLesionSize_Task03_Sagittal_Train
|
| 346 |
+
MSD_TumorLesionSize_Task03_Coronal_Train
|
| 347 |
+
MSD_TumorLesionSize_Task03_Axial_Train
|
| 348 |
+
MSD_TumorLesionSize_Task04_Sagittal_Train
|
| 349 |
+
MSD_TumorLesionSize_Task04_Coronal_Train
|
| 350 |
+
MSD_TumorLesionSize_Task04_Axial_Train
|
| 351 |
+
MSD_TumorLesionSize_Task05_Sagittal_Train
|
| 352 |
+
MSD_TumorLesionSize_Task05_Coronal_Train
|
| 353 |
+
MSD_TumorLesionSize_Task05_Axial_Train
|
| 354 |
+
MSD_TumorLesionSize_Task06_Sagittal_Train
|
| 355 |
+
MSD_TumorLesionSize_Task06_Coronal_Train
|
| 356 |
+
MSD_TumorLesionSize_Task06_Axial_Train
|
| 357 |
+
MSD_TumorLesionSize_Task07_Sagittal_Train
|
| 358 |
+
MSD_TumorLesionSize_Task07_Coronal_Train
|
| 359 |
+
MSD_TumorLesionSize_Task07_Axial_Train
|
| 360 |
+
MSD_TumorLesionSize_Task08_Sagittal_Train
|
| 361 |
+
MSD_TumorLesionSize_Task08_Coronal_Train
|
| 362 |
+
MSD_TumorLesionSize_Task08_Axial_Train
|
| 363 |
+
OAIZIB-CM_MaskSize_Task01_Sagittal_Train
|
| 364 |
+
OAIZIB-CM_MaskSize_Task01_Coronal_Train
|
| 365 |
+
OAIZIB-CM_MaskSize_Task01_Axial_Train
|
| 366 |
+
OAIZIB-CM_BoxSize_Task01_Sagittal_Train
|
| 367 |
+
OAIZIB-CM_BoxSize_Task01_Coronal_Train
|
| 368 |
+
OAIZIB-CM_BoxSize_Task01_Axial_Train
|
| 369 |
+
SKM-TEA_MaskSize_Task01_Sagittal_Train
|
| 370 |
+
SKM-TEA_MaskSize_Task01_Coronal_Train
|
| 371 |
+
SKM-TEA_MaskSize_Task01_Axial_Train
|
| 372 |
+
SKM-TEA_MaskSize_Task02_Sagittal_Train
|
| 373 |
+
SKM-TEA_MaskSize_Task02_Coronal_Train
|
| 374 |
+
SKM-TEA_MaskSize_Task02_Axial_Train
|
| 375 |
+
SKM-TEA_BoxSize_Task01_Sagittal_Train
|
| 376 |
+
SKM-TEA_BoxSize_Task01_Coronal_Train
|
| 377 |
+
SKM-TEA_BoxSize_Task01_Axial_Train
|
| 378 |
+
SKM-TEA_BoxSize_Task02_Sagittal_Train
|
| 379 |
+
SKM-TEA_BoxSize_Task02_Coronal_Train
|
| 380 |
+
SKM-TEA_BoxSize_Task02_Axial_Train
|
| 381 |
+
ToothFairy2_MaskSize_Task01_Sagittal_Train
|
| 382 |
+
ToothFairy2_MaskSize_Task01_Coronal_Train
|
| 383 |
+
ToothFairy2_MaskSize_Task01_Axial_Train
|
| 384 |
+
ToothFairy2_BoxSize_Task01_Sagittal_Train
|
| 385 |
+
ToothFairy2_BoxSize_Task01_Coronal_Train
|
| 386 |
+
ToothFairy2_BoxSize_Task01_Axial_Train
|
| 387 |
+
TopCoW24_MaskSize_Task01_Sagittal_Train
|
| 388 |
+
TopCoW24_MaskSize_Task01_Coronal_Train
|
| 389 |
+
TopCoW24_MaskSize_Task01_Axial_Train
|
| 390 |
+
TopCoW24_MaskSize_Task02_Sagittal_Train
|
| 391 |
+
TopCoW24_MaskSize_Task02_Coronal_Train
|
| 392 |
+
TopCoW24_MaskSize_Task02_Axial_Train
|
| 393 |
+
TopCoW24_BoxSize_Task01_Sagittal_Train
|
| 394 |
+
TopCoW24_BoxSize_Task01_Coronal_Train
|
| 395 |
+
TopCoW24_BoxSize_Task01_Axial_Train
|
| 396 |
+
TopCoW24_BoxSize_Task02_Sagittal_Train
|
| 397 |
+
TopCoW24_BoxSize_Task02_Coronal_Train
|
| 398 |
+
TopCoW24_BoxSize_Task02_Axial_Train
|
| 399 |
+
TotalSegmentator_MaskSize_Task01_Sagittal_Train
|
| 400 |
+
TotalSegmentator_MaskSize_Task01_Coronal_Train
|
| 401 |
+
TotalSegmentator_MaskSize_Task01_Axial_Train
|
| 402 |
+
TotalSegmentator_MaskSize_Task02_Sagittal_Train
|
| 403 |
+
TotalSegmentator_MaskSize_Task02_Coronal_Train
|
| 404 |
+
TotalSegmentator_MaskSize_Task02_Axial_Train
|
| 405 |
+
TotalSegmentator_BoxSize_Task01_Sagittal_Train
|
| 406 |
+
TotalSegmentator_BoxSize_Task01_Coronal_Train
|
| 407 |
+
TotalSegmentator_BoxSize_Task01_Axial_Train
|
| 408 |
+
TotalSegmentator_BoxSize_Task02_Sagittal_Train
|
| 409 |
+
TotalSegmentator_BoxSize_Task02_Coronal_Train
|
| 410 |
+
TotalSegmentator_BoxSize_Task02_Axial_Train
|
| 411 |
+
AFIDs_BiometricsFromLandmarks_Task01_Sagittal_Train
|
| 412 |
+
AFIDs_BiometricsFromLandmarks_Task01_Axial_Train
|
| 413 |
+
DEEP-PSMA_MaskSize_Task01_Sagittal_Train
|
| 414 |
+
DEEP-PSMA_MaskSize_Task01_Coronal_Train
|
| 415 |
+
DEEP-PSMA_MaskSize_Task01_Axial_Train
|
| 416 |
+
DEEP-PSMA_MaskSize_Task02_Sagittal_Train
|
| 417 |
+
DEEP-PSMA_MaskSize_Task02_Coronal_Train
|
| 418 |
+
DEEP-PSMA_MaskSize_Task02_Axial_Train
|
| 419 |
+
DEEP-PSMA_BoxSize_Task01_Sagittal_Train
|
| 420 |
+
DEEP-PSMA_BoxSize_Task01_Coronal_Train
|
| 421 |
+
DEEP-PSMA_BoxSize_Task01_Axial_Train
|
| 422 |
+
DEEP-PSMA_BoxSize_Task02_Sagittal_Train
|
| 423 |
+
DEEP-PSMA_BoxSize_Task02_Coronal_Train
|
| 424 |
+
DEEP-PSMA_BoxSize_Task02_Axial_Train
|
| 425 |
+
DEEP-PSMA_TumorLesionSize_Task01_Axial_Train
|
| 426 |
+
DEEP-PSMA_TumorLesionSize_Task02_Axial_Train
|
| 427 |
+
LIDC-IDRI_BoxSize_Task01_Sagittal_Train
|
| 428 |
+
LIDC-IDRI_BoxSize_Task01_Coronal_Train
|
| 429 |
+
LIDC-IDRI_BoxSize_Task01_Axial_Train
|
| 430 |
+
LIDC-IDRI_MaskSize_Task01_Sagittal_Train
|
| 431 |
+
LIDC-IDRI_MaskSize_Task01_Coronal_Train
|
| 432 |
+
LIDC-IDRI_MaskSize_Task01_Axial_Train
|
| 433 |
+
LIDC-IDRI_TumorLesionSize_Task01_Sagittal_Train
|
| 434 |
+
LIDC-IDRI_TumorLesionSize_Task01_Coronal_Train
|
| 435 |
+
LIDC-IDRI_TumorLesionSize_Task01_Axial_Train
|
| 436 |
+
LNQ2023_BoxSize_Task01_Sagittal_Train
|
| 437 |
+
LNQ2023_BoxSize_Task01_Coronal_Train
|
| 438 |
+
LNQ2023_BoxSize_Task01_Axial_Train
|
| 439 |
+
LNQ2023_MaskSize_Task01_Sagittal_Train
|
| 440 |
+
LNQ2023_MaskSize_Task01_Coronal_Train
|
| 441 |
+
LNQ2023_MaskSize_Task01_Axial_Train
|
| 442 |
+
LNQ2023_TumorLesionSize_Task01_Axial_Train
|
| 443 |
+
MAMA-MIA_BoxSize_Task01_Sagittal_Train
|
| 444 |
+
MAMA-MIA_BoxSize_Task01_Coronal_Train
|
| 445 |
+
MAMA-MIA_BoxSize_Task01_Axial_Train
|
| 446 |
+
MAMA-MIA_MaskSize_Task01_Sagittal_Train
|
| 447 |
+
MAMA-MIA_MaskSize_Task01_Coronal_Train
|
| 448 |
+
MAMA-MIA_MaskSize_Task01_Axial_Train
|
| 449 |
+
MAMA-MIA_TumorLesionSize_Task01_Sagittal_Train
|
| 450 |
+
MAMA-MIA_TumorLesionSize_Task01_Coronal_Train
|
| 451 |
+
MAMA-MIA_TumorLesionSize_Task01_Axial_Train
|
| 452 |
+
PDDCA_MaskSize_Task01_Sagittal_Train
|
| 453 |
+
PDDCA_MaskSize_Task01_Coronal_Train
|
| 454 |
+
PDDCA_MaskSize_Task01_Axial_Train
|
| 455 |
+
PDDCA_BoxSize_Task01_Sagittal_Train
|
| 456 |
+
PDDCA_BoxSize_Task01_Coronal_Train
|
| 457 |
+
PDDCA_BoxSize_Task01_Axial_Train
|
| 458 |
+
PDDCA_BiometricsFromLandmarks_Task01_Sagittal_Train
|
| 459 |
+
PDDCA_BiometricsFromLandmarks_Task01_Axial_Train
|
| 460 |
+
PI-CAI_BoxSize_Task01_Sagittal_Train
|
| 461 |
+
PI-CAI_BoxSize_Task01_Coronal_Train
|
| 462 |
+
PI-CAI_BoxSize_Task01_Axial_Train
|
| 463 |
+
PI-CAI_MaskSize_Task01_Sagittal_Train
|
| 464 |
+
PI-CAI_MaskSize_Task01_Coronal_Train
|
| 465 |
+
PI-CAI_MaskSize_Task01_Axial_Train
|
| 466 |
+
PI-CAI_TumorLesionSize_Task01_Sagittal_Train
|
| 467 |
+
PI-CAI_TumorLesionSize_Task01_Coronal_Train
|
| 468 |
+
PI-CAI_TumorLesionSize_Task01_Axial_Train
|
| 469 |
+
VerSe_MaskSize_Task01_Sagittal_Train
|
| 470 |
+
VerSe_MaskSize_Task01_Coronal_Train
|
| 471 |
+
VerSe_MaskSize_Task01_Axial_Train
|
| 472 |
+
VerSe_BoxSize_Task01_Sagittal_Train
|
| 473 |
+
VerSe_BoxSize_Task01_Coronal_Train
|
| 474 |
+
VerSe_BoxSize_Task01_Axial_Train
|
| 475 |
+
VerSe_BiometricsFromLandmarks_Task01_Sagittal_Train
|
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Shared bootstrap for the standalone loader test scripts.
|
| 3 |
+
|
| 4 |
+
`MedVision.py` imports `datasets` at module scope, so any test that wants to
|
| 5 |
+
reach its module-level helpers has to satisfy that import first. The stub below
|
| 6 |
+
is a stdlib-only stand-in used only when the real library is absent — everything
|
| 7 |
+
under test is module-level and pure, so nothing stubbed here is ever executed;
|
| 8 |
+
the stub only has to let the module import and build its BUILDER_CONFIGS.
|
| 9 |
+
|
| 10 |
+
This lives in one place because both test scripts need it and the stub must
|
| 11 |
+
mirror `MedVision.py`'s `from datasets import (...)` list: with two copies, a new
|
| 12 |
+
symbol imported by the loader has to be added to both in lockstep or one suite
|
| 13 |
+
dies at import.
|
| 14 |
+
|
| 15 |
+
Not importable as a package — the test scripts are run as
|
| 16 |
+
`python scripts/<name>.py`, which puts `scripts/` on `sys.path[0]`, so a plain
|
| 17 |
+
`import _medvision_test_support` works.
|
| 18 |
+
"""
|
| 19 |
+
import importlib.util
|
| 20 |
+
import logging
|
| 21 |
+
import os
|
| 22 |
+
import sys
|
| 23 |
+
import tempfile
|
| 24 |
+
import types
|
| 25 |
+
|
| 26 |
+
_HERE = os.path.dirname(os.path.abspath(__file__))
|
| 27 |
+
MEDVISION_PY = os.path.join(_HERE, "..", "MedVision.py")
|
| 28 |
+
INFO_CSV = os.path.join(_HERE, "..", "info", "v1.2.0", "ConfigurationsList_All.csv")
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def install_datasets_stub():
|
| 32 |
+
"""Register a minimal stdlib-only `datasets` in sys.modules."""
|
| 33 |
+
m = types.ModuleType("datasets")
|
| 34 |
+
|
| 35 |
+
class BuilderConfig:
|
| 36 |
+
def __init__(self, name=None, version=None, **kw):
|
| 37 |
+
self.name = name
|
| 38 |
+
self.version = version
|
| 39 |
+
for k, v in kw.items():
|
| 40 |
+
setattr(self, k, v)
|
| 41 |
+
|
| 42 |
+
def create_config_id(self, config_kwargs, custom_features=None):
|
| 43 |
+
# Return the injected kwargs so tests can read the fingerprint token
|
| 44 |
+
# directly instead of parsing a hashed id.
|
| 45 |
+
return dict(config_kwargs or {})
|
| 46 |
+
|
| 47 |
+
class GeneratorBasedBuilder:
|
| 48 |
+
pass
|
| 49 |
+
|
| 50 |
+
def _passthrough(*a, **k):
|
| 51 |
+
return a[0] if len(a) == 1 else (a or k)
|
| 52 |
+
|
| 53 |
+
m.BuilderConfig = BuilderConfig
|
| 54 |
+
m.GeneratorBasedBuilder = GeneratorBasedBuilder
|
| 55 |
+
m.Split = types.SimpleNamespace(TRAIN="train", TEST="test")
|
| 56 |
+
m.SplitGenerator = _passthrough
|
| 57 |
+
m.DatasetInfo = _passthrough
|
| 58 |
+
m.Features = _passthrough
|
| 59 |
+
m.Value = _passthrough
|
| 60 |
+
m.Sequence = _passthrough
|
| 61 |
+
m.logging = types.SimpleNamespace(get_logger=logging.getLogger)
|
| 62 |
+
sys.modules["datasets"] = m
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def load_loader(tmp_prefix="medvision_test_"):
|
| 66 |
+
"""Import MedVision.py and return the module.
|
| 67 |
+
|
| 68 |
+
Points MedVision_DATA_DIR at a throwaway directory if unset — the loader
|
| 69 |
+
raises at import time without it — and falls back to the stub when the real
|
| 70 |
+
`datasets` is not installed.
|
| 71 |
+
"""
|
| 72 |
+
os.environ.setdefault("MedVision_DATA_DIR", tempfile.mkdtemp(prefix=tmp_prefix))
|
| 73 |
+
try:
|
| 74 |
+
import datasets # noqa: F401
|
| 75 |
+
except ModuleNotFoundError:
|
| 76 |
+
install_datasets_stub()
|
| 77 |
+
spec = importlib.util.spec_from_file_location("medvision_loader", MEDVISION_PY)
|
| 78 |
+
mod = importlib.util.module_from_spec(spec)
|
| 79 |
+
spec.loader.exec_module(mod)
|
| 80 |
+
return mod
|
|
@@ -0,0 +1,603 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Unit tests for per-(dataset, plan-kind) annotation version resolution.
|
| 3 |
+
|
| 4 |
+
Every config loads the newest annotation published at or before the requested
|
| 5 |
+
version. The invariant under test:
|
| 6 |
+
|
| 7 |
+
For every config x every pin, resolution either returns a version that is
|
| 8 |
+
declared for that (dataset, plan-kind), or raises the "not published at this
|
| 9 |
+
version" error. There is no third outcome -- in particular, never a path
|
| 10 |
+
that does not exist.
|
| 11 |
+
|
| 12 |
+
Run: python scripts/test_annotation_resolution.py
|
| 13 |
+
python scripts/test_annotation_resolution.py --datasets-root /path/to/Datasets
|
| 14 |
+
|
| 15 |
+
Sections 1-4, 6 and 7 are pure and need no data on disk. Section 5 reconciles
|
| 16 |
+
_ANNOTATION_INDEX against a real Datasets/ tree and is skipped when none is given.
|
| 17 |
+
|
| 18 |
+
The repo has no test framework; this is a standalone script that exits non-zero
|
| 19 |
+
on any failure, matching scripts/test_tl_ack_gate.py.
|
| 20 |
+
"""
|
| 21 |
+
import argparse
|
| 22 |
+
import ast
|
| 23 |
+
import importlib.util
|
| 24 |
+
import inspect
|
| 25 |
+
import os
|
| 26 |
+
import re
|
| 27 |
+
import shutil
|
| 28 |
+
import sys
|
| 29 |
+
import tempfile
|
| 30 |
+
|
| 31 |
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
| 32 |
+
import _medvision_test_support as _support # noqa: E402
|
| 33 |
+
|
| 34 |
+
_MEDVISION_PY = _support.MEDVISION_PY
|
| 35 |
+
_INFO_CSV = _support.INFO_CSV
|
| 36 |
+
|
| 37 |
+
mv = _support.load_loader("medvision_res_test_")
|
| 38 |
+
|
| 39 |
+
PINS = ["1.0.0", "1.1.0", "1.1.1", "1.2.0", "latest"]
|
| 40 |
+
RELEASE = "1.2.0"
|
| 41 |
+
|
| 42 |
+
_results = []
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def check(ok, desc, detail=""):
|
| 46 |
+
_results.append(ok)
|
| 47 |
+
print(f"[{'PASS' if ok else 'FAIL'}] {desc}" + (f" {detail}" if detail else ""))
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def section(title):
|
| 51 |
+
print(f"\n--- {title} ---")
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
# ---------------------------------------------------------------- 1. helpers
|
| 55 |
+
section("1. Version helpers")
|
| 56 |
+
|
| 57 |
+
check(mv._version_tuple("1.1.0") == (1, 1, 0), "parses 1.1.0")
|
| 58 |
+
check(mv._version_tuple("1.2") == (1, 2, 0), "pads 1.2 -> (1,2,0)",
|
| 59 |
+
"unpadded, (1,2) would sort BELOW (1,2,0)")
|
| 60 |
+
check(mv._version_tuple(True) == (1, 0, 0), "legacy boolean True -> v1.0.0 baseline")
|
| 61 |
+
check(mv._version_tuple(None) == (1, 0, 0), "None -> v1.0.0 baseline")
|
| 62 |
+
check(
|
| 63 |
+
mv._version_tuple("1.0.0") < mv._version_tuple("1.1.0")
|
| 64 |
+
< mv._version_tuple("1.1.1") < mv._version_tuple("1.2.0"),
|
| 65 |
+
"release ordering is strictly increasing",
|
| 66 |
+
)
|
| 67 |
+
for good in ("1.0.0", "1.2.0", "10.20.30"):
|
| 68 |
+
check(mv._is_version(good), f"_is_version accepts {good!r}")
|
| 69 |
+
for bad in ("vdraft", "", "1.2", "v1.1.1", "1.2.0-rc1", "latest"):
|
| 70 |
+
check(not mv._is_version(bad), f"_is_version rejects {bad!r}")
|
| 71 |
+
|
| 72 |
+
# ------------------------------------------------------- 2. pin normalization
|
| 73 |
+
section("2. Pin normalization")
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def _norm(raw):
|
| 77 |
+
try:
|
| 78 |
+
return mv._normalize_requested(raw, RELEASE)
|
| 79 |
+
except EnvironmentError:
|
| 80 |
+
return "RAISE"
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
check(_norm(None) == "RAISE", "unset -> EnvironmentError")
|
| 84 |
+
check(_norm("latest") == RELEASE, "latest -> release version")
|
| 85 |
+
check(_norm("LATEST") == RELEASE, "LATEST is case-insensitive")
|
| 86 |
+
check(_norm(" latest ") == RELEASE, "whitespace is stripped")
|
| 87 |
+
check(_norm("1.1.1") == "1.1.1", "explicit version passes through")
|
| 88 |
+
for bad in ("v1.1.1", "1.2", "", " ", "1.2.0-rc1"):
|
| 89 |
+
check(_norm(bad) == "RAISE", f"malformed pin {bad!r} -> EnvironmentError",
|
| 90 |
+
"previously collapsed to v1.0.0 and could load silently")
|
| 91 |
+
|
| 92 |
+
# The accepted SET is derived from _ANNOTATION_INDEX, so a well-formed version
|
| 93 |
+
# that was never published is refused rather than silently resolved down.
|
| 94 |
+
check(mv._published_versions() ==
|
| 95 |
+
tuple(sorted({v for ks in mv._ANNOTATION_INDEX.values() for vs in ks.values()
|
| 96 |
+
for v in vs}, key=mv._version_tuple)),
|
| 97 |
+
"_published_versions is derived from _ANNOTATION_INDEX")
|
| 98 |
+
for v in mv._published_versions():
|
| 99 |
+
check(_norm(v) == v, f"published version {v!r} is accepted")
|
| 100 |
+
# RE-BASED: 1.3.0 used to be accepted with a warning.
|
| 101 |
+
for unknown in ("1.1.5", "1.0.1", "0.0.0", "1.3.0", "2.0.0", "999.999.999"):
|
| 102 |
+
check(_norm(unknown) == "RAISE",
|
| 103 |
+
f"unpublished version {unknown!r} -> EnvironmentError",
|
| 104 |
+
"would otherwise resolve silently to an older annotation, or to nothing")
|
| 105 |
+
|
| 106 |
+
# The release version must stay acceptable even when nothing is published at it,
|
| 107 |
+
# or a version bump made before any regeneration would break `latest` outright.
|
| 108 |
+
check(mv._normalize_requested("latest", "1.3.0") == "1.3.0",
|
| 109 |
+
"latest still works when the release is ahead of every published annotation")
|
| 110 |
+
check("1.3.0" in mv._acceptable_versions("1.3.0"),
|
| 111 |
+
"the release version is always acceptable")
|
| 112 |
+
check(set(mv._acceptable_versions(RELEASE))
|
| 113 |
+
== set(mv._published_versions()) | {RELEASE},
|
| 114 |
+
"acceptable = published versions + the release")
|
| 115 |
+
|
| 116 |
+
# ------------------------------------------- 3. index / BUILDER_CONFIGS parity
|
| 117 |
+
section("3. Index covers every config (and nothing extra)")
|
| 118 |
+
|
| 119 |
+
configs = mv.MedVision.BUILDER_CONFIGS
|
| 120 |
+
needed = set()
|
| 121 |
+
for c in configs:
|
| 122 |
+
kind = mv._PLAN_KIND_BY_TASKTYPE.get(c.taskType)
|
| 123 |
+
if kind is None:
|
| 124 |
+
check(False, f"taskType {c.taskType!r} missing from _PLAN_KIND_BY_TASKTYPE")
|
| 125 |
+
else:
|
| 126 |
+
needed.add((c.dataset_name, kind))
|
| 127 |
+
|
| 128 |
+
declared = {(ds, k) for ds, kinds in mv._ANNOTATION_INDEX.items() for k in kinds}
|
| 129 |
+
|
| 130 |
+
# The released config list is the oracle, not a hardcoded 922 -- that count also
|
| 131 |
+
# passes if a config is silently renamed.
|
| 132 |
+
_released = {ln.split(",")[0].strip()
|
| 133 |
+
for ln in open(_INFO_CSV, encoding="utf-8") if ln.strip()}
|
| 134 |
+
_built = {c.name for c in configs}
|
| 135 |
+
check(_built == _released,
|
| 136 |
+
f"BUILDER_CONFIGS matches {os.path.basename(_INFO_CSV)} exactly",
|
| 137 |
+
f"only in code: {sorted(_built - _released)[:3]} | "
|
| 138 |
+
f"only in csv: {sorted(_released - _built)[:3]}")
|
| 139 |
+
check(len(configs) == len(_released), f"{len(_released)} BUILDER_CONFIGS",
|
| 140 |
+
f"got {len(configs)}")
|
| 141 |
+
check(len(needed) == 72, "72 (dataset, plan-kind) pairs", f"got {len(needed)}")
|
| 142 |
+
check(len({d for d, _ in needed}) == 30, "30 datasets",
|
| 143 |
+
f"got {len({d for d, _ in needed})}")
|
| 144 |
+
check(not (needed - declared), "every config's pair is declared",
|
| 145 |
+
f"missing: {sorted(needed - declared)}")
|
| 146 |
+
check(not (declared - needed), "no unreachable index entries",
|
| 147 |
+
f"extra: {sorted(declared - needed)}")
|
| 148 |
+
for ds, kinds in mv._ANNOTATION_INDEX.items():
|
| 149 |
+
for kind, versions in kinds.items():
|
| 150 |
+
check(bool(versions) and all(mv._is_version(v) for v in versions),
|
| 151 |
+
f"{ds}/{kind} declares well-formed versions", str(versions))
|
| 152 |
+
check(list(versions) == sorted(versions, key=mv._version_tuple),
|
| 153 |
+
f"{ds}/{kind} versions are ascending", str(versions))
|
| 154 |
+
|
| 155 |
+
# ------------------------------------------------- 4. biometry family hygiene
|
| 156 |
+
section("4. Biometry families are disjoint")
|
| 157 |
+
|
| 158 |
+
tl = {c.dataset_name for c in configs if c.taskType == "Tumor-Lesion-Size"}
|
| 159 |
+
lm = {c.dataset_name for c in configs if c.taskType.startswith("Biometrics-From-Landmarks")}
|
| 160 |
+
check(not (tl & lm), "no dataset carries both biometry families",
|
| 161 |
+
f"overlap: {sorted(tl & lm)}")
|
| 162 |
+
check(tl | lm == set(mv._BIOMETRY_FAMILY), "_BIOMETRY_FAMILY covers exactly the biometry datasets",
|
| 163 |
+
f"symmetric difference: {sorted((tl | lm) ^ set(mv._BIOMETRY_FAMILY))}")
|
| 164 |
+
for ds in tl:
|
| 165 |
+
check(mv._BIOMETRY_FAMILY.get(ds) == "fromSeg", f"{ds} registered as fromSeg")
|
| 166 |
+
for ds in lm:
|
| 167 |
+
check(mv._BIOMETRY_FAMILY.get(ds) == "landmark", f"{ds} registered as landmark")
|
| 168 |
+
# the guard itself
|
| 169 |
+
try:
|
| 170 |
+
mv._check_biometry_family("KiTS23", "Biometrics-From-Landmarks")
|
| 171 |
+
check(False, "family mismatch raises")
|
| 172 |
+
except RuntimeError:
|
| 173 |
+
check(True, "family mismatch raises", "KiTS23 is fromSeg, asked as landmark")
|
| 174 |
+
try:
|
| 175 |
+
mv._check_biometry_family("KiTS23", "Tumor-Lesion-Size")
|
| 176 |
+
check(True, "matching family passes")
|
| 177 |
+
except RuntimeError as e:
|
| 178 |
+
check(False, "matching family passes", str(e))
|
| 179 |
+
|
| 180 |
+
# ------------------------------------------------------- 5. index vs the disk
|
| 181 |
+
section("5. Index reconciles with a real Datasets/ tree")
|
| 182 |
+
|
| 183 |
+
ap = argparse.ArgumentParser()
|
| 184 |
+
ap.add_argument("--datasets-root", default=None)
|
| 185 |
+
args, _ = ap.parse_known_args()
|
| 186 |
+
|
| 187 |
+
if not args.datasets_root:
|
| 188 |
+
print("[SKIP] no --datasets-root given")
|
| 189 |
+
else:
|
| 190 |
+
root = args.datasets_root
|
| 191 |
+
seen = 0
|
| 192 |
+
for ds, kinds in sorted(mv._ANNOTATION_INDEX.items()):
|
| 193 |
+
ddir = os.path.join(root, ds)
|
| 194 |
+
if not os.path.isdir(ddir):
|
| 195 |
+
continue
|
| 196 |
+
for kind, want in kinds.items():
|
| 197 |
+
got = mv._discover_versions(ddir, kind)
|
| 198 |
+
if not got:
|
| 199 |
+
print(f"[SKIP] {ds}/{kind}: not generated yet")
|
| 200 |
+
continue
|
| 201 |
+
seen += 1
|
| 202 |
+
check(list(got) == list(want), f"{ds}/{kind} disk matches index",
|
| 203 |
+
f"disk={got} index={list(want)}")
|
| 204 |
+
print(f" reconciled {seen} pair(s)")
|
| 205 |
+
|
| 206 |
+
# ------------------------------------------------------------ 6. full sweep
|
| 207 |
+
section("6. Full sweep: 950 configs x every pin")
|
| 208 |
+
|
| 209 |
+
EXPECTED = {"1.0.0": (820, 130), "1.1.0": (820, 130), "1.1.1": (820, 130),
|
| 210 |
+
"1.2.0": (950, 0), "latest": (950, 0)}
|
| 211 |
+
|
| 212 |
+
for pin in PINS:
|
| 213 |
+
requested = mv._normalize_requested(pin, RELEASE)
|
| 214 |
+
resolved = unavailable = bad = 0
|
| 215 |
+
for c in configs:
|
| 216 |
+
kind = mv._PLAN_KIND_BY_TASKTYPE[c.taskType]
|
| 217 |
+
decl = mv._declared_versions(c.dataset_name, kind)
|
| 218 |
+
got = mv._resolve(decl, requested)
|
| 219 |
+
if got is None:
|
| 220 |
+
unavailable += 1
|
| 221 |
+
elif got in decl and mv._version_tuple(got) <= mv._version_tuple(requested):
|
| 222 |
+
resolved += 1
|
| 223 |
+
else:
|
| 224 |
+
bad += 1
|
| 225 |
+
want_r, want_u = EXPECTED[pin]
|
| 226 |
+
check(bad == 0, f"pin {pin}: no third outcome", f"invalid={bad}")
|
| 227 |
+
check((resolved, unavailable) == (want_r, want_u),
|
| 228 |
+
f"pin {pin}: {want_r} resolve / {want_u} unavailable",
|
| 229 |
+
f"got {resolved}/{unavailable}")
|
| 230 |
+
|
| 231 |
+
# the headline regression: TL at latest used to hand a non-existent path to
|
| 232 |
+
# _generate_examples and crash at gzip.open()
|
| 233 |
+
for ds in ["BraTS24", "HNTSMRG24", "KiPA22", "KiTS23", "MSD", "autoPET-III"]:
|
| 234 |
+
got = mv._resolve(mv._declared_versions(ds, "biometry"), RELEASE)
|
| 235 |
+
check(got == "1.1.1", f"{ds} biometry at latest -> 1.1.1", f"got {got}")
|
| 236 |
+
|
| 237 |
+
# new datasets are unreachable below 1.2.0, and that must be an explicit refusal
|
| 238 |
+
for ds in ["AFIDs", "DEEP-PSMA", "LIDC-IDRI", "LNQ2023", "MAMA-MIA", "PDDCA",
|
| 239 |
+
"PI-CAI", "VerSe"]:
|
| 240 |
+
kinds = mv._ANNOTATION_INDEX[ds]
|
| 241 |
+
for kind in kinds:
|
| 242 |
+
check(mv._resolve(mv._declared_versions(ds, kind), "1.1.1") is None,
|
| 243 |
+
f"{ds}/{kind} unavailable at 1.1.1")
|
| 244 |
+
check(mv._resolve(mv._declared_versions(ds, kind), "1.2.0") == "1.2.0",
|
| 245 |
+
f"{ds}/{kind} resolves at 1.2.0")
|
| 246 |
+
|
| 247 |
+
# ------------------------------------------------------- 7. download decision
|
| 248 |
+
section("7. Download decision")
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
def needs_download(declared, local_versions, requested, force=False, tracker="1.0.0"):
|
| 252 |
+
"""Drive the REAL predicate, mv._download_needed, not a copy of it.
|
| 253 |
+
|
| 254 |
+
Only the two resolutions are done here, exactly as _split_generators does
|
| 255 |
+
them. `tracker` is the `dataset_<name>` entry of .downloaded_datasets.json,
|
| 256 |
+
written only after the images land; None means "no completed install".
|
| 257 |
+
|
| 258 |
+
This used to re-implement the predicate, which meant every row below could
|
| 259 |
+
stay green while the shipped decision was broken.
|
| 260 |
+
"""
|
| 261 |
+
target = mv._resolve(declared, requested)
|
| 262 |
+
local = mv._resolve(local_versions, requested)
|
| 263 |
+
return mv._download_needed(force, tracker, local, target)
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
KITS_BIO = ("1.0.0", "1.1.0", "1.1.1")
|
| 267 |
+
ACDC_SEG = ("1.0.0",)
|
| 268 |
+
|
| 269 |
+
# (declared, on-disk, pin, force, tracker, expect_download, description)
|
| 270 |
+
DL_CASES = [
|
| 271 |
+
(ACDC_SEG, (), "1.2.0", False, None, True, "first-time download"),
|
| 272 |
+
(ACDC_SEG, ("1.0.0",), "1.2.0", False, "1.0.0", False,
|
| 273 |
+
"unchanged dataset at latest -> SKIP (was a ~28 GiB re-download)"),
|
| 274 |
+
(KITS_BIO, ("1.0.0",), "1.1.1", False, "1.0.0", True,
|
| 275 |
+
"v1.0.0-era copy, pin 1.1.1 -> DOWNLOAD (glob-only would skip: regression guard)"),
|
| 276 |
+
(KITS_BIO, KITS_BIO, "1.0.0", False, "1.1.1", False,
|
| 277 |
+
"downgrade with cumulative zip on disk -> SKIP"),
|
| 278 |
+
(KITS_BIO, KITS_BIO, "1.1.1", False, "1.1.1", False, "already current -> SKIP"),
|
| 279 |
+
(KITS_BIO, ("1.0.0",), "1.0.0", False, "1.0.0", False,
|
| 280 |
+
"pin matches what is on disk -> SKIP"),
|
| 281 |
+
(ACDC_SEG, ("1.0.0",), "1.2.0", True, "1.0.0", True, "force_download_data overrides"),
|
| 282 |
+
(KITS_BIO, (), "1.1.1", False, "1.1.1", True, "plans deleted -> DOWNLOAD"),
|
| 283 |
+
# a tracker entry recording a version the dataset does not possess must not
|
| 284 |
+
# suppress a download the disk says is needed
|
| 285 |
+
(KITS_BIO, ("1.0.0",), "1.1.1", False, "1.2.0", True,
|
| 286 |
+
"poisoned tracker entry cannot suppress a needed download (self-heal)"),
|
| 287 |
+
(KITS_BIO + ("1.3.0",), KITS_BIO, "1.3.0", False, "1.1.1", True,
|
| 288 |
+
"future regeneration -> DOWNLOAD"),
|
| 289 |
+
# REGRESSION GUARD (audit finding 1, high): the annotation plans are extracted
|
| 290 |
+
# at step 3.1, BEFORE the images (3.2) and the RAS+ reorientation (3.3). A run
|
| 291 |
+
# that dies in between leaves plans with no images and no tracker entry. Judged
|
| 292 |
+
# on the plans alone that state looks complete, the images are never fetched,
|
| 293 |
+
# and the loader yields rows whose image paths do not exist.
|
| 294 |
+
(KITS_BIO, KITS_BIO, "1.1.1", False, None, True,
|
| 295 |
+
"plans present but install never completed -> DOWNLOAD (interrupted-download guard)"),
|
| 296 |
+
(ACDC_SEG, ("1.0.0",), "1.0.0", False, None, True,
|
| 297 |
+
"same, for a single-version dataset"),
|
| 298 |
+
# legacy boolean entries mean a completed install under the old scheme
|
| 299 |
+
(ACDC_SEG, ("1.0.0",), "1.2.0", False, True, False,
|
| 300 |
+
"legacy boolean tracker entry counts as complete -> SKIP"),
|
| 301 |
+
]
|
| 302 |
+
for declared, local, pin, force, tracker, want, desc in DL_CASES:
|
| 303 |
+
got = needs_download(declared, local, pin, force, tracker)
|
| 304 |
+
check(got == want, desc, f"download={got}, expected={want}")
|
| 305 |
+
|
| 306 |
+
# ------------------------------------------- 8. glob robustness in the data dir
|
| 307 |
+
section("8. _discover_versions survives glob metacharacters in the path")
|
| 308 |
+
|
| 309 |
+
_probe = tempfile.mkdtemp(prefix="medvision_glob_probe_")
|
| 310 |
+
for tag in ["plain", "med[v2]", "st*ar", "que?ry", "a*b[c]?d"]:
|
| 311 |
+
ddir = os.path.join(_probe, tag, "KiTS23")
|
| 312 |
+
os.makedirs(ddir, exist_ok=True)
|
| 313 |
+
for v in ("1.0.0", "1.1.0", "1.1.1"):
|
| 314 |
+
open(os.path.join(ddir, f"benchmark_plan_biometry_v{v}.json.gz"), "w").close()
|
| 315 |
+
open(os.path.join(ddir, "benchmark_plan_biometry_vdraft.json.gz"), "w").close()
|
| 316 |
+
got = mv._discover_versions(ddir, "biometry")
|
| 317 |
+
check(got == ["1.0.0", "1.1.0", "1.1.1"],
|
| 318 |
+
f"data dir containing {tag!r} discovers all versions", f"got {got}")
|
| 319 |
+
shutil.rmtree(_probe, ignore_errors=True)
|
| 320 |
+
|
| 321 |
+
# ------------------------------------ 9. fingerprint token vs. what is loaded
|
| 322 |
+
section("9. create_config_id token matches the version actually loaded")
|
| 323 |
+
|
| 324 |
+
_by_name = {c.name: c for c in configs}
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
def _token(config_name, pin):
|
| 328 |
+
"""The fingerprint token MedVisionConfig hands to its parent.
|
| 329 |
+
|
| 330 |
+
Intercepts BuilderConfig.create_config_id rather than reading the return
|
| 331 |
+
value, so this works whether the real `datasets` is installed (the parent
|
| 332 |
+
returns a hashed string) or the stub above is in use. Reading the return
|
| 333 |
+
value only worked under the stub.
|
| 334 |
+
"""
|
| 335 |
+
if pin is None:
|
| 336 |
+
os.environ.pop("MedVision_PLANNER_VERSION", None)
|
| 337 |
+
else:
|
| 338 |
+
os.environ["MedVision_PLANNER_VERSION"] = pin
|
| 339 |
+
cfg = _by_name[config_name]
|
| 340 |
+
parent = type(cfg).__mro__[1] # BuilderConfig
|
| 341 |
+
orig = parent.create_config_id
|
| 342 |
+
parent.create_config_id = (
|
| 343 |
+
lambda self, config_kwargs, custom_features=None: dict(config_kwargs or {})
|
| 344 |
+
)
|
| 345 |
+
try:
|
| 346 |
+
return cfg.create_config_id({})["planner_version"]
|
| 347 |
+
finally:
|
| 348 |
+
parent.create_config_id = orig
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
_KITS = "KiTS23_TumorLesionSize_Task01_Axial_Test"
|
| 352 |
+
_ACDC = "ACDC_MaskSize_Task01_Axial_Test"
|
| 353 |
+
|
| 354 |
+
# The token is "<resolved annotation version>-<8 hex of the canonical data root>".
|
| 355 |
+
# The version prefix must stay readable in the cache path; the root suffix is what
|
| 356 |
+
# stops two data roots from sharing one cache (see the guards further down).
|
| 357 |
+
def _ver(config_name, pin):
|
| 358 |
+
return _token(config_name, pin).rsplit("-", 1)[0]
|
| 359 |
+
|
| 360 |
+
|
| 361 |
+
check(_ver(_ACDC, "1.0.0") == "1.0.0", "pin 1.0.0 -> resolved version in the token")
|
| 362 |
+
check(_ver(_ACDC, "latest") == "1.0.0", "latest on an unchanged dataset -> resolved version")
|
| 363 |
+
check(_ver(_KITS, "latest") == "1.1.1", "latest on a TL dataset -> resolved version")
|
| 364 |
+
check(_ver(_ACDC, None) == "unset", "unset is preserved as the version part")
|
| 365 |
+
check(_token(_ACDC, "1.1.1") == _token(_ACDC, "latest") == _token(_ACDC, "1.0.0"),
|
| 366 |
+
"pins selecting the same plan share one cache key")
|
| 367 |
+
check(re.fullmatch(r"1\.0\.0-[0-9a-f]{8}", _token(_ACDC, "latest")) is not None,
|
| 368 |
+
"token shape is <version>-<8 hex>", _token(_ACDC, "latest"))
|
| 369 |
+
|
| 370 |
+
# REGRESSION GUARD (audit finding 2): _normalize_requested strips whitespace, so a
|
| 371 |
+
# padded pin loads normally. If create_config_id does not strip identically, the
|
| 372 |
+
# token reverts to the raw request string -- the request-keyed fingerprint this
|
| 373 |
+
# change exists to remove -- and identical data lands in a second cache directory.
|
| 374 |
+
for pin, base in [("latest", _KITS), ("1.1.1", _KITS), ("1.2.0", _ACDC), ("1.0.0", _ACDC)]:
|
| 375 |
+
plain = _token(base, pin)
|
| 376 |
+
for padded in (f" {pin}", f"{pin} ", f"\t{pin}", f"{pin}\n"):
|
| 377 |
+
got = _token(base, padded)
|
| 378 |
+
check(got == plain, f"padded pin {padded!r} yields the same token as {pin!r}",
|
| 379 |
+
f"got {got!r}, expected {plain!r}")
|
| 380 |
+
# and the loader must agree it is the same request
|
| 381 |
+
check(mv._normalize_requested(padded, RELEASE)
|
| 382 |
+
== mv._normalize_requested(pin, RELEASE),
|
| 383 |
+
f"_normalize_requested agrees for {padded!r}")
|
| 384 |
+
os.environ.pop("MedVision_PLANNER_VERSION", None)
|
| 385 |
+
|
| 386 |
+
# ------------------------------------ 10. step 3.2 cannot fake a completed install
|
| 387 |
+
section("10. Step 3.2 never swallows a failure into a completion marker")
|
| 388 |
+
|
| 389 |
+
# The tracker entry written at step 3.4 is the "install completed" marker that the
|
| 390 |
+
# download predicate tests for presence. It is only trustworthy if a failed image
|
| 391 |
+
# download (3.2) can never reach 3.4. These assertions are structural on purpose:
|
| 392 |
+
# they hold regardless of which exception a download script happens to raise.
|
| 393 |
+
_src = open(_MEDVISION_PY, encoding="utf-8").read()
|
| 394 |
+
_tree = ast.parse(_src)
|
| 395 |
+
|
| 396 |
+
|
| 397 |
+
def _dl_calls(node):
|
| 398 |
+
return [
|
| 399 |
+
n for n in ast.walk(node)
|
| 400 |
+
if isinstance(n, ast.Call) and isinstance(n.func, ast.Attribute)
|
| 401 |
+
and n.func.attr == "download_and_extract"
|
| 402 |
+
]
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
_tries = [t for t in ast.walk(_tree) if isinstance(t, ast.Try) and _dl_calls(t)]
|
| 406 |
+
check(bool(_tries), "found the step-3.2 try block")
|
| 407 |
+
_step32 = max(_tries, key=lambda t: t.end_lineno - t.lineno)
|
| 408 |
+
|
| 409 |
+
# A bare `except:` used to re-call download_and_extract, re-running a multi-GB
|
| 410 |
+
# transfer on ANY failure -- including a Ctrl-C, which it swallowed.
|
| 411 |
+
check(len(_dl_calls(_step32)) == 1,
|
| 412 |
+
"download_and_extract is invoked exactly once (no blind retry)",
|
| 413 |
+
f"found {len(_dl_calls(_step32))} call site(s)")
|
| 414 |
+
|
| 415 |
+
_broad = [
|
| 416 |
+
ast.unparse(h.type) if h.type else "bare except"
|
| 417 |
+
for t in ast.walk(_step32) if isinstance(t, ast.Try)
|
| 418 |
+
for h in t.handlers
|
| 419 |
+
if h.type is None
|
| 420 |
+
or (isinstance(h.type, ast.Name) and h.type.id in ("BaseException", "Exception"))
|
| 421 |
+
]
|
| 422 |
+
check(not _broad, "nothing around step 3.2 catches BaseException (Ctrl-C aborts)",
|
| 423 |
+
f"found {_broad}")
|
| 424 |
+
|
| 425 |
+
# Any except clause here would let a failed download fall through to 3.3/3.4 and
|
| 426 |
+
# stamp the completion marker onto a dataset with no images.
|
| 427 |
+
check(_step32.handlers == [],
|
| 428 |
+
"step 3.2 has no except clause, so a failed download cannot reach the 3.4 marker",
|
| 429 |
+
f"handlers: {[ast.unparse(h.type) if h.type else 'bare' for h in _step32.handlers]}")
|
| 430 |
+
|
| 431 |
+
# The signature pre-check must select kwargs correctly for both conventions, and
|
| 432 |
+
# must not wrap the transfer itself.
|
| 433 |
+
def _pick(fn):
|
| 434 |
+
kw = {"max_workers": 4}
|
| 435 |
+
try:
|
| 436 |
+
inspect.signature(fn).bind("d", "n", **kw)
|
| 437 |
+
except TypeError:
|
| 438 |
+
kw = {}
|
| 439 |
+
return kw
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
check(_pick(lambda dataset_dir, dataset_name, **kw: None) == {"max_workers": 4},
|
| 443 |
+
"script accepting **kwargs is called WITH max_workers")
|
| 444 |
+
check(_pick(lambda dataset_dir, dataset_name, max_workers=1: None) == {"max_workers": 4},
|
| 445 |
+
"script declaring max_workers explicitly is called WITH it")
|
| 446 |
+
check(_pick(lambda dataset_dir, dataset_name: None) == {},
|
| 447 |
+
"legacy script without max_workers is called WITHOUT it")
|
| 448 |
+
|
| 449 |
+
|
| 450 |
+
def _raiser(dataset_dir, dataset_name, **kw):
|
| 451 |
+
raise ConnectionError("simulated network drop mid-transfer")
|
| 452 |
+
|
| 453 |
+
|
| 454 |
+
try:
|
| 455 |
+
_f = _raiser
|
| 456 |
+
_kw = _pick(_f)
|
| 457 |
+
_f("d", "n", **_kw)
|
| 458 |
+
check(False, "a failing download propagates rather than being swallowed")
|
| 459 |
+
except ConnectionError:
|
| 460 |
+
check(True, "a failing download propagates rather than being swallowed",
|
| 461 |
+
"so 3.3/3.4 never run and no completion marker is written")
|
| 462 |
+
|
| 463 |
+
# --------------------------------- 11. the data root is part of the cache identity
|
| 464 |
+
section("11. Two data roots never share one Arrow cache")
|
| 465 |
+
|
| 466 |
+
# Every row's image_file/mask_file/landmark_file is os.path.join(dataset_dir, ...),
|
| 467 |
+
# rooted at MedVision_DATA_DIR, so the root changes what the rows SAY. Before it was
|
| 468 |
+
# folded into the token, two runs differing only in data root produced a byte-identical
|
| 469 |
+
# config_id -> cache hit -> _split_generators never ran -> nothing downloaded into the
|
| 470 |
+
# new root and the rows pointed into the old one.
|
| 471 |
+
_saved_root = os.environ.get("MedVision_DATA_DIR")
|
| 472 |
+
|
| 473 |
+
|
| 474 |
+
def _token_at(config_name, root, pin="latest"):
|
| 475 |
+
os.environ["MedVision_DATA_DIR"] = root
|
| 476 |
+
return _token(config_name, pin)
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
try:
|
| 480 |
+
_tA = _token_at(_ACDC, "/tmp/mv-rootA")
|
| 481 |
+
check(_tA != _token_at(_ACDC, "/tmp/mv-rootB"),
|
| 482 |
+
"different data roots -> different cache ids", f"both {_tA}")
|
| 483 |
+
check(_tA == _token_at(_ACDC, "/tmp/mv-rootA/") == _token_at(_ACDC, "/tmp/./mv-rootA"),
|
| 484 |
+
"non-canonical spellings of one root share one cache id")
|
| 485 |
+
check(_token_at(_KITS, "/tmp/mv-rootA", "1.1.1")
|
| 486 |
+
== _token_at(_KITS, "/tmp/mv-rootA", "latest"),
|
| 487 |
+
"for a fixed root, pins selecting the same plan still share one key")
|
| 488 |
+
check(_tA.startswith("1.0.0-"), "resolved annotation version stays readable in the id", _tA)
|
| 489 |
+
finally:
|
| 490 |
+
if _saved_root is None:
|
| 491 |
+
os.environ.pop("MedVision_DATA_DIR", None)
|
| 492 |
+
else:
|
| 493 |
+
os.environ["MedVision_DATA_DIR"] = _saved_root
|
| 494 |
+
os.environ.pop("MedVision_PLANNER_VERSION", None)
|
| 495 |
+
|
| 496 |
+
# ------------------------------- 12. a relative data root survives the download scripts
|
| 497 |
+
section("12. The data root is canonicalised before the download scripts see it")
|
| 498 |
+
|
| 499 |
+
# MedVision.py chdirs into dataset_dir, then hands that same path to the dataset's
|
| 500 |
+
# download script, which begins with its own os.chdir(dataset_dir). A relative root
|
| 501 |
+
# makes the second chdir resolve against the first one's result and fail -- for all
|
| 502 |
+
# 30 datasets, so nothing could be downloaded at all.
|
| 503 |
+
_saved_root, _cwd0 = os.environ.get("MedVision_DATA_DIR"), os.getcwd()
|
| 504 |
+
_probe = tempfile.mkdtemp(prefix="medvision_relroot_")
|
| 505 |
+
try:
|
| 506 |
+
os.chdir(_probe)
|
| 507 |
+
os.environ["MedVision_DATA_DIR"] = "relroot"
|
| 508 |
+
check(os.path.isabs(mv._data_root()), "_data_root() is absolute for a relative env value",
|
| 509 |
+
mv._data_root())
|
| 510 |
+
_d = os.path.join(mv._data_root(), "Datasets", "PDDCA")
|
| 511 |
+
os.makedirs(_d, exist_ok=True)
|
| 512 |
+
os.chdir(_d) # what _split_generators does
|
| 513 |
+
try:
|
| 514 |
+
os.chdir(_d) # what the download script then does
|
| 515 |
+
check(True, "dataset_dir survives the download script's own chdir(dataset_dir)")
|
| 516 |
+
except FileNotFoundError as e:
|
| 517 |
+
check(False, "dataset_dir survives the download script's own chdir(dataset_dir)", str(e))
|
| 518 |
+
os.chdir(_probe)
|
| 519 |
+
for blank in ("", " "):
|
| 520 |
+
os.environ["MedVision_DATA_DIR"] = blank
|
| 521 |
+
try:
|
| 522 |
+
mv._data_root()
|
| 523 |
+
check(False, f"blank data root {blank!r} is rejected, not resolved to cwd")
|
| 524 |
+
except ValueError:
|
| 525 |
+
check(True, f"blank data root {blank!r} is rejected, not resolved to cwd")
|
| 526 |
+
check(mv._data_root(strict=False) == "",
|
| 527 |
+
f"strict=False returns empty for {blank!r} instead of raising")
|
| 528 |
+
# structural: _split_generators must not read the env var raw again
|
| 529 |
+
_sg = next(n for n in ast.walk(_tree)
|
| 530 |
+
if isinstance(n, ast.FunctionDef) and n.name == "_split_generators")
|
| 531 |
+
_asg = [ast.unparse(a) for a in ast.walk(_sg) if isinstance(a, ast.Assign)
|
| 532 |
+
and any(isinstance(t, ast.Name) and t.id == "MedVision_data_dir" for t in a.targets)]
|
| 533 |
+
check(_asg == ["MedVision_data_dir = _data_root()"],
|
| 534 |
+
"_split_generators takes the data root from _data_root()", f"got {_asg}")
|
| 535 |
+
finally:
|
| 536 |
+
os.chdir(_cwd0)
|
| 537 |
+
if _saved_root is None:
|
| 538 |
+
os.environ.pop("MedVision_DATA_DIR", None)
|
| 539 |
+
else:
|
| 540 |
+
os.environ["MedVision_DATA_DIR"] = _saved_root
|
| 541 |
+
shutil.rmtree(_probe, ignore_errors=True)
|
| 542 |
+
|
| 543 |
+
# ------------------------- 13. the annotation zip has an owner across processes
|
| 544 |
+
section("13. Step 3.1 owns the shared annotation zip under a per-dataset lock")
|
| 545 |
+
|
| 546 |
+
# Datasets/<name>.zip is one shared path per dataset. HF's builder lock is per CONFIG
|
| 547 |
+
# (Train and Test of one task are two configs), so two concurrent preparations of the
|
| 548 |
+
# same dataset both downloaded, both extractall'd into one tree, and the second
|
| 549 |
+
# os.remove died with a bare FileNotFoundError.
|
| 550 |
+
_dl_block = next(
|
| 551 |
+
n for n in ast.walk(_tree)
|
| 552 |
+
if isinstance(n, ast.If)
|
| 553 |
+
and isinstance(n.test, ast.Name) and n.test.id == "_needs_download"
|
| 554 |
+
)
|
| 555 |
+
_removes = [n for n in ast.walk(_dl_block)
|
| 556 |
+
if isinstance(n, ast.Call) and isinstance(n.func, ast.Attribute)
|
| 557 |
+
and n.func.attr == "remove"]
|
| 558 |
+
check(len(_removes) == 1, "exactly one os.remove of the zip", f"found {len(_removes)}")
|
| 559 |
+
|
| 560 |
+
_withs = [w for w in ast.walk(_dl_block) if isinstance(w, ast.With)]
|
| 561 |
+
_locked = [
|
| 562 |
+
w for w in _withs
|
| 563 |
+
if any(isinstance(i.context_expr, ast.Call)
|
| 564 |
+
and isinstance(i.context_expr.func, ast.Name)
|
| 565 |
+
and i.context_expr.func.id == "FileLock"
|
| 566 |
+
for i in w.items)
|
| 567 |
+
]
|
| 568 |
+
check(bool(_locked), "the download block acquires a FileLock")
|
| 569 |
+
# the remove, the extract and the snapshot_download must all sit INSIDE that lock
|
| 570 |
+
_lock = _locked[0]
|
| 571 |
+
for attr, what in (("remove", "os.remove"), ("extractall", "extractall")):
|
| 572 |
+
inside = [n for n in ast.walk(_lock)
|
| 573 |
+
if isinstance(n, ast.Call) and isinstance(n.func, ast.Attribute)
|
| 574 |
+
and n.func.attr == attr]
|
| 575 |
+
check(bool(inside), f"{what} is inside the per-dataset lock")
|
| 576 |
+
_snap = [n for n in ast.walk(_lock)
|
| 577 |
+
if isinstance(n, ast.Call) and isinstance(n.func, ast.Name)
|
| 578 |
+
and n.func.id == "snapshot_download"]
|
| 579 |
+
check(bool(_snap), "snapshot_download is inside the per-dataset lock")
|
| 580 |
+
# and the lock must be re-checking, so the waiter skips instead of repeating the work
|
| 581 |
+
_resolves_in_lock = [n for n in ast.walk(_lock)
|
| 582 |
+
if isinstance(n, ast.Call) and isinstance(n.func, ast.Name)
|
| 583 |
+
and n.func.id == "_resolve"]
|
| 584 |
+
check(bool(_resolves_in_lock),
|
| 585 |
+
"the lock re-checks resolution so a waiter skips the redundant download")
|
| 586 |
+
|
| 587 |
+
# REGRESSION GUARD: the in-lock re-check must not swallow force_download_data.
|
| 588 |
+
# A plan rewritten in place at the same version is already >= _target, so without
|
| 589 |
+
# this the documented remediation (MedVision_FORCE_DOWNLOAD_DATA=True to refresh a
|
| 590 |
+
# stale annotation) re-fetches the images and keeps the stale plan.
|
| 591 |
+
_lock_guard = next((n for n in ast.walk(_lock) if isinstance(n, ast.If)), None)
|
| 592 |
+
check(_lock_guard is not None, "the lock has a skip guard")
|
| 593 |
+
_guard_src = ast.unparse(_lock_guard.test) if _lock_guard is not None else ""
|
| 594 |
+
check("force_download_data" in _guard_src,
|
| 595 |
+
"the in-lock skip guard honours force_download_data", _guard_src)
|
| 596 |
+
|
| 597 |
+
# ------------------------------------------------------------------ summary
|
| 598 |
+
print()
|
| 599 |
+
failures = _results.count(False)
|
| 600 |
+
if failures:
|
| 601 |
+
print(f"{failures} of {len(_results)} check(s) FAILED.")
|
| 602 |
+
sys.exit(1)
|
| 603 |
+
print(f"All {len(_results)} checks passed.")
|
|
@@ -1,33 +1,28 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""Unit test for the annotation acknowledgement gate (`_enforce_release_ack`).
|
| 3 |
|
| 4 |
-
Selecting an annotation version older than the
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
Run: python scripts/test_tl_ack_gate.py
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
instead.
|
| 13 |
"""
|
| 14 |
-
import importlib.util
|
| 15 |
import os
|
| 16 |
import sys
|
| 17 |
-
import tempfile
|
| 18 |
-
|
| 19 |
-
# MedVision.py raises at import time if MedVision_DATA_DIR is unset; point it at
|
| 20 |
-
# a throwaway dir so the import succeeds (the gate never touches the filesystem).
|
| 21 |
-
os.environ.setdefault(
|
| 22 |
-
"MedVision_DATA_DIR", tempfile.mkdtemp(prefix="medvision_ack_test_")
|
| 23 |
-
)
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
| 29 |
-
mv = importlib.util.module_from_spec(spec)
|
| 30 |
-
spec.loader.exec_module(mv)
|
| 31 |
|
| 32 |
enforce = mv._enforce_release_ack
|
| 33 |
# Arbitrary "latest" for the logic test — the gate compares the selected version
|
|
@@ -59,9 +54,77 @@ CASES = [
|
|
| 59 |
]
|
| 60 |
|
| 61 |
failures = 0
|
|
|
|
| 62 |
for planner_version, latest_version, ack, expect_raise, desc in CASES:
|
| 63 |
got_raise = _run(planner_version, latest_version, ack)
|
| 64 |
ok = got_raise == expect_raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
print(
|
| 66 |
f"[{'PASS' if ok else 'FAIL'}] {desc} "
|
| 67 |
f"(raised={got_raise}, expected={expect_raise})"
|
|
@@ -73,4 +136,4 @@ print()
|
|
| 73 |
if failures:
|
| 74 |
print(f"{failures} case(s) failed.")
|
| 75 |
sys.exit(1)
|
| 76 |
-
print(f"All {
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""Unit test for the annotation acknowledgement gate (`_enforce_release_ack`).
|
| 3 |
|
| 4 |
+
Selecting an annotation version older than the newest one PUBLISHED FOR THAT
|
| 5 |
+
(dataset, plan-kind) raises EnvironmentError unless `MedVision_ACK_RELEASE`
|
| 6 |
+
equals the repo's release version; the current (or newer) version passes
|
| 7 |
+
unconditionally. The gate applies to every task.
|
| 8 |
+
|
| 9 |
+
Comparing per pair rather than against the release version is what keeps a
|
| 10 |
+
release that did not regenerate a dataset from blocking it, while the
|
| 11 |
+
acknowledgement value stays the release version so a bump still invalidates
|
| 12 |
+
old acknowledgements.
|
| 13 |
|
| 14 |
Run: python scripts/test_tl_ack_gate.py
|
| 15 |
|
| 16 |
+
The shared bootstrap in scripts/_medvision_test_support.py stubs `datasets`
|
| 17 |
+
when it is unavailable, so this runs anywhere.
|
|
|
|
| 18 |
"""
|
|
|
|
| 19 |
import os
|
| 20 |
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
| 23 |
+
import _medvision_test_support as _support # noqa: E402
|
| 24 |
|
| 25 |
+
mv = _support.load_loader("medvision_ack_test_")
|
|
|
|
|
|
|
| 26 |
|
| 27 |
enforce = mv._enforce_release_ack
|
| 28 |
# Arbitrary "latest" for the logic test — the gate compares the selected version
|
|
|
|
| 54 |
]
|
| 55 |
|
| 56 |
failures = 0
|
| 57 |
+
total = 0
|
| 58 |
for planner_version, latest_version, ack, expect_raise, desc in CASES:
|
| 59 |
got_raise = _run(planner_version, latest_version, ack)
|
| 60 |
ok = got_raise == expect_raise
|
| 61 |
+
total += 1
|
| 62 |
+
print(
|
| 63 |
+
f"[{'PASS' if ok else 'FAIL'}] {desc} "
|
| 64 |
+
f"(raised={got_raise}, expected={expect_raise})"
|
| 65 |
+
)
|
| 66 |
+
if not ok:
|
| 67 |
+
failures += 1
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
# --- per-(dataset, plan-kind) triggering -----------------------------------
|
| 71 |
+
# The gate is handed the newest version published FOR THE PAIR being loaded,
|
| 72 |
+
# and acknowledges against the repo release. This is what makes a purely
|
| 73 |
+
# additive release non-breaking for datasets it did not touch.
|
| 74 |
+
RELEASE = "1.2.0"
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def _run_pair(planner_version, dataset_name, kind, ack):
|
| 78 |
+
if ack is None:
|
| 79 |
+
os.environ.pop("MedVision_ACK_RELEASE", None)
|
| 80 |
+
else:
|
| 81 |
+
os.environ["MedVision_ACK_RELEASE"] = ack
|
| 82 |
+
try:
|
| 83 |
+
enforce(
|
| 84 |
+
planner_version,
|
| 85 |
+
mv._newest_declared(dataset_name, kind),
|
| 86 |
+
ack_value=RELEASE,
|
| 87 |
+
dataset_name=dataset_name,
|
| 88 |
+
plan_kind=kind,
|
| 89 |
+
)
|
| 90 |
+
return False
|
| 91 |
+
except EnvironmentError:
|
| 92 |
+
return True
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
# (planner_version, dataset, kind, ack, expect_raise, description)
|
| 96 |
+
PAIR_CASES = [
|
| 97 |
+
("1.1.1", "ACDC", "segmentation", None, False,
|
| 98 |
+
"pin 1.1.1 on a dataset whose newest is 1.0.0 -> pass (was blocked)"),
|
| 99 |
+
("1.1.1", "KiTS23", "biometry", None, False,
|
| 100 |
+
"pin 1.1.1 on a pair whose newest is 1.1.1 -> pass (was blocked)"),
|
| 101 |
+
("1.0.0", "ACDC", "segmentation", None, False,
|
| 102 |
+
"pin 1.0.0 on a never-regenerated pair -> pass"),
|
| 103 |
+
("1.1.0", "KiTS23", "biometry", None, True,
|
| 104 |
+
"pin 1.1.0 on a pair whose newest is 1.1.1 -> block"),
|
| 105 |
+
("1.1.0", "KiTS23", "biometry", RELEASE, False,
|
| 106 |
+
"acknowledged with the release value (blanket, composes across a sweep) -> pass"),
|
| 107 |
+
# RE-BASED: this used to assert the pair's newest was REJECTED. Both values are
|
| 108 |
+
# now accepted -- they acknowledge different things and both are legitimate.
|
| 109 |
+
("1.1.0", "KiTS23", "biometry", "1.1.1", False,
|
| 110 |
+
"acknowledged with the pair's newest (the number the error shows) -> pass"),
|
| 111 |
+
("1.1.0", "KiTS23", "biometry", "1.1.0", True,
|
| 112 |
+
"the pin itself is not an acknowledgement -> block"),
|
| 113 |
+
("1.1.0", "KiTS23", "biometry", "1.0.0", True,
|
| 114 |
+
"an unrelated version is not an acknowledgement -> block"),
|
| 115 |
+
("1.1.0", "ACDC", "segmentation", "1.1.1", False,
|
| 116 |
+
"ACDC's newest is 1.0.0, so 1.1.0 is not behind it -> passes before any ack"),
|
| 117 |
+
("1.2.0", "KiTS23", "biometry", None, False, "pin at release -> pass"),
|
| 118 |
+
("latest", "KiTS23", "biometry", None, True,
|
| 119 |
+
"the literal 'latest' never reaches the gate; _normalize_requested "
|
| 120 |
+
"resolves it first, so an unresolved value is correctly treated as stale"),
|
| 121 |
+
]
|
| 122 |
+
|
| 123 |
+
print()
|
| 124 |
+
for planner_version, dataset_name, kind, ack, expect_raise, desc in PAIR_CASES:
|
| 125 |
+
got_raise = _run_pair(planner_version, dataset_name, kind, ack)
|
| 126 |
+
ok = got_raise == expect_raise
|
| 127 |
+
total += 1
|
| 128 |
print(
|
| 129 |
f"[{'PASS' if ok else 'FAIL'}] {desc} "
|
| 130 |
f"(raised={got_raise}, expected={expect_raise})"
|
|
|
|
| 136 |
if failures:
|
| 137 |
print(f"{failures} case(s) failed.")
|
| 138 |
sys.exit(1)
|
| 139 |
+
print(f"All {total} cases passed.")
|
|
@@ -1 +1 @@
|
|
| 1 |
-
__version__ = "1.
|
|
|
|
| 1 |
+
__version__ = "1.2.0"
|
|
File without changes
|
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import zipfile
|
| 6 |
+
from huggingface_hub import snapshot_download
|
| 7 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# ====================================
|
| 11 |
+
# Dataset Info [!]
|
| 12 |
+
# ====================================
|
| 13 |
+
# Dataset: AFIDs (Anatomical Fiducials)
|
| 14 |
+
# Website: https://github.com/afids/afids-data
|
| 15 |
+
# Official Release (OpenNeuro): ds004470 (SNSX) + ds004471 (LHSCPD); imaging CC0, landmarks CC BY 4.0
|
| 16 |
+
# HF Release: https://huggingface.co/datasets/YongchengYAO/AFIDs
|
| 17 |
+
# Format: nii.gz
|
| 18 |
+
# ====================================
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 23 |
+
"""
|
| 24 |
+
Download and extract the AFIDs dataset from the HuggingFace mirror.
|
| 25 |
+
|
| 26 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 27 |
+
the other arguments must be kwargs
|
| 28 |
+
"""
|
| 29 |
+
# Download files
|
| 30 |
+
current_dir = os.getcwd()
|
| 31 |
+
os.chdir(dataset_dir)
|
| 32 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 33 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 34 |
+
os.chdir(tmp_dir)
|
| 35 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 36 |
+
|
| 37 |
+
# ====================================
|
| 38 |
+
# Add download logic here [!]
|
| 39 |
+
# ====================================
|
| 40 |
+
# Download dataset (image + mask archives, sharded as data-part*.zip)
|
| 41 |
+
snapshot_download(
|
| 42 |
+
repo_id="YongchengYAO/AFIDs-Lite",
|
| 43 |
+
allow_patterns="*.zip",
|
| 44 |
+
repo_type="dataset",
|
| 45 |
+
revision="c6b5568bd8a151d5904a03ed2cad20de2138f827", # squashed single commit, 2026-07-27
|
| 46 |
+
local_dir=".",
|
| 47 |
+
max_workers=kwargs.get("max_workers", 1),
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
# Extract all zip files
|
| 51 |
+
for zip_file in sorted(glob.glob("*.zip")):
|
| 52 |
+
print(f"extracting {zip_file}")
|
| 53 |
+
with zipfile.ZipFile(zip_file, "r") as zip_ref:
|
| 54 |
+
zip_ref.extractall(".")
|
| 55 |
+
os.remove(zip_file)
|
| 56 |
+
print(f"{zip_file} deleted")
|
| 57 |
+
|
| 58 |
+
# Move folder to dataset_dir
|
| 59 |
+
folders_to_move = [
|
| 60 |
+
"Images",
|
| 61 |
+
]
|
| 62 |
+
for folder in folders_to_move:
|
| 63 |
+
move_folder(
|
| 64 |
+
os.path.join(tmp_dir, folder),
|
| 65 |
+
os.path.join(dataset_dir, folder),
|
| 66 |
+
create_dest=True,
|
| 67 |
+
)
|
| 68 |
+
# ====================================
|
| 69 |
+
|
| 70 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 71 |
+
os.chdir(dataset_dir)
|
| 72 |
+
shutil.rmtree(tmp_dir)
|
| 73 |
+
os.chdir(current_dir)
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 77 |
+
# Create dataset directory
|
| 78 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 79 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 80 |
+
|
| 81 |
+
# Change to dataset directory
|
| 82 |
+
os.chdir(dataset_dir)
|
| 83 |
+
|
| 84 |
+
# Download and extract dataset
|
| 85 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
if __name__ == "__main__":
|
| 89 |
+
# Set up argument parser
|
| 90 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 91 |
+
parser.add_argument(
|
| 92 |
+
"-d",
|
| 93 |
+
"--dir_datasets_data",
|
| 94 |
+
help="Directory path where datasets will be stored",
|
| 95 |
+
required=True,
|
| 96 |
+
)
|
| 97 |
+
parser.add_argument(
|
| 98 |
+
"-n",
|
| 99 |
+
"--dataset_name",
|
| 100 |
+
help="Name of the dataset",
|
| 101 |
+
required=True,
|
| 102 |
+
)
|
| 103 |
+
parser.add_argument(
|
| 104 |
+
"--max_workers",
|
| 105 |
+
type=int,
|
| 106 |
+
default=1,
|
| 107 |
+
help="Maximum number of workers for download",
|
| 108 |
+
)
|
| 109 |
+
args = parser.parse_args()
|
| 110 |
+
|
| 111 |
+
# Extract known arguments and pass the rest as kwargs
|
| 112 |
+
kwargs = {"max_workers": args.max_workers}
|
| 113 |
+
|
| 114 |
+
main(
|
| 115 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 116 |
+
dataset_name=args.dataset_name,
|
| 117 |
+
**kwargs,
|
| 118 |
+
)
|
|
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import glob
|
| 4 |
+
import gzip
|
| 5 |
+
import json
|
| 6 |
+
import argparse
|
| 7 |
+
import xml.etree.ElementTree as ET
|
| 8 |
+
import numpy as np
|
| 9 |
+
import nibabel as nib
|
| 10 |
+
import requests
|
| 11 |
+
from medvision_ds.utils.landmark_viz import render_landmarks_batch
|
| 12 |
+
from medvision_ds.utils.preprocess_utils import move_folder, _get_cgroup_limited_cpus
|
| 13 |
+
from medvision_ds.utils.data_conversion import reorient_niigz_RASplus_batch_inplace
|
| 14 |
+
from medvision_ds.utils.download_utils import download_url, retry_call
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# ====================================
|
| 18 |
+
# Dataset Info [!]
|
| 19 |
+
# ====================================
|
| 20 |
+
# Dataset: AFIDs (Anatomical Fiducials)
|
| 21 |
+
# Website: https://github.com/afids/afids-data
|
| 22 |
+
# Data (OpenNeuro, imaging CC0; landmark .fcsv CC BY 4.0, anonymous):
|
| 23 |
+
# - ds004470 (SNSX, 32 subjects, 7T MP2RAGE)
|
| 24 |
+
# - ds004471 (LHSCPD, 40 subjects, 1.5T)
|
| 25 |
+
# Ground-truth fiducials: derivatives/afids_groundtruth/<sub>/anat/*_desc-groundtruth_afids.fcsv
|
| 26 |
+
# - 32 anatomical fiducials per case
|
| 27 |
+
# - .fcsv "# CoordinateSystem = 0" == RAS world-mm
|
| 28 |
+
# Format: nii.gz (images) + fcsv (landmarks)
|
| 29 |
+
# ====================================
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
# OpenNeuro public S3 bucket (anonymous, HTTPS-readable)
|
| 33 |
+
OPENNEURO_S3 = "https://s3.amazonaws.com/openneuro.org"
|
| 34 |
+
S3_NS = "{http://s3.amazonaws.com/doc/2006-03-01/}"
|
| 35 |
+
|
| 36 |
+
# Accession -> short human-readable tag used to build a collision-free caseID
|
| 37 |
+
ACCESSIONS = {
|
| 38 |
+
"ds004470": "SNSX",
|
| 39 |
+
"ds004471": "LHSCPD",
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def _list_s3_keys(prefix):
|
| 44 |
+
"""List all object keys under a prefix in the public openneuro.org S3 bucket.
|
| 45 |
+
|
| 46 |
+
Uses the anonymous ListObjectsV2 REST API over HTTPS (no credentials needed)
|
| 47 |
+
and follows continuation tokens for datasets with >1000 objects.
|
| 48 |
+
"""
|
| 49 |
+
keys = []
|
| 50 |
+
token = None
|
| 51 |
+
while True:
|
| 52 |
+
params = {"list-type": "2", "prefix": prefix}
|
| 53 |
+
if token:
|
| 54 |
+
params["continuation-token"] = token
|
| 55 |
+
def _fetch_s3_list():
|
| 56 |
+
r = requests.get(OPENNEURO_S3, params=params, timeout=120)
|
| 57 |
+
r.raise_for_status()
|
| 58 |
+
return r
|
| 59 |
+
|
| 60 |
+
resp = retry_call(_fetch_s3_list, label=f"S3 list {prefix}")
|
| 61 |
+
root = ET.fromstring(resp.content)
|
| 62 |
+
for contents in root.findall(f"{S3_NS}Contents"):
|
| 63 |
+
keys.append(contents.find(f"{S3_NS}Key").text)
|
| 64 |
+
truncated = root.find(f"{S3_NS}IsTruncated")
|
| 65 |
+
if truncated is not None and truncated.text == "true":
|
| 66 |
+
token = root.find(f"{S3_NS}NextContinuationToken").text
|
| 67 |
+
else:
|
| 68 |
+
break
|
| 69 |
+
return keys
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def _download_s3_key(key, dest_path):
|
| 73 |
+
"""Stream one object from the public openneuro.org S3 bucket to dest_path."""
|
| 74 |
+
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
|
| 75 |
+
url = f"{OPENNEURO_S3}/{key}"
|
| 76 |
+
download_url(url, dest_path)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def _subject_from_key(key):
|
| 80 |
+
"""Extract the 'sub-XXX' segment from an S3 key path."""
|
| 81 |
+
for part in key.split("/"):
|
| 82 |
+
if part.startswith("sub-"):
|
| 83 |
+
return part
|
| 84 |
+
return None
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def _collect_case_files(accession):
|
| 88 |
+
"""Return {sub: {"t1w": key, "fcsv": key}} for subjects with both a T1w and
|
| 89 |
+
a ground-truth AFIDs fcsv in the given accession.
|
| 90 |
+
"""
|
| 91 |
+
keys = _list_s3_keys(f"{accession}/")
|
| 92 |
+
|
| 93 |
+
t1w_by_sub = {}
|
| 94 |
+
fcsv_by_sub = {}
|
| 95 |
+
for key in keys:
|
| 96 |
+
sub = _subject_from_key(key)
|
| 97 |
+
if sub is None:
|
| 98 |
+
continue
|
| 99 |
+
# Raw anatomical T1w: <acc>/sub-XXX/anat/..._T1w.nii.gz
|
| 100 |
+
if (
|
| 101 |
+
f"/{sub}/anat/" in key
|
| 102 |
+
and "derivatives" not in key
|
| 103 |
+
and key.endswith("_T1w.nii.gz")
|
| 104 |
+
):
|
| 105 |
+
# Deterministically keep the first (sorted) T1w per subject
|
| 106 |
+
if sub not in t1w_by_sub or key < t1w_by_sub[sub]:
|
| 107 |
+
t1w_by_sub[sub] = key
|
| 108 |
+
# Ground-truth fiducials: derivatives/afids_groundtruth/<sub>/anat/..._desc-groundtruth_afids.fcsv
|
| 109 |
+
elif (
|
| 110 |
+
"derivatives/afids_groundtruth/" in key
|
| 111 |
+
and key.endswith("_desc-groundtruth_afids.fcsv")
|
| 112 |
+
):
|
| 113 |
+
if sub not in fcsv_by_sub or key < fcsv_by_sub[sub]:
|
| 114 |
+
fcsv_by_sub[sub] = key
|
| 115 |
+
|
| 116 |
+
cases = {}
|
| 117 |
+
for sub in sorted(set(t1w_by_sub) & set(fcsv_by_sub)):
|
| 118 |
+
cases[sub] = {"t1w": t1w_by_sub[sub], "fcsv": fcsv_by_sub[sub]}
|
| 119 |
+
return cases
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
def _parse_fcsv(fcsv_path):
|
| 123 |
+
"""Parse a Slicer .fcsv fiducial file (CoordinateSystem = 0 -> RAS world-mm).
|
| 124 |
+
|
| 125 |
+
Returns an ordered dict {"P1": (x, y, z), ... "P32": (x, y, z)}.
|
| 126 |
+
Fiducials are mapped by their integer label (1..32) when available, otherwise
|
| 127 |
+
by row order.
|
| 128 |
+
"""
|
| 129 |
+
rows = []
|
| 130 |
+
with open(fcsv_path, "r") as f:
|
| 131 |
+
for line in f:
|
| 132 |
+
line = line.strip()
|
| 133 |
+
if not line or line.startswith("#"):
|
| 134 |
+
continue
|
| 135 |
+
fields = line.split(",")
|
| 136 |
+
# id, x, y, z, ow, ox, oy, oz, vis, sel, lock, label, desc, associatedNodeID
|
| 137 |
+
if len(fields) < 4:
|
| 138 |
+
continue
|
| 139 |
+
x, y, z = float(fields[1]), float(fields[2]), float(fields[3])
|
| 140 |
+
label = fields[11] if len(fields) > 11 else ""
|
| 141 |
+
rows.append((label, (x, y, z)))
|
| 142 |
+
|
| 143 |
+
if len(rows) != 32:
|
| 144 |
+
raise ValueError(
|
| 145 |
+
f"Expected 32 fiducials in {fcsv_path}, found {len(rows)}"
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
# Prefer mapping by numeric label if labels are exactly 1..32
|
| 149 |
+
try:
|
| 150 |
+
numeric = {int(lbl): xyz for lbl, xyz in rows}
|
| 151 |
+
if set(numeric.keys()) == set(range(1, 33)):
|
| 152 |
+
return {f"P{i}": numeric[i] for i in range(1, 33)}
|
| 153 |
+
except (ValueError, TypeError):
|
| 154 |
+
pass
|
| 155 |
+
|
| 156 |
+
# Fall back to row order
|
| 157 |
+
return {f"P{i + 1}": xyz for i, (_, xyz) in enumerate(rows)}
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def _world_to_voxel(affine, world_xyz):
|
| 161 |
+
"""Convert a RAS world-mm point to a 0-based voxel index in the volume's own
|
| 162 |
+
index space, using the (already RAS+) image affine.
|
| 163 |
+
"""
|
| 164 |
+
inv = np.linalg.inv(affine)
|
| 165 |
+
homogeneous = np.array([world_xyz[0], world_xyz[1], world_xyz[2], 1.0])
|
| 166 |
+
idx = np.rint(inv @ homogeneous)[:3]
|
| 167 |
+
return [int(v) for v in idx]
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
def _write_landmark_json(fcsv_path, image_path, json_path):
|
| 171 |
+
"""Compute 0-based voxel indices for all 32 fiducials in the RAS+ image and
|
| 172 |
+
write the gzipped landmark JSON.
|
| 173 |
+
|
| 174 |
+
The landmarks are placed in both slice_landmarks_x (sagittal, slice_dim=0)
|
| 175 |
+
and slice_landmarks_z (axial, slice_dim=2) because the biometry metrics span
|
| 176 |
+
those two planes; the planner selects the entry containing the required keys.
|
| 177 |
+
"""
|
| 178 |
+
points_world = _parse_fcsv(fcsv_path)
|
| 179 |
+
affine = nib.load(image_path).affine
|
| 180 |
+
|
| 181 |
+
landmarks = {
|
| 182 |
+
pid: _world_to_voxel(affine, xyz) for pid, xyz in points_world.items()
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
# slice_idx is a 0-based voxel index and is informational only (the planner recomputes
|
| 186 |
+
# the true slice index from the point coordinates). Following the FeTA24 convention, it
|
| 187 |
+
# is the reference landmark's own coordinate along that plane's slice axis: P1 (AC) is
|
| 188 |
+
# the anchor of the AC-PC line, so use P1's i for the sagittal entry and P1's k for the
|
| 189 |
+
# axial one.
|
| 190 |
+
ref = landmarks["P1"]
|
| 191 |
+
json_dict = {
|
| 192 |
+
"slice_landmarks_x": [{"slice_idx": ref[0], "landmarks": landmarks}],
|
| 193 |
+
"slice_landmarks_y": [],
|
| 194 |
+
"slice_landmarks_z": [{"slice_idx": ref[2], "landmarks": landmarks}],
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
os.makedirs(os.path.dirname(json_path), exist_ok=True)
|
| 198 |
+
with gzip.open(json_path, "wt") as f:
|
| 199 |
+
json.dump(json_dict, f, indent=4)
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 203 |
+
"""
|
| 204 |
+
Download and extract the AFIDs dataset.
|
| 205 |
+
|
| 206 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 207 |
+
the other arguments must be kwargs
|
| 208 |
+
"""
|
| 209 |
+
max_workers = kwargs.get("max_workers", 1)
|
| 210 |
+
|
| 211 |
+
# Download files
|
| 212 |
+
current_dir = os.getcwd()
|
| 213 |
+
os.chdir(dataset_dir)
|
| 214 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 215 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 216 |
+
os.chdir(tmp_dir)
|
| 217 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 218 |
+
|
| 219 |
+
# ====================================
|
| 220 |
+
# Add download logic here [!]
|
| 221 |
+
# ====================================
|
| 222 |
+
images_dir = os.path.join(tmp_dir, "Images")
|
| 223 |
+
fcsv_dir = os.path.join(tmp_dir, "Landmarks-fcsv")
|
| 224 |
+
landmarks_dir = os.path.join(tmp_dir, "Landmarks")
|
| 225 |
+
# Per-case download-completion markers, kept OUTSIDE images_dir so they are not
|
| 226 |
+
# picked up by the reorientation glob or moved into the final dataset dir.
|
| 227 |
+
markers_dir = os.path.join(tmp_dir, ".download_markers")
|
| 228 |
+
for d in [images_dir, fcsv_dir, landmarks_dir, markers_dir]:
|
| 229 |
+
os.makedirs(d, exist_ok=True)
|
| 230 |
+
|
| 231 |
+
# Discover and download per-subject T1w image + ground-truth fiducials
|
| 232 |
+
case_map = {} # caseID -> (image_path, fcsv_path)
|
| 233 |
+
for accession, tag in ACCESSIONS.items():
|
| 234 |
+
print(f"Listing files for {accession} ({tag})...")
|
| 235 |
+
cases = _collect_case_files(accession)
|
| 236 |
+
print(f"-- Found {len(cases)} subjects with T1w + ground-truth AFIDs")
|
| 237 |
+
for sub, files in cases.items():
|
| 238 |
+
case_id = f"{tag}-{sub}"
|
| 239 |
+
image_path = os.path.join(images_dir, f"{case_id}.nii.gz")
|
| 240 |
+
fcsv_path = os.path.join(fcsv_dir, f"{case_id}.fcsv")
|
| 241 |
+
marker = os.path.join(markers_dir, f"{case_id}.done")
|
| 242 |
+
case_map[case_id] = (image_path, fcsv_path)
|
| 243 |
+
# Skip already-completed downloads. This is essential for safe re-runs:
|
| 244 |
+
# the image is reoriented IN PLACE below (changing its on-disk size), so
|
| 245 |
+
# re-invoking the resuming download_url on it would issue a byte-range
|
| 246 |
+
# request against a file that is no longer a prefix of the remote object
|
| 247 |
+
# and silently corrupt it. The marker is written only after both files
|
| 248 |
+
# are fully fetched and size-verified by download_url.
|
| 249 |
+
if os.path.exists(marker):
|
| 250 |
+
print(f"-- Skipping {case_id} (already downloaded)")
|
| 251 |
+
continue
|
| 252 |
+
print(f"-- Downloading {case_id}")
|
| 253 |
+
_download_s3_key(files["t1w"], image_path)
|
| 254 |
+
_download_s3_key(files["fcsv"], fcsv_path)
|
| 255 |
+
open(marker, "w").close()
|
| 256 |
+
|
| 257 |
+
# Reorient images to RAS+ IN PLACE (dtype-preserving, idempotent).
|
| 258 |
+
# Landmark voxel indices below are computed AGAINST these RAS+ images, because
|
| 259 |
+
# the whole-dataset reorientation done by the loader touches only *.nii.gz,
|
| 260 |
+
# never the landmark *.json.gz files.
|
| 261 |
+
print("Reorienting images to RAS+ orientation...")
|
| 262 |
+
reorient_niigz_RASplus_batch_inplace(images_dir, workers_limit=max_workers)
|
| 263 |
+
|
| 264 |
+
# Compute 0-based voxel-index landmarks in the RAS+ volumes
|
| 265 |
+
print("Computing landmark voxel indices...")
|
| 266 |
+
for case_id, (image_path, fcsv_path) in case_map.items():
|
| 267 |
+
json_path = os.path.join(landmarks_dir, f"{case_id}.json.gz")
|
| 268 |
+
_write_landmark_json(fcsv_path, image_path, json_path)
|
| 269 |
+
print(f"-- Wrote landmarks for {case_id}")
|
| 270 |
+
|
| 271 |
+
# Landmark-overlay figures:
|
| 272 |
+
# Landmarks-fig/ -> one figure per plane per landmark-bearing slice,
|
| 273 |
+
# each point drawn on its own exact slice
|
| 274 |
+
# Landmarks-fig-w-projection/ -> 3 overview figures per case, all 32 fiducials
|
| 275 |
+
# projected onto the slice through P1 (AC)
|
| 276 |
+
print("Rendering landmark figures...")
|
| 277 |
+
render_landmarks_batch(
|
| 278 |
+
images_dir, landmarks_dir, os.path.join(tmp_dir, "Landmarks-fig"),
|
| 279 |
+
fig_dir_projection=os.path.join(tmp_dir, "Landmarks-fig-w-projection"),
|
| 280 |
+
image_modality="MRI", dataset_name="AFIDs",
|
| 281 |
+
max_workers=max_workers,
|
| 282 |
+
)
|
| 283 |
+
|
| 284 |
+
# Move folder to dataset_dir
|
| 285 |
+
folders_to_move = [
|
| 286 |
+
"Images",
|
| 287 |
+
"Landmarks",
|
| 288 |
+
"Landmarks-fig",
|
| 289 |
+
"Landmarks-fig-w-projection",
|
| 290 |
+
]
|
| 291 |
+
for folder in folders_to_move:
|
| 292 |
+
move_folder(
|
| 293 |
+
os.path.join(tmp_dir, folder),
|
| 294 |
+
os.path.join(dataset_dir, folder),
|
| 295 |
+
create_dest=True,
|
| 296 |
+
)
|
| 297 |
+
# ====================================
|
| 298 |
+
|
| 299 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 300 |
+
os.chdir(dataset_dir)
|
| 301 |
+
shutil.rmtree(tmp_dir)
|
| 302 |
+
os.chdir(current_dir)
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 306 |
+
# Create dataset directory
|
| 307 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 308 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 309 |
+
|
| 310 |
+
# Change to dataset directory
|
| 311 |
+
os.chdir(dataset_dir)
|
| 312 |
+
|
| 313 |
+
# Download and extract dataset
|
| 314 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
if __name__ == "__main__":
|
| 318 |
+
# Set up argument parser
|
| 319 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 320 |
+
parser.add_argument(
|
| 321 |
+
"-d",
|
| 322 |
+
"--dir_datasets_data",
|
| 323 |
+
help="Directory path where datasets will be stored",
|
| 324 |
+
required=True,
|
| 325 |
+
)
|
| 326 |
+
parser.add_argument(
|
| 327 |
+
"-n",
|
| 328 |
+
"--dataset_name",
|
| 329 |
+
help="Name of the dataset",
|
| 330 |
+
required=True,
|
| 331 |
+
)
|
| 332 |
+
parser.add_argument(
|
| 333 |
+
"--max_workers",
|
| 334 |
+
type=int,
|
| 335 |
+
default=1,
|
| 336 |
+
help="Maximum number of workers for reorientation",
|
| 337 |
+
)
|
| 338 |
+
args = parser.parse_args()
|
| 339 |
+
|
| 340 |
+
# Extract known arguments and pass the rest as kwargs
|
| 341 |
+
kwargs = {"max_workers": args.max_workers}
|
| 342 |
+
|
| 343 |
+
main(
|
| 344 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 345 |
+
dataset_name=args.dataset_name,
|
| 346 |
+
**kwargs,
|
| 347 |
+
)
|
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerBiometry
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# Do not change the dictionray names
|
| 12 |
+
# - dataset_info, landmarks_map, lines_map, angles_map, biometrics_map
|
| 13 |
+
# ====================================
|
| 14 |
+
dataset_info = {
|
| 15 |
+
"dataset": "AFIDs",
|
| 16 |
+
"dataset_website": "https://github.com/afids/afids-data",
|
| 17 |
+
"dataset_data": [
|
| 18 |
+
"https://openneuro.org/datasets/ds004470",
|
| 19 |
+
"https://openneuro.org/datasets/ds004471",
|
| 20 |
+
],
|
| 21 |
+
# The afids-data LICENSE.md releases the landmark coordinates (*.fcsv) under CC BY 4.0;
|
| 22 |
+
# the accompanying imaging (OpenNeuro ds004470 / ds004471) is CC0. CC BY 4.0 is the
|
| 23 |
+
# governing licence for the combined product, since it is the more restrictive of the two.
|
| 24 |
+
"license": ["CC BY 4.0"],
|
| 25 |
+
"paper": ["https://doi.org/10.1038/s41597-024-04259-z"],
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
# The 32 Anatomical Fiducials (AFIDs) protocol points, in canonical order.
|
| 29 |
+
landmarks_map = {
|
| 30 |
+
"P1": "anterior commissure",
|
| 31 |
+
"P2": "posterior commissure",
|
| 32 |
+
"P3": "infracollicular sulcus",
|
| 33 |
+
"P4": "pontomesencephalic junction",
|
| 34 |
+
"P5": "superior interpeduncular fossa",
|
| 35 |
+
"P6": "right superior lateral mesencephalic sulcus",
|
| 36 |
+
"P7": "left superior lateral mesencephalic sulcus",
|
| 37 |
+
"P8": "right inferior lateral mesencephalic sulcus",
|
| 38 |
+
"P9": "left inferior lateral mesencephalic sulcus",
|
| 39 |
+
"P10": "culmen",
|
| 40 |
+
"P11": "intermammillary sulcus",
|
| 41 |
+
"P12": "right mammillary body",
|
| 42 |
+
"P13": "left mammillary body",
|
| 43 |
+
"P14": "pineal gland",
|
| 44 |
+
"P15": "right lateral ventricle at anterior commissure",
|
| 45 |
+
"P16": "left lateral ventricle at anterior commissure",
|
| 46 |
+
"P17": "right lateral ventricle at posterior commissure",
|
| 47 |
+
"P18": "left lateral ventricle at posterior commissure",
|
| 48 |
+
"P19": "genu of the corpus callosum",
|
| 49 |
+
"P20": "splenium of the corpus callosum",
|
| 50 |
+
"P21": "right anterolateral temporal horn",
|
| 51 |
+
"P22": "left anterolateral temporal horn",
|
| 52 |
+
"P23": "right superior anteromedial temporal horn",
|
| 53 |
+
"P24": "left superior anteromedial temporal horn",
|
| 54 |
+
"P25": "right inferior anteromedial temporal horn",
|
| 55 |
+
"P26": "left inferior anteromedial temporal horn",
|
| 56 |
+
"P27": "right indusium griseum origin",
|
| 57 |
+
"P28": "left indusium griseum origin",
|
| 58 |
+
"P29": "right ventral occipital horn",
|
| 59 |
+
"P30": "left ventral occipital horn",
|
| 60 |
+
"P31": "right olfactory sulcal fundus",
|
| 61 |
+
"P32": "left olfactory sulcal fundus",
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
lines_map = {
|
| 65 |
+
"L-1-2": {
|
| 66 |
+
"name": "AC-PC distance",
|
| 67 |
+
"element_keys": ["P1", "P2"],
|
| 68 |
+
"element_map_name": "landmarks_map",
|
| 69 |
+
},
|
| 70 |
+
"L-4-1": {
|
| 71 |
+
"name": "pontomesencephalic junction to anterior commissure",
|
| 72 |
+
"element_keys": ["P4", "P1"],
|
| 73 |
+
"element_map_name": "landmarks_map",
|
| 74 |
+
},
|
| 75 |
+
"L-19-20": {
|
| 76 |
+
"name": "corpus callosum length (genu to splenium)",
|
| 77 |
+
"element_keys": ["P19", "P20"],
|
| 78 |
+
"element_map_name": "landmarks_map",
|
| 79 |
+
},
|
| 80 |
+
"L-15-16": {
|
| 81 |
+
"name": "frontal horn width at anterior commissure",
|
| 82 |
+
"element_keys": ["P15", "P16"],
|
| 83 |
+
"element_map_name": "landmarks_map",
|
| 84 |
+
},
|
| 85 |
+
"L-17-18": {
|
| 86 |
+
"name": "ventricular width at posterior commissure",
|
| 87 |
+
"element_keys": ["P17", "P18"],
|
| 88 |
+
"element_map_name": "landmarks_map",
|
| 89 |
+
},
|
| 90 |
+
"L-29-30": {
|
| 91 |
+
"name": "occipital horn separation",
|
| 92 |
+
"element_keys": ["P29", "P30"],
|
| 93 |
+
"element_map_name": "landmarks_map",
|
| 94 |
+
},
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
angles_map = {}
|
| 98 |
+
|
| 99 |
+
biometrics_map = [
|
| 100 |
+
{
|
| 101 |
+
"metric_type": "distance",
|
| 102 |
+
"metric_map_name": "lines_map",
|
| 103 |
+
"metric_key": "L-1-2",
|
| 104 |
+
"slice_dim": 0,
|
| 105 |
+
},
|
| 106 |
+
{
|
| 107 |
+
"metric_type": "distance",
|
| 108 |
+
"metric_map_name": "lines_map",
|
| 109 |
+
"metric_key": "L-4-1",
|
| 110 |
+
"slice_dim": 0,
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"metric_type": "distance",
|
| 114 |
+
"metric_map_name": "lines_map",
|
| 115 |
+
"metric_key": "L-19-20",
|
| 116 |
+
"slice_dim": 0,
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"metric_type": "distance",
|
| 120 |
+
"metric_map_name": "lines_map",
|
| 121 |
+
"metric_key": "L-15-16",
|
| 122 |
+
"slice_dim": 2,
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"metric_type": "distance",
|
| 126 |
+
"metric_map_name": "lines_map",
|
| 127 |
+
"metric_key": "L-17-18",
|
| 128 |
+
"slice_dim": 2,
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"metric_type": "distance",
|
| 132 |
+
"metric_map_name": "lines_map",
|
| 133 |
+
"metric_key": "L-29-30",
|
| 134 |
+
"slice_dim": 2,
|
| 135 |
+
},
|
| 136 |
+
]
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
# ------------
|
| 140 |
+
# Task-specific benchmark planning configuration
|
| 141 |
+
# ------------
|
| 142 |
+
# - dataset_info: Dictionary containing dataset metadata
|
| 143 |
+
# - tasks: List of task configurations where each task contains:
|
| 144 |
+
# - image_modality: Type of medical imaging (e.g., "CT", "MRI")
|
| 145 |
+
# - image_description: Description of image, used in text prompts
|
| 146 |
+
# - image_folder: Directory for .nii.gz image files
|
| 147 |
+
# - landmark_folder: Directory for landmark files
|
| 148 |
+
# - image_prefix: Filename part before case ID for images
|
| 149 |
+
# - image_suffix: Filename part after case ID for images
|
| 150 |
+
# - landmark_prefix: Filename part before case ID for landmarks
|
| 151 |
+
# - landmark_suffix: Filename part after case ID for landmarks
|
| 152 |
+
# - landmarks_map: Dictionary mapping landmarks to their descriptions
|
| 153 |
+
# NOTE:
|
| 154 |
+
# - These keys should match the variable names:
|
| 155 |
+
# "landmarks_map": landmarks_map,
|
| 156 |
+
# "lines_map": lines_map,
|
| 157 |
+
# "angles_map": angles_map,
|
| 158 |
+
# "biometrics_map": biometrics_map,
|
| 159 |
+
# ------------
|
| 160 |
+
benchmark_plan = {
|
| 161 |
+
"dataset_info": dataset_info,
|
| 162 |
+
"tasks": [
|
| 163 |
+
{
|
| 164 |
+
"image_modality": "MRI",
|
| 165 |
+
"image_description": "T1-weighted brain MRI",
|
| 166 |
+
"image_folder": "Images",
|
| 167 |
+
"landmark_folder": "Landmarks",
|
| 168 |
+
"image_prefix": "",
|
| 169 |
+
"image_suffix": ".nii.gz",
|
| 170 |
+
"landmark_prefix": "",
|
| 171 |
+
"landmark_suffix": ".json.gz",
|
| 172 |
+
"landmarks_map": landmarks_map,
|
| 173 |
+
"lines_map": lines_map,
|
| 174 |
+
"angles_map": angles_map,
|
| 175 |
+
"biometrics_map": biometrics_map,
|
| 176 |
+
},
|
| 177 |
+
],
|
| 178 |
+
}
|
| 179 |
+
# ====================================
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
def main(
|
| 183 |
+
dir_datasets_data,
|
| 184 |
+
dataset_name,
|
| 185 |
+
benchmark_plan=benchmark_plan,
|
| 186 |
+
random_seed=1024,
|
| 187 |
+
split_ratio=0.7,
|
| 188 |
+
):
|
| 189 |
+
# Create dataset directory
|
| 190 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 191 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 192 |
+
|
| 193 |
+
# Change to dataset directory
|
| 194 |
+
os.chdir(dataset_dir)
|
| 195 |
+
|
| 196 |
+
# Process dataset for biometric measurement task
|
| 197 |
+
planner = MedVision_BenchmarkPlannerBiometry(
|
| 198 |
+
dataset_dir=dataset_dir,
|
| 199 |
+
bm_plan=benchmark_plan,
|
| 200 |
+
dataset_name=dataset_name,
|
| 201 |
+
seed=random_seed,
|
| 202 |
+
split_ratio=split_ratio,
|
| 203 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 204 |
+
)
|
| 205 |
+
planner.process()
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
if __name__ == "__main__":
|
| 209 |
+
# Set up argument parser
|
| 210 |
+
parser = argparse.ArgumentParser(
|
| 211 |
+
description="Generate benchmark planner for biometric measurement task."
|
| 212 |
+
)
|
| 213 |
+
parser.add_argument(
|
| 214 |
+
"-d",
|
| 215 |
+
"--dir_datasets_data",
|
| 216 |
+
type=str,
|
| 217 |
+
help="Directory path where datasets will be stored",
|
| 218 |
+
required=True,
|
| 219 |
+
)
|
| 220 |
+
parser.add_argument(
|
| 221 |
+
"-n",
|
| 222 |
+
"--dataset_name",
|
| 223 |
+
type=str,
|
| 224 |
+
help="Name of the dataset",
|
| 225 |
+
required=True,
|
| 226 |
+
)
|
| 227 |
+
parser.add_argument(
|
| 228 |
+
"--random_seed",
|
| 229 |
+
type=int,
|
| 230 |
+
default=1024,
|
| 231 |
+
help="Random seed for reproducibility",
|
| 232 |
+
)
|
| 233 |
+
parser.add_argument(
|
| 234 |
+
"--split_ratio",
|
| 235 |
+
type=float,
|
| 236 |
+
default=0.7,
|
| 237 |
+
help="Train/test split ratio (0-1)",
|
| 238 |
+
)
|
| 239 |
+
args = parser.parse_args()
|
| 240 |
+
|
| 241 |
+
main(
|
| 242 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 243 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 244 |
+
dataset_name=args.dataset_name,
|
| 245 |
+
random_seed=args.random_seed,
|
| 246 |
+
split_ratio=args.split_ratio,
|
| 247 |
+
)
|
|
File without changes
|
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import zipfile
|
| 6 |
+
from huggingface_hub import snapshot_download
|
| 7 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# ====================================
|
| 11 |
+
# Dataset Info [!]
|
| 12 |
+
# ====================================
|
| 13 |
+
# Dataset: DEEP-PSMA
|
| 14 |
+
# Challenge: https://deep-psma.grand-challenge.org/
|
| 15 |
+
# Official Release: https://zenodo.org/records/15281784
|
| 16 |
+
# HF Release: https://huggingface.co/datasets/YongchengYAO/DEEP-PSMA-Lite
|
| 17 |
+
# Format: nii.gz
|
| 18 |
+
# NOTE: the HF mirror holds PET (SUV) + TTB masks for both tracers; the companion CT and
|
| 19 |
+
# totseg_24 volumes are omitted (the mask lives on the PET grid), hence '-Lite'.
|
| 20 |
+
# ====================================
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 25 |
+
"""
|
| 26 |
+
Download and extract the DEEP-PSMA dataset from the HuggingFace mirror.
|
| 27 |
+
|
| 28 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 29 |
+
the other arguments must be kwargs
|
| 30 |
+
"""
|
| 31 |
+
# Download files
|
| 32 |
+
current_dir = os.getcwd()
|
| 33 |
+
os.chdir(dataset_dir)
|
| 34 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 35 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 36 |
+
os.chdir(tmp_dir)
|
| 37 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 38 |
+
|
| 39 |
+
# ====================================
|
| 40 |
+
# Add download logic here [!]
|
| 41 |
+
# ====================================
|
| 42 |
+
# Download dataset (image + mask archives, sharded as data-part*.zip)
|
| 43 |
+
snapshot_download(
|
| 44 |
+
repo_id="YongchengYAO/DEEP-PSMA-Lite",
|
| 45 |
+
allow_patterns="*.zip",
|
| 46 |
+
repo_type="dataset",
|
| 47 |
+
revision="f89fc6abd8476ad19b296f3c50ca8cecca4fe950", # squashed single commit, 2026-07-27
|
| 48 |
+
local_dir=".",
|
| 49 |
+
max_workers=kwargs.get("max_workers", 1),
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# Extract all zip files
|
| 53 |
+
for zip_file in sorted(glob.glob("*.zip")):
|
| 54 |
+
print(f"extracting {zip_file}")
|
| 55 |
+
with zipfile.ZipFile(zip_file, "r") as zip_ref:
|
| 56 |
+
zip_ref.extractall(".")
|
| 57 |
+
os.remove(zip_file)
|
| 58 |
+
print(f"{zip_file} deleted")
|
| 59 |
+
|
| 60 |
+
# Move folder to dataset_dir
|
| 61 |
+
folders_to_move = [
|
| 62 |
+
"Images-PSMA",
|
| 63 |
+
"Masks-PSMA",
|
| 64 |
+
"Images-FDG",
|
| 65 |
+
"Masks-FDG",
|
| 66 |
+
]
|
| 67 |
+
for folder in folders_to_move:
|
| 68 |
+
move_folder(
|
| 69 |
+
os.path.join(tmp_dir, folder),
|
| 70 |
+
os.path.join(dataset_dir, folder),
|
| 71 |
+
create_dest=True,
|
| 72 |
+
)
|
| 73 |
+
# ====================================
|
| 74 |
+
|
| 75 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 76 |
+
os.chdir(dataset_dir)
|
| 77 |
+
shutil.rmtree(tmp_dir)
|
| 78 |
+
os.chdir(current_dir)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 82 |
+
# Create dataset directory
|
| 83 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 84 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 85 |
+
|
| 86 |
+
# Change to dataset directory
|
| 87 |
+
os.chdir(dataset_dir)
|
| 88 |
+
|
| 89 |
+
# Download and extract dataset
|
| 90 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
if __name__ == "__main__":
|
| 94 |
+
# Set up argument parser
|
| 95 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 96 |
+
parser.add_argument(
|
| 97 |
+
"-d",
|
| 98 |
+
"--dir_datasets_data",
|
| 99 |
+
help="Directory path where datasets will be stored",
|
| 100 |
+
required=True,
|
| 101 |
+
)
|
| 102 |
+
parser.add_argument(
|
| 103 |
+
"-n",
|
| 104 |
+
"--dataset_name",
|
| 105 |
+
help="Name of the dataset",
|
| 106 |
+
required=True,
|
| 107 |
+
)
|
| 108 |
+
parser.add_argument(
|
| 109 |
+
"--max_workers",
|
| 110 |
+
type=int,
|
| 111 |
+
default=1,
|
| 112 |
+
help="Maximum number of workers for download",
|
| 113 |
+
)
|
| 114 |
+
args = parser.parse_args()
|
| 115 |
+
|
| 116 |
+
# Extract known arguments and pass the rest as kwargs
|
| 117 |
+
kwargs = {"max_workers": args.max_workers}
|
| 118 |
+
|
| 119 |
+
main(
|
| 120 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 121 |
+
dataset_name=args.dataset_name,
|
| 122 |
+
**kwargs,
|
| 123 |
+
)
|
|
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import zipfile
|
| 6 |
+
import requests
|
| 7 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 8 |
+
from medvision_ds.utils.download_utils import download_url, retry_call
|
| 9 |
+
from medvision_ds.utils.data_conversion import (
|
| 10 |
+
convert_mask_to_uint16_per_dir,
|
| 11 |
+
copy_img_header_to_mask,
|
| 12 |
+
reorient_niigz_RASplus_batch_inplace,
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ====================================
|
| 17 |
+
# Dataset Info [!]
|
| 18 |
+
# ====================================
|
| 19 |
+
# Dataset: DEEP-PSMA
|
| 20 |
+
# Challenge: https://deep-psma.grand-challenge.org/
|
| 21 |
+
# Data: https://zenodo.org/records/15281784
|
| 22 |
+
# Format: nii.gz
|
| 23 |
+
# ====================================
|
| 24 |
+
|
| 25 |
+
ZENODO_RECORD = "15281784"
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 29 |
+
"""
|
| 30 |
+
Download and extract the DEEP-PSMA dataset.
|
| 31 |
+
|
| 32 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 33 |
+
the other arguments must be kwargs
|
| 34 |
+
"""
|
| 35 |
+
max_workers = kwargs.get("max_workers", 1)
|
| 36 |
+
|
| 37 |
+
# Download files
|
| 38 |
+
current_dir = os.getcwd()
|
| 39 |
+
os.chdir(dataset_dir)
|
| 40 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 41 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 42 |
+
os.chdir(tmp_dir)
|
| 43 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 44 |
+
|
| 45 |
+
# ====================================
|
| 46 |
+
# Add download logic here [!]
|
| 47 |
+
# ====================================
|
| 48 |
+
# Query Zenodo record metadata and download every zip archive (~24 GB, 5 zips).
|
| 49 |
+
# Filenames are resolved from the record so we never hardcode unknown zip names.
|
| 50 |
+
api_url = f"https://zenodo.org/api/records/{ZENODO_RECORD}"
|
| 51 |
+
print(f"Fetching record metadata from {api_url}")
|
| 52 |
+
|
| 53 |
+
def _fetch_record_json(u):
|
| 54 |
+
r = requests.get(u, timeout=60)
|
| 55 |
+
r.raise_for_status()
|
| 56 |
+
return r.json()
|
| 57 |
+
|
| 58 |
+
record_meta = retry_call(_fetch_record_json, api_url, label="zenodo-metadata")
|
| 59 |
+
record_files = record_meta.get("files", [])
|
| 60 |
+
zip_entries = [f for f in record_files if f["key"].lower().endswith(".zip")]
|
| 61 |
+
if not zip_entries:
|
| 62 |
+
raise RuntimeError(f"No zip archives found in Zenodo record {ZENODO_RECORD}")
|
| 63 |
+
|
| 64 |
+
for entry in zip_entries:
|
| 65 |
+
key = entry["key"]
|
| 66 |
+
url = entry["links"]["self"]
|
| 67 |
+
print(f"Downloading {key} from {url}")
|
| 68 |
+
download_url(url, key, expected_size=entry.get("size"))
|
| 69 |
+
print(f"Extracting {key}")
|
| 70 |
+
with zipfile.ZipFile(key, "r") as zip_ref:
|
| 71 |
+
zip_ref.extractall()
|
| 72 |
+
os.remove(key)
|
| 73 |
+
|
| 74 |
+
# Create output directories: keep the two tracers in SEPARATE image/mask folders
|
| 75 |
+
# so the subject-level train/test split cannot leak a subject across tracers.
|
| 76 |
+
for folder in ["Images-PSMA", "Images-FDG", "Masks-PSMA", "Masks-FDG"]:
|
| 77 |
+
os.makedirs(folder, exist_ok=True)
|
| 78 |
+
|
| 79 |
+
# Locate each subject folder (train_XXXX) via its PSMA/TTB mask, wherever the
|
| 80 |
+
# zip archives placed it in the tree.
|
| 81 |
+
case_dirs = set()
|
| 82 |
+
for ttb in glob.glob(os.path.join("**", "PSMA", "TTB.nii.gz"), recursive=True):
|
| 83 |
+
case_dirs.add(os.path.dirname(os.path.dirname(ttb)))
|
| 84 |
+
|
| 85 |
+
# PET is the primary image (SUV); CT is dropped for the MedVision task.
|
| 86 |
+
mapping = [
|
| 87 |
+
("PSMA", "PET.nii.gz", "Images-PSMA"),
|
| 88 |
+
("PSMA", "TTB.nii.gz", "Masks-PSMA"),
|
| 89 |
+
("FDG", "PET.nii.gz", "Images-FDG"),
|
| 90 |
+
("FDG", "TTB.nii.gz", "Masks-FDG"),
|
| 91 |
+
]
|
| 92 |
+
for case_dir in sorted(case_dirs):
|
| 93 |
+
case = os.path.basename(os.path.normpath(case_dir))
|
| 94 |
+
for tracer, fname, dest in mapping:
|
| 95 |
+
src = os.path.join(case_dir, tracer, fname)
|
| 96 |
+
if os.path.exists(src):
|
| 97 |
+
shutil.move(src, os.path.join(dest, f"{case}.nii.gz"))
|
| 98 |
+
# Drop the extracted case folder: the CT and totseg_24 volumes we do not use
|
| 99 |
+
# would otherwise be picked up by the recursive RAS+ reorientation below.
|
| 100 |
+
shutil.rmtree(case_dir, ignore_errors=True)
|
| 101 |
+
|
| 102 |
+
# Copy Nifti header of images to masks, then convert masks to uint16.
|
| 103 |
+
# Order matters: copy_img_header_to_mask returns float64 masks.
|
| 104 |
+
for img_folder, mask_folder in [
|
| 105 |
+
("Images-PSMA", "Masks-PSMA"),
|
| 106 |
+
("Images-FDG", "Masks-FDG"),
|
| 107 |
+
]:
|
| 108 |
+
print(f"Copying Nifti headers from {img_folder} to {mask_folder}...")
|
| 109 |
+
img_files = list(glob.glob(os.path.join(img_folder, "*.nii.gz")))
|
| 110 |
+
copy_img_header_to_mask(img_files, mask_folder, workers_limit=max_workers)
|
| 111 |
+
print(f"Converting masks in {mask_folder} to uint16...")
|
| 112 |
+
convert_mask_to_uint16_per_dir(mask_folder, workers_limit=max_workers)
|
| 113 |
+
|
| 114 |
+
# Reorient all images and masks to RAS+ (dtype-preserving, idempotent).
|
| 115 |
+
print("Reorienting images and masks to RAS+...")
|
| 116 |
+
reorient_niigz_RASplus_batch_inplace(tmp_dir, workers_limit=max_workers)
|
| 117 |
+
|
| 118 |
+
# Move folder to dataset_dir
|
| 119 |
+
folders_to_move = [
|
| 120 |
+
"Images-PSMA",
|
| 121 |
+
"Images-FDG",
|
| 122 |
+
"Masks-PSMA",
|
| 123 |
+
"Masks-FDG",
|
| 124 |
+
]
|
| 125 |
+
for folder in folders_to_move:
|
| 126 |
+
move_folder(
|
| 127 |
+
os.path.join(tmp_dir, folder),
|
| 128 |
+
os.path.join(dataset_dir, folder),
|
| 129 |
+
create_dest=True,
|
| 130 |
+
)
|
| 131 |
+
# ====================================
|
| 132 |
+
|
| 133 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 134 |
+
os.chdir(dataset_dir)
|
| 135 |
+
shutil.rmtree(tmp_dir)
|
| 136 |
+
os.chdir(current_dir)
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 140 |
+
# Create dataset directory
|
| 141 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 142 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 143 |
+
|
| 144 |
+
# Change to dataset directory
|
| 145 |
+
os.chdir(dataset_dir)
|
| 146 |
+
|
| 147 |
+
# Download and extract dataset
|
| 148 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
if __name__ == "__main__":
|
| 152 |
+
# Set up argument parser
|
| 153 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 154 |
+
parser.add_argument(
|
| 155 |
+
"-d",
|
| 156 |
+
"--dir_datasets_data",
|
| 157 |
+
help="Directory path where datasets will be stored",
|
| 158 |
+
required=True,
|
| 159 |
+
)
|
| 160 |
+
parser.add_argument(
|
| 161 |
+
"-n",
|
| 162 |
+
"--dataset_name",
|
| 163 |
+
help="Name of the dataset",
|
| 164 |
+
required=True,
|
| 165 |
+
)
|
| 166 |
+
parser.add_argument(
|
| 167 |
+
"--max_workers",
|
| 168 |
+
type=int,
|
| 169 |
+
default=1,
|
| 170 |
+
help="Maximum number of workers for download and conversion",
|
| 171 |
+
)
|
| 172 |
+
args = parser.parse_args()
|
| 173 |
+
|
| 174 |
+
# Extract known arguments and pass the rest as kwargs
|
| 175 |
+
kwargs = {"max_workers": args.max_workers}
|
| 176 |
+
|
| 177 |
+
main(
|
| 178 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 179 |
+
dataset_name=args.dataset_name,
|
| 180 |
+
**kwargs,
|
| 181 |
+
)
|
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerBiometry_fromSeg
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# ====================================
|
| 12 |
+
CLUSTER_SIZE_THRESHOLD = 20
|
| 13 |
+
|
| 14 |
+
dataset_info = {
|
| 15 |
+
"dataset": "DEEP-PSMA",
|
| 16 |
+
"dataset_website": "https://deep-psma.grand-challenge.org/",
|
| 17 |
+
"dataset_data": [
|
| 18 |
+
"https://zenodo.org/records/15281784",
|
| 19 |
+
],
|
| 20 |
+
"license": ["CC BY-NC 4.0"],
|
| 21 |
+
"paper": ["https://doi.org/10.5281/zenodo.15281784"],
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
labels_map = {"1": "total tumor burden"}
|
| 25 |
+
# ====================================
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# ===============
|
| 29 |
+
# DO NOT CHANGE
|
| 30 |
+
# ===============
|
| 31 |
+
landmarks_map = {
|
| 32 |
+
"P1": "most right/anterior/superior endpoint of the major axis",
|
| 33 |
+
"P2": "most left/superior/inferior endpoint of the major axis",
|
| 34 |
+
"P3": "most right/anterior/superior endpoint of the minor axis",
|
| 35 |
+
"P4": "most left/superior/inferior endpoint of the minor axis",
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
lines_map = {
|
| 39 |
+
"L-1-2": {
|
| 40 |
+
"name": "marjor axis of the fitted ellipse",
|
| 41 |
+
"element_keys": ["P1", "P2"],
|
| 42 |
+
"element_map_name": "landmarks_map",
|
| 43 |
+
},
|
| 44 |
+
"L-3-4": {
|
| 45 |
+
"name": "minor axis of the fitted ellipse",
|
| 46 |
+
"element_keys": ["P3", "P4"],
|
| 47 |
+
"element_map_name": "landmarks_map",
|
| 48 |
+
},
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
angles_map = {}
|
| 52 |
+
|
| 53 |
+
biometrics_map = [
|
| 54 |
+
{
|
| 55 |
+
"metric_type": "distance",
|
| 56 |
+
"metric_map_name": "lines_map",
|
| 57 |
+
"metric_key": "L-1-2",
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"metric_type": "distance",
|
| 61 |
+
"metric_map_name": "lines_map",
|
| 62 |
+
"metric_key": "L-3-4",
|
| 63 |
+
},
|
| 64 |
+
]
|
| 65 |
+
# ===============
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
benchmark_plan = {
|
| 69 |
+
"dataset_info": dataset_info,
|
| 70 |
+
"tasks": [
|
| 71 |
+
{
|
| 72 |
+
"image_modality": "PET",
|
| 73 |
+
"image_description": "prostate-specific membrane antigen (PSMA) positron emission tomography (PET) scan",
|
| 74 |
+
"image_folder": "Images-PSMA",
|
| 75 |
+
"mask_folder": "Masks-PSMA",
|
| 76 |
+
"landmark_folder": "Landmarks-PSMA-Label1",
|
| 77 |
+
"landmark_figure_folder": "Landmarks-PSMA-Label1-fig",
|
| 78 |
+
"image_prefix": "",
|
| 79 |
+
"image_suffix": ".nii.gz",
|
| 80 |
+
"mask_prefix": "",
|
| 81 |
+
"mask_suffix": ".nii.gz",
|
| 82 |
+
"landmark_prefix": "",
|
| 83 |
+
"landmark_suffix": ".json.gz",
|
| 84 |
+
"labels_map": labels_map,
|
| 85 |
+
"landmarks_map": landmarks_map,
|
| 86 |
+
"lines_map": lines_map,
|
| 87 |
+
"angles_map": angles_map,
|
| 88 |
+
"biometrics_map": biometrics_map,
|
| 89 |
+
"target_label": 1,
|
| 90 |
+
"cluster_size_threshold": CLUSTER_SIZE_THRESHOLD,
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"image_modality": "PET",
|
| 94 |
+
"image_description": "fluorodeoxyglucose (FDG) positron emission tomography (PET) scan",
|
| 95 |
+
"image_folder": "Images-FDG",
|
| 96 |
+
"mask_folder": "Masks-FDG",
|
| 97 |
+
"landmark_folder": "Landmarks-FDG-Label1",
|
| 98 |
+
"landmark_figure_folder": "Landmarks-FDG-Label1-fig",
|
| 99 |
+
"image_prefix": "",
|
| 100 |
+
"image_suffix": ".nii.gz",
|
| 101 |
+
"mask_prefix": "",
|
| 102 |
+
"mask_suffix": ".nii.gz",
|
| 103 |
+
"landmark_prefix": "",
|
| 104 |
+
"landmark_suffix": ".json.gz",
|
| 105 |
+
"labels_map": labels_map,
|
| 106 |
+
"landmarks_map": landmarks_map,
|
| 107 |
+
"lines_map": lines_map,
|
| 108 |
+
"angles_map": angles_map,
|
| 109 |
+
"biometrics_map": biometrics_map,
|
| 110 |
+
"target_label": 1,
|
| 111 |
+
"cluster_size_threshold": CLUSTER_SIZE_THRESHOLD,
|
| 112 |
+
},
|
| 113 |
+
],
|
| 114 |
+
}
|
| 115 |
+
# ====================================
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def main(
|
| 119 |
+
dir_datasets_data,
|
| 120 |
+
dataset_name,
|
| 121 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 122 |
+
random_seed=1024,
|
| 123 |
+
split_ratio=0.7,
|
| 124 |
+
shrunken_bbox_scale=0.9,
|
| 125 |
+
enlarged_bbox_scale=1.1,
|
| 126 |
+
force_uint16_mask=False,
|
| 127 |
+
reorient2RAS=False,
|
| 128 |
+
visualization=True,
|
| 129 |
+
):
|
| 130 |
+
# Create dataset directory
|
| 131 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 132 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 133 |
+
|
| 134 |
+
# Change to dataset directory
|
| 135 |
+
os.chdir(dataset_dir)
|
| 136 |
+
|
| 137 |
+
# Process dataset for biometric measurement task
|
| 138 |
+
planner = MedVision_BenchmarkPlannerBiometry_fromSeg(
|
| 139 |
+
dataset_dir=dataset_dir,
|
| 140 |
+
bm_plan=benchmark_plan,
|
| 141 |
+
dataset_name=dataset_name,
|
| 142 |
+
seed=random_seed,
|
| 143 |
+
split_ratio=split_ratio,
|
| 144 |
+
shrunk_bbox_scale=shrunken_bbox_scale,
|
| 145 |
+
enlarged_bbox_scale=enlarged_bbox_scale,
|
| 146 |
+
force_uint16_mask=force_uint16_mask,
|
| 147 |
+
reorient2RAS=reorient2RAS,
|
| 148 |
+
visualization=visualization,
|
| 149 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 150 |
+
)
|
| 151 |
+
planner.process()
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
if __name__ == "__main__":
|
| 155 |
+
# Set up argument parser
|
| 156 |
+
parser = argparse.ArgumentParser(
|
| 157 |
+
description="Generate benchmark planner for biometric measurement task."
|
| 158 |
+
)
|
| 159 |
+
parser.add_argument(
|
| 160 |
+
"-d",
|
| 161 |
+
"--dir_datasets_data",
|
| 162 |
+
type=str,
|
| 163 |
+
help="Directory path where datasets will be stored",
|
| 164 |
+
required=True,
|
| 165 |
+
)
|
| 166 |
+
parser.add_argument(
|
| 167 |
+
"-n",
|
| 168 |
+
"--dataset_name",
|
| 169 |
+
type=str,
|
| 170 |
+
help="Name of the dataset",
|
| 171 |
+
required=True,
|
| 172 |
+
)
|
| 173 |
+
parser.add_argument(
|
| 174 |
+
"--random_seed",
|
| 175 |
+
type=int,
|
| 176 |
+
default=1024,
|
| 177 |
+
help="Random seed for reproducibility",
|
| 178 |
+
)
|
| 179 |
+
parser.add_argument(
|
| 180 |
+
"--split_ratio",
|
| 181 |
+
type=float,
|
| 182 |
+
default=0.7,
|
| 183 |
+
help="Train/test split ratio (0-1)",
|
| 184 |
+
)
|
| 185 |
+
parser.add_argument(
|
| 186 |
+
"--shrunken_bbox_scale",
|
| 187 |
+
type=float,
|
| 188 |
+
default=0.9,
|
| 189 |
+
help="Scale factor for shrunken bounding box",
|
| 190 |
+
)
|
| 191 |
+
parser.add_argument(
|
| 192 |
+
"--enlarged_bbox_scale",
|
| 193 |
+
type=float,
|
| 194 |
+
default=1.1,
|
| 195 |
+
help="Scale factor for enlarged bounding box",
|
| 196 |
+
)
|
| 197 |
+
parser.add_argument(
|
| 198 |
+
"--force_uint16_mask",
|
| 199 |
+
action="store_true",
|
| 200 |
+
help="Force mask to be uint16",
|
| 201 |
+
)
|
| 202 |
+
parser.add_argument(
|
| 203 |
+
"--reorient2RAS",
|
| 204 |
+
action="store_true",
|
| 205 |
+
help="Reorient images and masks to RAS orientation",
|
| 206 |
+
)
|
| 207 |
+
parser.add_argument(
|
| 208 |
+
"--visualization",
|
| 209 |
+
action=argparse.BooleanOptionalAction,
|
| 210 |
+
default=True,
|
| 211 |
+
help="Save T/L ellipse landmark figures (Landmarks-Label<N>-fig); default: on",
|
| 212 |
+
)
|
| 213 |
+
args = parser.parse_args()
|
| 214 |
+
|
| 215 |
+
main(
|
| 216 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 217 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 218 |
+
dataset_name=args.dataset_name,
|
| 219 |
+
random_seed=args.random_seed,
|
| 220 |
+
split_ratio=args.split_ratio,
|
| 221 |
+
shrunken_bbox_scale=args.shrunken_bbox_scale,
|
| 222 |
+
enlarged_bbox_scale=args.enlarged_bbox_scale,
|
| 223 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 224 |
+
reorient2RAS=args.reorient2RAS,
|
| 225 |
+
visualization=args.visualization,
|
| 226 |
+
)
|
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerDetection
|
| 5 |
+
|
| 6 |
+
# ====================================
|
| 7 |
+
# Dataset Info [!]
|
| 8 |
+
# Do not change keys in
|
| 9 |
+
# - benchmark_plan
|
| 10 |
+
# ====================================
|
| 11 |
+
dataset_info = {
|
| 12 |
+
"dataset": "DEEP-PSMA",
|
| 13 |
+
"dataset_website": "https://deep-psma.grand-challenge.org/",
|
| 14 |
+
"dataset_data": [
|
| 15 |
+
"https://zenodo.org/records/15281784",
|
| 16 |
+
],
|
| 17 |
+
"license": ["CC BY-NC 4.0"],
|
| 18 |
+
"paper": ["https://doi.org/10.5281/zenodo.15281784"],
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
labels_map = {"1": "total tumor burden"}
|
| 22 |
+
|
| 23 |
+
benchmark_plan = {
|
| 24 |
+
"dataset_info": dataset_info,
|
| 25 |
+
"tasks": [
|
| 26 |
+
{
|
| 27 |
+
"image_modality": "PET",
|
| 28 |
+
"image_description": "prostate-specific membrane antigen (PSMA) positron emission tomography (PET) scan",
|
| 29 |
+
"image_folder": "Images-PSMA",
|
| 30 |
+
"mask_folder": "Masks-PSMA",
|
| 31 |
+
"image_prefix": "",
|
| 32 |
+
"image_suffix": ".nii.gz",
|
| 33 |
+
"mask_prefix": "",
|
| 34 |
+
"mask_suffix": ".nii.gz",
|
| 35 |
+
"labels_map": labels_map,
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"image_modality": "PET",
|
| 39 |
+
"image_description": "fluorodeoxyglucose (FDG) positron emission tomography (PET) scan",
|
| 40 |
+
"image_folder": "Images-FDG",
|
| 41 |
+
"mask_folder": "Masks-FDG",
|
| 42 |
+
"image_prefix": "",
|
| 43 |
+
"image_suffix": ".nii.gz",
|
| 44 |
+
"mask_prefix": "",
|
| 45 |
+
"mask_suffix": ".nii.gz",
|
| 46 |
+
"labels_map": labels_map,
|
| 47 |
+
},
|
| 48 |
+
],
|
| 49 |
+
}
|
| 50 |
+
# ====================================
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def main(
|
| 54 |
+
dir_datasets_data,
|
| 55 |
+
dataset_name,
|
| 56 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 57 |
+
random_seed=1024,
|
| 58 |
+
split_ratio=0.7,
|
| 59 |
+
force_uint16_mask=False,
|
| 60 |
+
reorient2RAS=False,
|
| 61 |
+
):
|
| 62 |
+
# Create dataset directory
|
| 63 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 64 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 65 |
+
|
| 66 |
+
# Change to dataset directory
|
| 67 |
+
os.chdir(dataset_dir)
|
| 68 |
+
|
| 69 |
+
# Process dataset for detection task
|
| 70 |
+
planner = MedVision_BenchmarkPlannerDetection(
|
| 71 |
+
dataset_dir=dataset_dir,
|
| 72 |
+
bm_plan=benchmark_plan,
|
| 73 |
+
dataset_name=dataset_name,
|
| 74 |
+
seed=random_seed,
|
| 75 |
+
split_ratio=split_ratio,
|
| 76 |
+
force_uint16_mask=force_uint16_mask,
|
| 77 |
+
reorient2RAS=reorient2RAS,
|
| 78 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 79 |
+
)
|
| 80 |
+
planner.process()
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
if __name__ == "__main__":
|
| 84 |
+
# Set up argument parser
|
| 85 |
+
parser = argparse.ArgumentParser(
|
| 86 |
+
description="Generate benchmark planner for detection task."
|
| 87 |
+
)
|
| 88 |
+
parser.add_argument(
|
| 89 |
+
"-d",
|
| 90 |
+
"--dir_datasets_data",
|
| 91 |
+
type=str,
|
| 92 |
+
help="Directory path where datasets will be stored",
|
| 93 |
+
required=True,
|
| 94 |
+
)
|
| 95 |
+
parser.add_argument(
|
| 96 |
+
"-n",
|
| 97 |
+
"--dataset_name",
|
| 98 |
+
type=str,
|
| 99 |
+
help="Name of the dataset",
|
| 100 |
+
required=True,
|
| 101 |
+
)
|
| 102 |
+
parser.add_argument(
|
| 103 |
+
"--random_seed",
|
| 104 |
+
type=int,
|
| 105 |
+
default=1024,
|
| 106 |
+
help="Random seed for reproducibility",
|
| 107 |
+
)
|
| 108 |
+
parser.add_argument(
|
| 109 |
+
"--split_ratio",
|
| 110 |
+
type=float,
|
| 111 |
+
default=0.7,
|
| 112 |
+
help="Train/test split ratio (0-1)",
|
| 113 |
+
)
|
| 114 |
+
parser.add_argument(
|
| 115 |
+
"--force_uint16_mask",
|
| 116 |
+
action="store_true",
|
| 117 |
+
help="Force mask to be uint16",
|
| 118 |
+
)
|
| 119 |
+
parser.add_argument(
|
| 120 |
+
"--reorient2RAS",
|
| 121 |
+
action="store_true",
|
| 122 |
+
help="Reorient images and masks to RAS orientation",
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
args = parser.parse_args()
|
| 126 |
+
|
| 127 |
+
main(
|
| 128 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 129 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 130 |
+
dataset_name=args.dataset_name,
|
| 131 |
+
random_seed=args.random_seed,
|
| 132 |
+
split_ratio=args.split_ratio,
|
| 133 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 134 |
+
reorient2RAS=args.reorient2RAS,
|
| 135 |
+
)
|
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerSegmentation
|
| 5 |
+
|
| 6 |
+
# ====================================
|
| 7 |
+
# Dataset Info [!]
|
| 8 |
+
# Do not change keys in
|
| 9 |
+
# - benchmark_plan
|
| 10 |
+
# ====================================
|
| 11 |
+
dataset_info = {
|
| 12 |
+
"dataset": "DEEP-PSMA",
|
| 13 |
+
"dataset_website": "https://deep-psma.grand-challenge.org/",
|
| 14 |
+
"dataset_data": [
|
| 15 |
+
"https://zenodo.org/records/15281784",
|
| 16 |
+
],
|
| 17 |
+
"license": ["CC BY-NC 4.0"],
|
| 18 |
+
"paper": ["https://doi.org/10.5281/zenodo.15281784"],
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
labels_map = {"1": "total tumor burden"}
|
| 22 |
+
|
| 23 |
+
benchmark_plan = {
|
| 24 |
+
"dataset_info": dataset_info,
|
| 25 |
+
"tasks": [
|
| 26 |
+
{
|
| 27 |
+
"image_modality": "PET",
|
| 28 |
+
"image_description": "prostate-specific membrane antigen (PSMA) positron emission tomography (PET) scan",
|
| 29 |
+
"image_folder": "Images-PSMA",
|
| 30 |
+
"mask_folder": "Masks-PSMA",
|
| 31 |
+
"image_prefix": "",
|
| 32 |
+
"image_suffix": ".nii.gz",
|
| 33 |
+
"mask_prefix": "",
|
| 34 |
+
"mask_suffix": ".nii.gz",
|
| 35 |
+
"labels_map": labels_map,
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"image_modality": "PET",
|
| 39 |
+
"image_description": "fluorodeoxyglucose (FDG) positron emission tomography (PET) scan",
|
| 40 |
+
"image_folder": "Images-FDG",
|
| 41 |
+
"mask_folder": "Masks-FDG",
|
| 42 |
+
"image_prefix": "",
|
| 43 |
+
"image_suffix": ".nii.gz",
|
| 44 |
+
"mask_prefix": "",
|
| 45 |
+
"mask_suffix": ".nii.gz",
|
| 46 |
+
"labels_map": labels_map,
|
| 47 |
+
},
|
| 48 |
+
],
|
| 49 |
+
}
|
| 50 |
+
# ====================================
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def main(
|
| 54 |
+
dir_datasets_data,
|
| 55 |
+
dataset_name,
|
| 56 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 57 |
+
random_seed=1024,
|
| 58 |
+
split_ratio=0.7,
|
| 59 |
+
force_uint16_mask=False,
|
| 60 |
+
reorient2RAS=False,
|
| 61 |
+
):
|
| 62 |
+
# Create dataset directory
|
| 63 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 64 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 65 |
+
|
| 66 |
+
# Change to dataset directory
|
| 67 |
+
os.chdir(dataset_dir)
|
| 68 |
+
|
| 69 |
+
# Process dataset for segmentation task
|
| 70 |
+
planner = MedVision_BenchmarkPlannerSegmentation(
|
| 71 |
+
dataset_dir=dataset_dir,
|
| 72 |
+
bm_plan=benchmark_plan,
|
| 73 |
+
dataset_name=dataset_name,
|
| 74 |
+
seed=random_seed,
|
| 75 |
+
split_ratio=split_ratio,
|
| 76 |
+
force_uint16_mask=force_uint16_mask,
|
| 77 |
+
reorient2RAS=reorient2RAS,
|
| 78 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 79 |
+
)
|
| 80 |
+
planner.process()
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
if __name__ == "__main__":
|
| 84 |
+
# Set up argument parser
|
| 85 |
+
parser = argparse.ArgumentParser(
|
| 86 |
+
description="Generate benchmark planner for segmentation task."
|
| 87 |
+
)
|
| 88 |
+
parser.add_argument(
|
| 89 |
+
"-d",
|
| 90 |
+
"--dir_datasets_data",
|
| 91 |
+
type=str,
|
| 92 |
+
help="Directory path where datasets will be stored",
|
| 93 |
+
required=True,
|
| 94 |
+
)
|
| 95 |
+
parser.add_argument(
|
| 96 |
+
"-n",
|
| 97 |
+
"--dataset_name",
|
| 98 |
+
type=str,
|
| 99 |
+
help="Name of the dataset",
|
| 100 |
+
required=True,
|
| 101 |
+
)
|
| 102 |
+
parser.add_argument(
|
| 103 |
+
"--random_seed",
|
| 104 |
+
type=int,
|
| 105 |
+
default=1024,
|
| 106 |
+
help="Random seed for reproducibility",
|
| 107 |
+
)
|
| 108 |
+
parser.add_argument(
|
| 109 |
+
"--split_ratio",
|
| 110 |
+
type=float,
|
| 111 |
+
default=0.7,
|
| 112 |
+
help="Train/test split ratio (0-1)",
|
| 113 |
+
)
|
| 114 |
+
parser.add_argument(
|
| 115 |
+
"--force_uint16_mask",
|
| 116 |
+
action="store_true",
|
| 117 |
+
help="Force mask to be uint16",
|
| 118 |
+
)
|
| 119 |
+
parser.add_argument(
|
| 120 |
+
"--reorient2RAS",
|
| 121 |
+
action="store_true",
|
| 122 |
+
help="Reorient images and masks to RAS orientation",
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
args = parser.parse_args()
|
| 126 |
+
|
| 127 |
+
main(
|
| 128 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 129 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 130 |
+
dataset_name=args.dataset_name,
|
| 131 |
+
random_seed=args.random_seed,
|
| 132 |
+
split_ratio=args.split_ratio,
|
| 133 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 134 |
+
reorient2RAS=args.reorient2RAS,
|
| 135 |
+
)
|
|
File without changes
|
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import zipfile
|
| 6 |
+
from huggingface_hub import snapshot_download
|
| 7 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# ====================================
|
| 11 |
+
# Dataset Info [!]
|
| 12 |
+
# ====================================
|
| 13 |
+
# Dataset: LIDC-IDRI
|
| 14 |
+
# Website: https://www.cancerimagingarchive.net/collection/lidc-idri/
|
| 15 |
+
# Official Release: TCIA collection 'LIDC-IDRI' via the NBIA REST API
|
| 16 |
+
# HF Release: https://huggingface.co/datasets/YongchengYAO/LIDC-IDRI-Lite
|
| 17 |
+
# Format: nii.gz
|
| 18 |
+
# NOTE: the HF mirror holds all 1018 CT series; the 237 DX / 53 CR projection-radiograph
|
| 19 |
+
# series in the same collection are omitted, hence '-Lite'.
|
| 20 |
+
# ====================================
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 25 |
+
"""
|
| 26 |
+
Download and extract the LIDC-IDRI dataset from the HuggingFace mirror.
|
| 27 |
+
|
| 28 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 29 |
+
the other arguments must be kwargs
|
| 30 |
+
"""
|
| 31 |
+
# Download files
|
| 32 |
+
current_dir = os.getcwd()
|
| 33 |
+
os.chdir(dataset_dir)
|
| 34 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 35 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 36 |
+
os.chdir(tmp_dir)
|
| 37 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 38 |
+
|
| 39 |
+
# ====================================
|
| 40 |
+
# Add download logic here [!]
|
| 41 |
+
# ====================================
|
| 42 |
+
# Download dataset (image + mask archives, sharded as data-part*.zip)
|
| 43 |
+
snapshot_download(
|
| 44 |
+
repo_id="YongchengYAO/LIDC-IDRI-Lite",
|
| 45 |
+
allow_patterns="*.zip",
|
| 46 |
+
repo_type="dataset",
|
| 47 |
+
revision="1488897f4df642f530f53eabd81cf02dfcc82d70", # squashed single commit, 2026-07-27
|
| 48 |
+
local_dir=".",
|
| 49 |
+
max_workers=kwargs.get("max_workers", 1),
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# Extract all zip files
|
| 53 |
+
for zip_file in sorted(glob.glob("*.zip")):
|
| 54 |
+
print(f"extracting {zip_file}")
|
| 55 |
+
with zipfile.ZipFile(zip_file, "r") as zip_ref:
|
| 56 |
+
zip_ref.extractall(".")
|
| 57 |
+
os.remove(zip_file)
|
| 58 |
+
print(f"{zip_file} deleted")
|
| 59 |
+
|
| 60 |
+
# Move folder to dataset_dir
|
| 61 |
+
folders_to_move = [
|
| 62 |
+
"Images",
|
| 63 |
+
"Masks",
|
| 64 |
+
]
|
| 65 |
+
for folder in folders_to_move:
|
| 66 |
+
move_folder(
|
| 67 |
+
os.path.join(tmp_dir, folder),
|
| 68 |
+
os.path.join(dataset_dir, folder),
|
| 69 |
+
create_dest=True,
|
| 70 |
+
)
|
| 71 |
+
# ====================================
|
| 72 |
+
|
| 73 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 74 |
+
os.chdir(dataset_dir)
|
| 75 |
+
shutil.rmtree(tmp_dir)
|
| 76 |
+
os.chdir(current_dir)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 80 |
+
# Create dataset directory
|
| 81 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 82 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 83 |
+
|
| 84 |
+
# Change to dataset directory
|
| 85 |
+
os.chdir(dataset_dir)
|
| 86 |
+
|
| 87 |
+
# Download and extract dataset
|
| 88 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
if __name__ == "__main__":
|
| 92 |
+
# Set up argument parser
|
| 93 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 94 |
+
parser.add_argument(
|
| 95 |
+
"-d",
|
| 96 |
+
"--dir_datasets_data",
|
| 97 |
+
help="Directory path where datasets will be stored",
|
| 98 |
+
required=True,
|
| 99 |
+
)
|
| 100 |
+
parser.add_argument(
|
| 101 |
+
"-n",
|
| 102 |
+
"--dataset_name",
|
| 103 |
+
help="Name of the dataset",
|
| 104 |
+
required=True,
|
| 105 |
+
)
|
| 106 |
+
parser.add_argument(
|
| 107 |
+
"--max_workers",
|
| 108 |
+
type=int,
|
| 109 |
+
default=1,
|
| 110 |
+
help="Maximum number of workers for download",
|
| 111 |
+
)
|
| 112 |
+
args = parser.parse_args()
|
| 113 |
+
|
| 114 |
+
# Extract known arguments and pass the rest as kwargs
|
| 115 |
+
kwargs = {"max_workers": args.max_workers}
|
| 116 |
+
|
| 117 |
+
main(
|
| 118 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 119 |
+
dataset_name=args.dataset_name,
|
| 120 |
+
**kwargs,
|
| 121 |
+
)
|
|
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import json
|
| 6 |
+
import zipfile
|
| 7 |
+
import urllib.request
|
| 8 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
import SimpleITK as sitk
|
| 12 |
+
import pydicom
|
| 13 |
+
|
| 14 |
+
from medvision_ds.utils.preprocess_utils import move_folder, _get_cgroup_limited_cpus
|
| 15 |
+
from medvision_ds.utils.data_conversion import (
|
| 16 |
+
copy_img_header_to_mask,
|
| 17 |
+
convert_mask_to_uint16_per_dir,
|
| 18 |
+
reorient_niigz_RASplus_batch_inplace,
|
| 19 |
+
)
|
| 20 |
+
from medvision_ds.utils.download_utils import download_url, retry_call
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# ====================================
|
| 24 |
+
# Dataset Info [!]
|
| 25 |
+
# ====================================
|
| 26 |
+
# Dataset: LIDC-IDRI (Lung Image Database Consortium / Image Database Resource Initiative)
|
| 27 |
+
# Website: https://www.cancerimagingarchive.net/collection/lidc-idri/
|
| 28 |
+
# Data: TCIA collection "LIDC-IDRI" via the NBIA REST API (no authentication required)
|
| 29 |
+
# Format: DICOM (CT series) + XML radiologist nodule contours (read via pylidc)
|
| 30 |
+
# Notes:
|
| 31 |
+
# - 1018 CT series are selected; DX (237) and CR (53) series are excluded by Modality.
|
| 32 |
+
# - 5 of those carry duplicate-z slices and are EXCLUDED -> 1013 shipped (see
|
| 33 |
+
# _sorted_slice_files for why they cannot be reconstructed unambiguously).
|
| 34 |
+
# - Masks are consensus binary nodule masks built with pylidc.
|
| 35 |
+
# - 880/1013 scans have >=1 nodule; the rest get an empty (all-zero) mask.
|
| 36 |
+
# - 8 patients have 2 CT series -> each series gets a unique caseID.
|
| 37 |
+
# ====================================
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# NBIA (National Biomedical Imaging Archive) public REST endpoint.
|
| 41 |
+
NBIA_BASE = "https://services.cancerimagingarchive.net/nbia-api/services/v1"
|
| 42 |
+
COLLECTION = "LIDC-IDRI"
|
| 43 |
+
|
| 44 |
+
# CT series carrying duplicate-z slices, excluded from the dataset (see _sorted_slice_files).
|
| 45 |
+
# Identified by comparing each series' NBIA ImageCount against its reconstructed slice count:
|
| 46 |
+
# LIDC-IDRI-0085 (268->267), -0146 (310->309), -0418 (231->226), -0572 (448->447),
|
| 47 |
+
# -0979 (254->249). 1018 CT series - 5 = 1013 shipped.
|
| 48 |
+
N_DUPLICATE_Z_EXPECTED = 5
|
| 49 |
+
N_SHIPPED_SCANS_EXPECTED = 1013
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def _get_ct_series():
|
| 53 |
+
"""Query the NBIA REST API for all CT series in the LIDC-IDRI collection."""
|
| 54 |
+
url = f"{NBIA_BASE}/getSeries?Collection={COLLECTION}"
|
| 55 |
+
|
| 56 |
+
def _fetch():
|
| 57 |
+
with urllib.request.urlopen(url) as resp:
|
| 58 |
+
return json.load(resp)
|
| 59 |
+
|
| 60 |
+
series = retry_call(_fetch, label="getSeries")
|
| 61 |
+
# Keep CT only; explicitly drop DX / CR (X-ray) series.
|
| 62 |
+
ct_series = [s for s in series if s.get("Modality") == "CT"]
|
| 63 |
+
print(f"Found {len(ct_series)} CT series (of {len(series)} total) in {COLLECTION}")
|
| 64 |
+
return ct_series
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def _download_series(series, dicom_root):
|
| 68 |
+
"""Download one DICOM series zip and extract it into a TCIA-style folder layout.
|
| 69 |
+
|
| 70 |
+
Layout produced (what pylidc expects to scan):
|
| 71 |
+
<dicom_root>/<PatientID>/<StudyInstanceUID>/<SeriesInstanceUID>/*.dcm
|
| 72 |
+
"""
|
| 73 |
+
uid = series["SeriesInstanceUID"]
|
| 74 |
+
patient = series["PatientID"]
|
| 75 |
+
study = series["StudyInstanceUID"]
|
| 76 |
+
out_dir = os.path.join(dicom_root, patient, study, uid)
|
| 77 |
+
os.makedirs(out_dir, exist_ok=True)
|
| 78 |
+
|
| 79 |
+
zip_path = out_dir + ".zip"
|
| 80 |
+
url = f"{NBIA_BASE}/getImage?SeriesInstanceUID={uid}"
|
| 81 |
+
try:
|
| 82 |
+
# NBIA getImage streams the zip with chunked encoding (no Content-Length) and
|
| 83 |
+
# ignores Range, so download_url's size check is a no-op here: a corrupt/truncated
|
| 84 |
+
# zip surfaces at extract time. Validate the archive and, on any failure, remove
|
| 85 |
+
# the partial zip AND the half-populated series dir so pylidc never sees an
|
| 86 |
+
# incomplete series and so a retry starts clean.
|
| 87 |
+
download_url(url, zip_path)
|
| 88 |
+
with zipfile.ZipFile(zip_path) as zf:
|
| 89 |
+
bad = zf.testzip()
|
| 90 |
+
if bad is not None:
|
| 91 |
+
raise zipfile.BadZipFile(f"CRC error in {bad}")
|
| 92 |
+
zf.extractall(out_dir)
|
| 93 |
+
os.remove(zip_path)
|
| 94 |
+
except Exception:
|
| 95 |
+
shutil.rmtree(out_dir, ignore_errors=True)
|
| 96 |
+
if os.path.exists(zip_path):
|
| 97 |
+
os.remove(zip_path)
|
| 98 |
+
raise
|
| 99 |
+
return out_dir
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class DuplicateSliceError(Exception):
|
| 103 |
+
"""A series contains more than one DICOM slice at the same z position."""
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def _sorted_slice_files(series_dir):
|
| 107 |
+
"""Return DICOM file paths sorted by ImagePositionPatient z.
|
| 108 |
+
|
| 109 |
+
Raises ``DuplicateSliceError`` if any z is shared by more than one slice.
|
| 110 |
+
|
| 111 |
+
5 of the 1018 LIDC CT series contain duplicate-z slices (LIDC-IDRI-0085, -0146, -0418,
|
| 112 |
+
-0572, -0979). Such a series has no single well-defined volume: something has to choose
|
| 113 |
+
which of the co-located slices to keep, and the mask is built separately by pylidc, whose
|
| 114 |
+
``consensus()`` returns *array indices* into its own view of the volume. Two independent
|
| 115 |
+
reconstructions then have to agree index-for-index or the nodule contour lands on the
|
| 116 |
+
wrong slice — a silent failure that produces a correctly-shaped mask over the wrong
|
| 117 |
+
anatomy.
|
| 118 |
+
|
| 119 |
+
Rather than depend on reproducing pylidc's internal tie-break, these series are excluded
|
| 120 |
+
from the dataset. The cost is 5 scans; the benefit is that no shipped case relies on two
|
| 121 |
+
libraries happening to prune identically.
|
| 122 |
+
"""
|
| 123 |
+
files = glob.glob(os.path.join(series_dir, "*.dcm"))
|
| 124 |
+
items = []
|
| 125 |
+
for f in files:
|
| 126 |
+
d = pydicom.dcmread(f, stop_before_pixels=True)
|
| 127 |
+
z = float(d.ImagePositionPatient[2])
|
| 128 |
+
items.append((z, float(d.InstanceNumber), f))
|
| 129 |
+
items.sort(key=lambda t: (t[0], t[1]))
|
| 130 |
+
|
| 131 |
+
zs = [t[0] for t in items]
|
| 132 |
+
if len(set(zs)) != len(zs):
|
| 133 |
+
n_dup = len(zs) - len(set(zs))
|
| 134 |
+
raise DuplicateSliceError(
|
| 135 |
+
f"{n_dup} duplicate-z slice(s) among {len(zs)} in {os.path.basename(series_dir)}"
|
| 136 |
+
)
|
| 137 |
+
return [f for _, _, f in items]
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
def _series_to_nifti(series_dir, out_path):
|
| 141 |
+
"""Read a DICOM series with SimpleITK (z-sorted) and write NIfTI.
|
| 142 |
+
|
| 143 |
+
Propagates ``DuplicateSliceError`` for series with co-located slices; the caller excludes
|
| 144 |
+
those cases.
|
| 145 |
+
"""
|
| 146 |
+
files = _sorted_slice_files(series_dir)
|
| 147 |
+
reader = sitk.ImageSeriesReader()
|
| 148 |
+
reader.SetFileNames(files)
|
| 149 |
+
img = reader.Execute()
|
| 150 |
+
sitk.WriteImage(img, out_path)
|
| 151 |
+
return img
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def _consensus_mask(scan, ref_img, out_path):
|
| 155 |
+
"""Build a per-scan consensus binary nodule mask on the CT grid and write NIfTI.
|
| 156 |
+
|
| 157 |
+
Uses pylidc: annotations are grouped into nodule clusters, and for each cluster a
|
| 158 |
+
consensus mask is built including a voxel when >=50% of the readers who saw that
|
| 159 |
+
nodule marked it (clevel=0.5).
|
| 160 |
+
"""
|
| 161 |
+
_patch_numpy_aliases()
|
| 162 |
+
from pylidc.utils import consensus
|
| 163 |
+
|
| 164 |
+
# SimpleITK array order is (z, y, x); pylidc volume/consensus order is (y, x, z).
|
| 165 |
+
z, y, x = sitk.GetArrayFromImage(ref_img).shape
|
| 166 |
+
mask_yxz = np.zeros((y, x, z), dtype=np.uint8)
|
| 167 |
+
|
| 168 |
+
for anns in scan.cluster_annotations():
|
| 169 |
+
# cmask: bbox-local boolean mask; cbbox: tuple of slices into the (y, x, z) volume.
|
| 170 |
+
cmask, cbbox, _ = consensus(anns, clevel=0.5)
|
| 171 |
+
mask_yxz[cbbox] = np.maximum(mask_yxz[cbbox], cmask.astype(np.uint8))
|
| 172 |
+
|
| 173 |
+
# Reorder (y, x, z) -> (z, y, x) to match the SimpleITK image, then copy geometry.
|
| 174 |
+
mask_zyx = np.transpose(mask_yxz, (2, 0, 1))
|
| 175 |
+
mask_img = sitk.GetImageFromArray(mask_zyx.astype(np.uint16))
|
| 176 |
+
mask_img.CopyInformation(ref_img)
|
| 177 |
+
sitk.WriteImage(mask_img, out_path)
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
def _patch_numpy_aliases():
|
| 181 |
+
"""Restore the numpy aliases removed in numpy>=1.24 that pylidc 0.2.3 still uses.
|
| 182 |
+
|
| 183 |
+
pylidc is unmaintained and calls ``np.int`` / ``np.bool`` / ``np.float`` in
|
| 184 |
+
Contour.to_matrix and Annotation.boolean_mask. Without this shim every call to
|
| 185 |
+
``cluster_annotations()`` raises AttributeError.
|
| 186 |
+
"""
|
| 187 |
+
for name, builtin in (("int", int), ("bool", bool), ("float", float)):
|
| 188 |
+
if not hasattr(np, name):
|
| 189 |
+
setattr(np, name, builtin)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
def _configure_pylidc(dicom_root):
|
| 193 |
+
"""Write ~/.pylidcrc so pylidc can locate the downloaded DICOM tree."""
|
| 194 |
+
rc_path = os.path.join(os.path.expanduser("~"), ".pylidcrc")
|
| 195 |
+
with open(rc_path, "w") as f:
|
| 196 |
+
f.write("[dicom]\n")
|
| 197 |
+
f.write(f"path = {dicom_root}\n")
|
| 198 |
+
f.write("warn = True\n")
|
| 199 |
+
return rc_path
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 203 |
+
"""
|
| 204 |
+
Download and extract the LIDC-IDRI dataset.
|
| 205 |
+
|
| 206 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 207 |
+
the other arguments must be kwargs
|
| 208 |
+
"""
|
| 209 |
+
max_workers = kwargs.get("max_workers", 1)
|
| 210 |
+
available_cpus = _get_cgroup_limited_cpus()
|
| 211 |
+
|
| 212 |
+
# Download files
|
| 213 |
+
current_dir = os.getcwd()
|
| 214 |
+
os.chdir(dataset_dir)
|
| 215 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 216 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 217 |
+
os.chdir(tmp_dir)
|
| 218 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 219 |
+
|
| 220 |
+
# ====================================
|
| 221 |
+
# Add download logic here [!]
|
| 222 |
+
# ====================================
|
| 223 |
+
dicom_root = os.path.join(tmp_dir, "DICOM")
|
| 224 |
+
os.makedirs(dicom_root, exist_ok=True)
|
| 225 |
+
|
| 226 |
+
# 1) List and download CT series from NBIA (parallel across series).
|
| 227 |
+
ct_series = _get_ct_series()
|
| 228 |
+
failed_series = []
|
| 229 |
+
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
| 230 |
+
futures = {
|
| 231 |
+
executor.submit(_download_series, s, dicom_root): s for s in ct_series
|
| 232 |
+
}
|
| 233 |
+
for fut in as_completed(futures):
|
| 234 |
+
s = futures[fut]
|
| 235 |
+
try:
|
| 236 |
+
fut.result()
|
| 237 |
+
except Exception as e:
|
| 238 |
+
# One unrecoverable series (exhausted download retries or a corrupt zip)
|
| 239 |
+
# must NOT abort a 1018-series / 128 GB run. Skip + log; the partial series
|
| 240 |
+
# dir was already cleaned by _download_series so pylidc just won't see it.
|
| 241 |
+
uid = s.get("SeriesInstanceUID")
|
| 242 |
+
print(f"WARNING: skipping series {uid} after download failure: {e}")
|
| 243 |
+
failed_series.append(uid)
|
| 244 |
+
if failed_series:
|
| 245 |
+
print(
|
| 246 |
+
f"WARNING: {len(failed_series)}/{len(ct_series)} CT series failed download "
|
| 247 |
+
f"and were skipped:"
|
| 248 |
+
)
|
| 249 |
+
for uid in failed_series:
|
| 250 |
+
print(f" - {uid}")
|
| 251 |
+
|
| 252 |
+
# 2) Configure pylidc against the downloaded DICOM tree and import it.
|
| 253 |
+
_configure_pylidc(dicom_root)
|
| 254 |
+
_patch_numpy_aliases()
|
| 255 |
+
import pylidc as pl
|
| 256 |
+
|
| 257 |
+
# 3) Build Images (SimpleITK) + consensus Masks (pylidc) per scan.
|
| 258 |
+
os.makedirs("Images", exist_ok=True)
|
| 259 |
+
os.makedirs("Masks", exist_ok=True)
|
| 260 |
+
|
| 261 |
+
scans = pl.query(pl.Scan).all()
|
| 262 |
+
by_patient = {}
|
| 263 |
+
for sc in scans:
|
| 264 |
+
by_patient.setdefault(sc.patient_id, []).append(sc)
|
| 265 |
+
|
| 266 |
+
n_done = 0
|
| 267 |
+
n_ok = 0
|
| 268 |
+
failed_scans = []
|
| 269 |
+
excluded_scans = []
|
| 270 |
+
for patient_id, patient_scans in by_patient.items():
|
| 271 |
+
for idx, sc in enumerate(patient_scans):
|
| 272 |
+
# Unique caseID per series (8 patients have 2 CT series).
|
| 273 |
+
case_id = patient_id if len(patient_scans) == 1 else f"{patient_id}-{idx + 1}"
|
| 274 |
+
n_done += 1
|
| 275 |
+
|
| 276 |
+
img_path = os.path.join("Images", f"{case_id}.nii.gz")
|
| 277 |
+
mask_path = os.path.join("Masks", f"{case_id}.nii.gz")
|
| 278 |
+
|
| 279 |
+
# Isolate per-scan failures: heterogeneous LIDC scans (inconsistent slice
|
| 280 |
+
# spacing, odd annotations, sitk/pylidc quirks) that the sampled cases never
|
| 281 |
+
# exercised must not abort the whole conversion AFTER a 128 GB download.
|
| 282 |
+
# On failure, drop any partial nii.gz so step 4 never sees an image without
|
| 283 |
+
# its matching mask.
|
| 284 |
+
try:
|
| 285 |
+
series_dir = sc.get_path_to_dicom_files()
|
| 286 |
+
ref_img = _series_to_nifti(series_dir, img_path)
|
| 287 |
+
_consensus_mask(sc, ref_img, mask_path)
|
| 288 |
+
except DuplicateSliceError as e:
|
| 289 |
+
# Excluded by rule, not a failure: a duplicate-z series has no single
|
| 290 |
+
# well-defined volume, and image/mask are reconstructed independently.
|
| 291 |
+
print(f"EXCLUDING case {case_id} ({n_done}/{len(scans)}): {e}")
|
| 292 |
+
for p in (img_path, mask_path):
|
| 293 |
+
if os.path.exists(p):
|
| 294 |
+
os.remove(p)
|
| 295 |
+
excluded_scans.append(case_id)
|
| 296 |
+
continue
|
| 297 |
+
except Exception as e:
|
| 298 |
+
print(
|
| 299 |
+
f"WARNING: skipping case {case_id} ({n_done}/{len(scans)}) "
|
| 300 |
+
f"after conversion failure: {e}"
|
| 301 |
+
)
|
| 302 |
+
for p in (img_path, mask_path):
|
| 303 |
+
if os.path.exists(p):
|
| 304 |
+
os.remove(p)
|
| 305 |
+
failed_scans.append(case_id)
|
| 306 |
+
continue
|
| 307 |
+
|
| 308 |
+
n_ok += 1
|
| 309 |
+
print(f"Processed {case_id} ({n_ok} ok / {n_done} of {len(scans)})")
|
| 310 |
+
|
| 311 |
+
if excluded_scans:
|
| 312 |
+
print(
|
| 313 |
+
f"Excluded {len(excluded_scans)}/{len(scans)} duplicate-z scans "
|
| 314 |
+
f"(expected {N_DUPLICATE_Z_EXPECTED}): {sorted(excluded_scans)}"
|
| 315 |
+
)
|
| 316 |
+
assert len(excluded_scans) == N_DUPLICATE_Z_EXPECTED, (
|
| 317 |
+
f"expected {N_DUPLICATE_Z_EXPECTED} duplicate-z scans, excluded "
|
| 318 |
+
f"{len(excluded_scans)}: {sorted(excluded_scans)}"
|
| 319 |
+
)
|
| 320 |
+
if failed_scans:
|
| 321 |
+
print(
|
| 322 |
+
f"WARNING: {len(failed_scans)}/{len(scans)} scans failed conversion "
|
| 323 |
+
f"and were skipped: {failed_scans}"
|
| 324 |
+
)
|
| 325 |
+
|
| 326 |
+
# 4) Copy image headers to masks, then enforce uint16 (order matters).
|
| 327 |
+
print("Copying Nifti headers from images to masks...")
|
| 328 |
+
img_files = list(glob.glob(os.path.join("Images", "*.nii.gz")))
|
| 329 |
+
copy_img_header_to_mask(img_files, "Masks", workers_limit=available_cpus)
|
| 330 |
+
convert_mask_to_uint16_per_dir("Masks", workers_limit=available_cpus)
|
| 331 |
+
|
| 332 |
+
# 5) Reorient Images + Masks to RAS+ (in place, dtype-preserving, idempotent).
|
| 333 |
+
reorient_niigz_RASplus_batch_inplace(os.path.join(tmp_dir, "Images"), available_cpus)
|
| 334 |
+
reorient_niigz_RASplus_batch_inplace(os.path.join(tmp_dir, "Masks"), available_cpus)
|
| 335 |
+
|
| 336 |
+
# Move folder to dataset_dir
|
| 337 |
+
folders_to_move = [
|
| 338 |
+
"Images",
|
| 339 |
+
"Masks",
|
| 340 |
+
]
|
| 341 |
+
for folder in folders_to_move:
|
| 342 |
+
move_folder(
|
| 343 |
+
os.path.join(tmp_dir, folder),
|
| 344 |
+
os.path.join(dataset_dir, folder),
|
| 345 |
+
create_dest=True,
|
| 346 |
+
)
|
| 347 |
+
# ====================================
|
| 348 |
+
|
| 349 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 350 |
+
os.chdir(dataset_dir)
|
| 351 |
+
shutil.rmtree(tmp_dir)
|
| 352 |
+
os.chdir(current_dir)
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 356 |
+
# Create dataset directory
|
| 357 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 358 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 359 |
+
|
| 360 |
+
# Change to dataset directory
|
| 361 |
+
os.chdir(dataset_dir)
|
| 362 |
+
|
| 363 |
+
# Download and extract dataset
|
| 364 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
if __name__ == "__main__":
|
| 368 |
+
# Set up argument parser
|
| 369 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 370 |
+
parser.add_argument(
|
| 371 |
+
"-d",
|
| 372 |
+
"--dir_datasets_data",
|
| 373 |
+
help="Directory path where datasets will be stored",
|
| 374 |
+
required=True,
|
| 375 |
+
)
|
| 376 |
+
parser.add_argument(
|
| 377 |
+
"-n",
|
| 378 |
+
"--dataset_name",
|
| 379 |
+
help="Name of the dataset",
|
| 380 |
+
required=True,
|
| 381 |
+
)
|
| 382 |
+
parser.add_argument(
|
| 383 |
+
"--max_workers",
|
| 384 |
+
type=int,
|
| 385 |
+
default=1,
|
| 386 |
+
help="Maximum number of workers for download",
|
| 387 |
+
)
|
| 388 |
+
args = parser.parse_args()
|
| 389 |
+
|
| 390 |
+
# Extract known arguments and pass the rest as kwargs
|
| 391 |
+
kwargs = {"max_workers": args.max_workers}
|
| 392 |
+
|
| 393 |
+
main(
|
| 394 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 395 |
+
dataset_name=args.dataset_name,
|
| 396 |
+
**kwargs,
|
| 397 |
+
)
|
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerBiometry_fromSeg
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# ====================================
|
| 12 |
+
CLUSTER_SIZE_THRESHOLD = 10
|
| 13 |
+
|
| 14 |
+
dataset_info = {
|
| 15 |
+
"dataset": "LIDC-IDRI",
|
| 16 |
+
"dataset_website": "https://www.cancerimagingarchive.net/collection/lidc-idri/",
|
| 17 |
+
"dataset_data": [
|
| 18 |
+
"https://www.cancerimagingarchive.net/collection/lidc-idri/",
|
| 19 |
+
],
|
| 20 |
+
"license": ["CC BY 3.0"],
|
| 21 |
+
"paper": ["https://doi.org/10.1118/1.3528204"],
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
labels_map = {
|
| 25 |
+
"1": "lung nodule",
|
| 26 |
+
}
|
| 27 |
+
# ====================================
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# ===============
|
| 31 |
+
# DO NOT CHANGE
|
| 32 |
+
# ===============
|
| 33 |
+
landmarks_map = {
|
| 34 |
+
"P1": "most right/anterior/superior endpoint of the major axis",
|
| 35 |
+
"P2": "most left/superior/inferior endpoint of the major axis",
|
| 36 |
+
"P3": "most right/anterior/superior endpoint of the minor axis",
|
| 37 |
+
"P4": "most left/superior/inferior endpoint of the minor axis",
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
lines_map = {
|
| 41 |
+
"L-1-2": {
|
| 42 |
+
"name": "marjor axis of the fitted ellipse",
|
| 43 |
+
"element_keys": ["P1", "P2"],
|
| 44 |
+
"element_map_name": "landmarks_map",
|
| 45 |
+
},
|
| 46 |
+
"L-3-4": {
|
| 47 |
+
"name": "minor axis of the fitted ellipse",
|
| 48 |
+
"element_keys": ["P3", "P4"],
|
| 49 |
+
"element_map_name": "landmarks_map",
|
| 50 |
+
},
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
angles_map = {}
|
| 54 |
+
|
| 55 |
+
biometrics_map = [
|
| 56 |
+
{
|
| 57 |
+
"metric_type": "distance",
|
| 58 |
+
"metric_map_name": "lines_map",
|
| 59 |
+
"metric_key": "L-1-2",
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"metric_type": "distance",
|
| 63 |
+
"metric_map_name": "lines_map",
|
| 64 |
+
"metric_key": "L-3-4",
|
| 65 |
+
},
|
| 66 |
+
]
|
| 67 |
+
# ===============
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
benchmark_plan = {
|
| 71 |
+
"dataset_info": dataset_info,
|
| 72 |
+
"tasks": [
|
| 73 |
+
{
|
| 74 |
+
"image_modality": "CT",
|
| 75 |
+
"image_description": "chest computed tomography (CT) scan",
|
| 76 |
+
"image_folder": "Images",
|
| 77 |
+
"mask_folder": "Masks",
|
| 78 |
+
"landmark_folder": "Landmarks-Label1",
|
| 79 |
+
"landmark_figure_folder": "Landmarks-Label1-fig",
|
| 80 |
+
"image_prefix": "",
|
| 81 |
+
"image_suffix": ".nii.gz",
|
| 82 |
+
"mask_prefix": "",
|
| 83 |
+
"mask_suffix": ".nii.gz",
|
| 84 |
+
"landmark_prefix": "",
|
| 85 |
+
"landmark_suffix": ".json.gz",
|
| 86 |
+
"labels_map": labels_map,
|
| 87 |
+
"landmarks_map": landmarks_map,
|
| 88 |
+
"lines_map": lines_map,
|
| 89 |
+
"angles_map": angles_map,
|
| 90 |
+
"biometrics_map": biometrics_map,
|
| 91 |
+
"target_label": 1,
|
| 92 |
+
"cluster_size_threshold": CLUSTER_SIZE_THRESHOLD,
|
| 93 |
+
},
|
| 94 |
+
],
|
| 95 |
+
}
|
| 96 |
+
# ====================================
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def main(
|
| 100 |
+
dir_datasets_data,
|
| 101 |
+
dataset_name,
|
| 102 |
+
benchmark_plan=benchmark_plan,
|
| 103 |
+
random_seed=1024,
|
| 104 |
+
split_ratio=0.7,
|
| 105 |
+
shrunken_bbox_scale=0.9,
|
| 106 |
+
enlarged_bbox_scale=1.1,
|
| 107 |
+
force_uint16_mask=False,
|
| 108 |
+
reorient2RAS=False,
|
| 109 |
+
visualization=True,
|
| 110 |
+
):
|
| 111 |
+
# Create dataset directory
|
| 112 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 113 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 114 |
+
|
| 115 |
+
# Change to dataset directory
|
| 116 |
+
os.chdir(dataset_dir)
|
| 117 |
+
|
| 118 |
+
# Process dataset for segmentation task
|
| 119 |
+
planner = MedVision_BenchmarkPlannerBiometry_fromSeg(
|
| 120 |
+
dataset_dir=dataset_dir,
|
| 121 |
+
bm_plan=benchmark_plan,
|
| 122 |
+
dataset_name=dataset_name,
|
| 123 |
+
seed=random_seed,
|
| 124 |
+
split_ratio=split_ratio,
|
| 125 |
+
shrunk_bbox_scale=shrunken_bbox_scale,
|
| 126 |
+
enlarged_bbox_scale=enlarged_bbox_scale,
|
| 127 |
+
force_uint16_mask=force_uint16_mask,
|
| 128 |
+
reorient2RAS=reorient2RAS,
|
| 129 |
+
visualization=visualization,
|
| 130 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 131 |
+
)
|
| 132 |
+
planner.process()
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
if __name__ == "__main__":
|
| 136 |
+
# Set up argument parser
|
| 137 |
+
parser = argparse.ArgumentParser(
|
| 138 |
+
description="Generate benchmark planner for biometric measurement task."
|
| 139 |
+
)
|
| 140 |
+
parser.add_argument(
|
| 141 |
+
"-d",
|
| 142 |
+
"--dir_datasets_data",
|
| 143 |
+
type=str,
|
| 144 |
+
help="Directory path where datasets will be stored",
|
| 145 |
+
required=True,
|
| 146 |
+
)
|
| 147 |
+
parser.add_argument(
|
| 148 |
+
"-n",
|
| 149 |
+
"--dataset_name",
|
| 150 |
+
type=str,
|
| 151 |
+
help="Name of the dataset",
|
| 152 |
+
required=True,
|
| 153 |
+
)
|
| 154 |
+
parser.add_argument(
|
| 155 |
+
"--random_seed",
|
| 156 |
+
type=int,
|
| 157 |
+
default=1024,
|
| 158 |
+
help="Random seed for reproducibility",
|
| 159 |
+
)
|
| 160 |
+
parser.add_argument(
|
| 161 |
+
"--split_ratio",
|
| 162 |
+
type=float,
|
| 163 |
+
default=0.7,
|
| 164 |
+
help="Train/test split ratio (0-1)",
|
| 165 |
+
)
|
| 166 |
+
parser.add_argument(
|
| 167 |
+
"--shrunken_bbox_scale",
|
| 168 |
+
type=float,
|
| 169 |
+
default=0.9,
|
| 170 |
+
help="Scale factor for shrunken bounding box",
|
| 171 |
+
)
|
| 172 |
+
parser.add_argument(
|
| 173 |
+
"--enlarged_bbox_scale",
|
| 174 |
+
type=float,
|
| 175 |
+
default=1.1,
|
| 176 |
+
help="Scale factor for enlarged bounding box",
|
| 177 |
+
)
|
| 178 |
+
parser.add_argument(
|
| 179 |
+
"--force_uint16_mask",
|
| 180 |
+
action="store_true",
|
| 181 |
+
help="Force mask to be uint16",
|
| 182 |
+
)
|
| 183 |
+
parser.add_argument(
|
| 184 |
+
"--reorient2RAS",
|
| 185 |
+
action="store_true",
|
| 186 |
+
help="Reorient images and masks to RAS orientation",
|
| 187 |
+
)
|
| 188 |
+
parser.add_argument(
|
| 189 |
+
"--visualization",
|
| 190 |
+
action=argparse.BooleanOptionalAction,
|
| 191 |
+
default=True,
|
| 192 |
+
help="Save T/L ellipse landmark figures (Landmarks-Label<N>-fig); default: on",
|
| 193 |
+
)
|
| 194 |
+
args = parser.parse_args()
|
| 195 |
+
|
| 196 |
+
main(
|
| 197 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 198 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 199 |
+
dataset_name=args.dataset_name,
|
| 200 |
+
random_seed=args.random_seed,
|
| 201 |
+
split_ratio=args.split_ratio,
|
| 202 |
+
shrunken_bbox_scale=args.shrunken_bbox_scale,
|
| 203 |
+
enlarged_bbox_scale=args.enlarged_bbox_scale,
|
| 204 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 205 |
+
reorient2RAS=args.reorient2RAS,
|
| 206 |
+
visualization=args.visualization,
|
| 207 |
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerDetection
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# - labels_map
|
| 12 |
+
# ====================================
|
| 13 |
+
dataset_info = {
|
| 14 |
+
"dataset": "LIDC-IDRI",
|
| 15 |
+
"dataset_website": "https://www.cancerimagingarchive.net/collection/lidc-idri/",
|
| 16 |
+
"dataset_data": [
|
| 17 |
+
"https://www.cancerimagingarchive.net/collection/lidc-idri/",
|
| 18 |
+
],
|
| 19 |
+
"license": ["CC BY 3.0"],
|
| 20 |
+
"paper": ["https://doi.org/10.1118/1.3528204"],
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
labels_map = {
|
| 24 |
+
"1": "lung nodule",
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
benchmark_plan = {
|
| 28 |
+
"dataset_info": dataset_info,
|
| 29 |
+
"tasks": [
|
| 30 |
+
{
|
| 31 |
+
"image_modality": "CT",
|
| 32 |
+
"image_description": "chest computed tomography (CT) scan",
|
| 33 |
+
"image_folder": "Images",
|
| 34 |
+
"mask_folder": "Masks",
|
| 35 |
+
"image_prefix": "",
|
| 36 |
+
"image_suffix": ".nii.gz",
|
| 37 |
+
"mask_prefix": "",
|
| 38 |
+
"mask_suffix": ".nii.gz",
|
| 39 |
+
"labels_map": labels_map,
|
| 40 |
+
},
|
| 41 |
+
],
|
| 42 |
+
}
|
| 43 |
+
# ====================================
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def main(
|
| 47 |
+
dir_datasets_data,
|
| 48 |
+
dataset_name,
|
| 49 |
+
benchmark_plan=benchmark_plan,
|
| 50 |
+
random_seed=1024,
|
| 51 |
+
split_ratio=0.7,
|
| 52 |
+
force_uint16_mask=False,
|
| 53 |
+
reorient2RAS=False,
|
| 54 |
+
):
|
| 55 |
+
# Create dataset directory
|
| 56 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 57 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 58 |
+
|
| 59 |
+
# Change to dataset directory
|
| 60 |
+
os.chdir(dataset_dir)
|
| 61 |
+
|
| 62 |
+
# Process dataset for detection task
|
| 63 |
+
planner = MedVision_BenchmarkPlannerDetection(
|
| 64 |
+
dataset_dir=dataset_dir,
|
| 65 |
+
bm_plan=benchmark_plan,
|
| 66 |
+
dataset_name=dataset_name,
|
| 67 |
+
seed=random_seed,
|
| 68 |
+
split_ratio=split_ratio,
|
| 69 |
+
force_uint16_mask=force_uint16_mask,
|
| 70 |
+
reorient2RAS=reorient2RAS,
|
| 71 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 72 |
+
)
|
| 73 |
+
planner.process()
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
if __name__ == "__main__":
|
| 77 |
+
# Set up argument parser
|
| 78 |
+
parser = argparse.ArgumentParser(
|
| 79 |
+
description="Generate benchmark planner for detection task."
|
| 80 |
+
)
|
| 81 |
+
parser.add_argument(
|
| 82 |
+
"-d",
|
| 83 |
+
"--dir_datasets_data",
|
| 84 |
+
type=str,
|
| 85 |
+
help="Directory path where datasets will be stored",
|
| 86 |
+
required=True,
|
| 87 |
+
)
|
| 88 |
+
parser.add_argument(
|
| 89 |
+
"-n",
|
| 90 |
+
"--dataset_name",
|
| 91 |
+
type=str,
|
| 92 |
+
help="Name of the dataset",
|
| 93 |
+
required=True,
|
| 94 |
+
)
|
| 95 |
+
parser.add_argument(
|
| 96 |
+
"--random_seed",
|
| 97 |
+
type=int,
|
| 98 |
+
default=1024,
|
| 99 |
+
help="Random seed for reproducibility",
|
| 100 |
+
)
|
| 101 |
+
parser.add_argument(
|
| 102 |
+
"--split_ratio",
|
| 103 |
+
type=float,
|
| 104 |
+
default=0.7,
|
| 105 |
+
help="Train/test split ratio (0-1)",
|
| 106 |
+
)
|
| 107 |
+
parser.add_argument(
|
| 108 |
+
"--force_uint16_mask",
|
| 109 |
+
action="store_true",
|
| 110 |
+
help="Force mask to be uint16",
|
| 111 |
+
)
|
| 112 |
+
parser.add_argument(
|
| 113 |
+
"--reorient2RAS",
|
| 114 |
+
action="store_true",
|
| 115 |
+
help="Reorient images and masks to RAS orientation",
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
args = parser.parse_args()
|
| 119 |
+
|
| 120 |
+
main(
|
| 121 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 122 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 123 |
+
dataset_name=args.dataset_name,
|
| 124 |
+
random_seed=args.random_seed,
|
| 125 |
+
split_ratio=args.split_ratio,
|
| 126 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 127 |
+
reorient2RAS=args.reorient2RAS,
|
| 128 |
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerSegmentation
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# - labels_map
|
| 12 |
+
# ====================================
|
| 13 |
+
dataset_info = {
|
| 14 |
+
"dataset": "LIDC-IDRI",
|
| 15 |
+
"dataset_website": "https://www.cancerimagingarchive.net/collection/lidc-idri/",
|
| 16 |
+
"dataset_data": [
|
| 17 |
+
"https://www.cancerimagingarchive.net/collection/lidc-idri/",
|
| 18 |
+
],
|
| 19 |
+
"license": ["CC BY 3.0"],
|
| 20 |
+
"paper": ["https://doi.org/10.1118/1.3528204"],
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
labels_map = {
|
| 24 |
+
"1": "lung nodule",
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
benchmark_plan = {
|
| 28 |
+
"dataset_info": dataset_info,
|
| 29 |
+
"tasks": [
|
| 30 |
+
{
|
| 31 |
+
"image_modality": "CT",
|
| 32 |
+
"image_description": "chest computed tomography (CT) scan",
|
| 33 |
+
"image_folder": "Images",
|
| 34 |
+
"mask_folder": "Masks",
|
| 35 |
+
"image_prefix": "",
|
| 36 |
+
"image_suffix": ".nii.gz",
|
| 37 |
+
"mask_prefix": "",
|
| 38 |
+
"mask_suffix": ".nii.gz",
|
| 39 |
+
"labels_map": labels_map,
|
| 40 |
+
},
|
| 41 |
+
],
|
| 42 |
+
}
|
| 43 |
+
# ====================================
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def main(
|
| 47 |
+
dir_datasets_data,
|
| 48 |
+
dataset_name,
|
| 49 |
+
benchmark_plan=benchmark_plan,
|
| 50 |
+
random_seed=1024,
|
| 51 |
+
split_ratio=0.7,
|
| 52 |
+
force_uint16_mask=False,
|
| 53 |
+
reorient2RAS=False,
|
| 54 |
+
):
|
| 55 |
+
# Create dataset directory
|
| 56 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 57 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 58 |
+
|
| 59 |
+
# Change to dataset directory
|
| 60 |
+
os.chdir(dataset_dir)
|
| 61 |
+
|
| 62 |
+
# Process dataset for segmentation task
|
| 63 |
+
planner = MedVision_BenchmarkPlannerSegmentation(
|
| 64 |
+
dataset_dir=dataset_dir,
|
| 65 |
+
bm_plan=benchmark_plan,
|
| 66 |
+
dataset_name=dataset_name,
|
| 67 |
+
seed=random_seed,
|
| 68 |
+
split_ratio=split_ratio,
|
| 69 |
+
force_uint16_mask=force_uint16_mask,
|
| 70 |
+
reorient2RAS=reorient2RAS,
|
| 71 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 72 |
+
)
|
| 73 |
+
planner.process()
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
if __name__ == "__main__":
|
| 77 |
+
# Set up argument parser
|
| 78 |
+
parser = argparse.ArgumentParser(
|
| 79 |
+
description="Generate benchmark planner for segmentation task."
|
| 80 |
+
)
|
| 81 |
+
parser.add_argument(
|
| 82 |
+
"-d",
|
| 83 |
+
"--dir_datasets_data",
|
| 84 |
+
type=str,
|
| 85 |
+
help="Directory path where datasets will be stored",
|
| 86 |
+
required=True,
|
| 87 |
+
)
|
| 88 |
+
parser.add_argument(
|
| 89 |
+
"-n",
|
| 90 |
+
"--dataset_name",
|
| 91 |
+
type=str,
|
| 92 |
+
help="Name of the dataset",
|
| 93 |
+
required=True,
|
| 94 |
+
)
|
| 95 |
+
parser.add_argument(
|
| 96 |
+
"--random_seed",
|
| 97 |
+
type=int,
|
| 98 |
+
default=1024,
|
| 99 |
+
help="Random seed for reproducibility",
|
| 100 |
+
)
|
| 101 |
+
parser.add_argument(
|
| 102 |
+
"--split_ratio",
|
| 103 |
+
type=float,
|
| 104 |
+
default=0.7,
|
| 105 |
+
help="Train/test split ratio (0-1)",
|
| 106 |
+
)
|
| 107 |
+
parser.add_argument(
|
| 108 |
+
"--force_uint16_mask",
|
| 109 |
+
action="store_true",
|
| 110 |
+
help="Force mask to be uint16",
|
| 111 |
+
)
|
| 112 |
+
parser.add_argument(
|
| 113 |
+
"--reorient2RAS",
|
| 114 |
+
action="store_true",
|
| 115 |
+
help="Reorient images and masks to RAS orientation",
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
args = parser.parse_args()
|
| 119 |
+
|
| 120 |
+
main(
|
| 121 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 122 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 123 |
+
dataset_name=args.dataset_name,
|
| 124 |
+
random_seed=args.random_seed,
|
| 125 |
+
split_ratio=args.split_ratio,
|
| 126 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 127 |
+
reorient2RAS=args.reorient2RAS,
|
| 128 |
+
)
|
|
File without changes
|
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import zipfile
|
| 6 |
+
from huggingface_hub import snapshot_download
|
| 7 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# ====================================
|
| 11 |
+
# Dataset Info [!]
|
| 12 |
+
# ====================================
|
| 13 |
+
# Dataset: LNQ2023 (mediastinal lymph node quantification)
|
| 14 |
+
# Challenge: https://lnq2023.grand-challenge.org/
|
| 15 |
+
# Official Release (TCIA, CC BY 4.0): https://www.cancerimagingarchive.net/collection/mediastinal-lymph-node-seg/
|
| 16 |
+
# HF Release: https://huggingface.co/datasets/YongchengYAO/LNQ2023
|
| 17 |
+
# Format: nii.gz
|
| 18 |
+
# ====================================
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 23 |
+
"""
|
| 24 |
+
Download and extract the LNQ2023 dataset from the HuggingFace mirror.
|
| 25 |
+
|
| 26 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 27 |
+
the other arguments must be kwargs
|
| 28 |
+
"""
|
| 29 |
+
# Download files
|
| 30 |
+
current_dir = os.getcwd()
|
| 31 |
+
os.chdir(dataset_dir)
|
| 32 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 33 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 34 |
+
os.chdir(tmp_dir)
|
| 35 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 36 |
+
|
| 37 |
+
# ====================================
|
| 38 |
+
# Add download logic here [!]
|
| 39 |
+
# ====================================
|
| 40 |
+
# Download dataset (image + mask archives, sharded as data-part*.zip)
|
| 41 |
+
snapshot_download(
|
| 42 |
+
repo_id="YongchengYAO/LNQ2023-Lite",
|
| 43 |
+
allow_patterns="*.zip",
|
| 44 |
+
repo_type="dataset",
|
| 45 |
+
revision="f7c7ef4f5ac138bce106066dfac9104e7b7bcf56", # squashed single commit, 2026-07-27
|
| 46 |
+
local_dir=".",
|
| 47 |
+
max_workers=kwargs.get("max_workers", 1),
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
# Extract all zip files
|
| 51 |
+
for zip_file in sorted(glob.glob("*.zip")):
|
| 52 |
+
print(f"extracting {zip_file}")
|
| 53 |
+
with zipfile.ZipFile(zip_file, "r") as zip_ref:
|
| 54 |
+
zip_ref.extractall(".")
|
| 55 |
+
os.remove(zip_file)
|
| 56 |
+
print(f"{zip_file} deleted")
|
| 57 |
+
|
| 58 |
+
# Move folder to dataset_dir
|
| 59 |
+
folders_to_move = [
|
| 60 |
+
"Images",
|
| 61 |
+
"Masks",
|
| 62 |
+
]
|
| 63 |
+
for folder in folders_to_move:
|
| 64 |
+
move_folder(
|
| 65 |
+
os.path.join(tmp_dir, folder),
|
| 66 |
+
os.path.join(dataset_dir, folder),
|
| 67 |
+
create_dest=True,
|
| 68 |
+
)
|
| 69 |
+
# ====================================
|
| 70 |
+
|
| 71 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 72 |
+
os.chdir(dataset_dir)
|
| 73 |
+
shutil.rmtree(tmp_dir)
|
| 74 |
+
os.chdir(current_dir)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 78 |
+
# Create dataset directory
|
| 79 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 80 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 81 |
+
|
| 82 |
+
# Change to dataset directory
|
| 83 |
+
os.chdir(dataset_dir)
|
| 84 |
+
|
| 85 |
+
# Download and extract dataset
|
| 86 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
if __name__ == "__main__":
|
| 90 |
+
# Set up argument parser
|
| 91 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 92 |
+
parser.add_argument(
|
| 93 |
+
"-d",
|
| 94 |
+
"--dir_datasets_data",
|
| 95 |
+
help="Directory path where datasets will be stored",
|
| 96 |
+
required=True,
|
| 97 |
+
)
|
| 98 |
+
parser.add_argument(
|
| 99 |
+
"-n",
|
| 100 |
+
"--dataset_name",
|
| 101 |
+
help="Name of the dataset",
|
| 102 |
+
required=True,
|
| 103 |
+
)
|
| 104 |
+
parser.add_argument(
|
| 105 |
+
"--max_workers",
|
| 106 |
+
type=int,
|
| 107 |
+
default=1,
|
| 108 |
+
help="Maximum number of workers for download",
|
| 109 |
+
)
|
| 110 |
+
args = parser.parse_args()
|
| 111 |
+
|
| 112 |
+
# Extract known arguments and pass the rest as kwargs
|
| 113 |
+
kwargs = {"max_workers": args.max_workers}
|
| 114 |
+
|
| 115 |
+
main(
|
| 116 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 117 |
+
dataset_name=args.dataset_name,
|
| 118 |
+
**kwargs,
|
| 119 |
+
)
|
|
@@ -0,0 +1,313 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import glob
|
| 3 |
+
import json
|
| 4 |
+
import shutil
|
| 5 |
+
import zipfile
|
| 6 |
+
import argparse
|
| 7 |
+
import urllib.request
|
| 8 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 9 |
+
|
| 10 |
+
import SimpleITK as sitk
|
| 11 |
+
import pydicom
|
| 12 |
+
import pydicom_seg
|
| 13 |
+
|
| 14 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 15 |
+
from medvision_ds.utils.data_conversion import (
|
| 16 |
+
convert_mask_to_uint16_per_dir,
|
| 17 |
+
copy_img_header_to_mask,
|
| 18 |
+
reorient_niigz_RASplus_batch_inplace,
|
| 19 |
+
)
|
| 20 |
+
from medvision_ds.utils.download_utils import download_url, retry_call
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# ====================================
|
| 24 |
+
# Dataset Info [!]
|
| 25 |
+
# ====================================
|
| 26 |
+
# Dataset: LNQ2023 (mediastinal lymph node quantification)
|
| 27 |
+
# Challenge: https://lnq2023.grand-challenge.org/
|
| 28 |
+
# TCIA Release: MEDIASTINAL-LYMPH-NODE-SEG (DOI 10.7937/QVAZ-JA09, CC BY 4.0)
|
| 29 |
+
# https://www.cancerimagingarchive.net/collection/mediastinal-lymph-node-seg/
|
| 30 |
+
# Format: DICOM (CT series) + DICOM-SEG (segmentation) -> nii.gz
|
| 31 |
+
# NOTE: use the TCIA release (CC BY 4.0), NOT the Zenodo challenge copy (CC BY-NC-ND).
|
| 32 |
+
# NOTE: ONLY the 120 fully annotated cases are kept; the 393 partially annotated ones are
|
| 33 |
+
# dropped. Each SEG series declares which it is in its DICOM `SeriesDescription`
|
| 34 |
+
# ("Fully Annotated" / "Partially Annotated"), exposed by the NBIA getSeries API.
|
| 35 |
+
# Measured over the shipped masks, the two groups differ enormously: fully annotated
|
| 36 |
+
# cases carry a mean of 9.00 segmented nodes (median 8, max 42) while partially
|
| 37 |
+
# annotated ones carry 1.46 (median 1, and 63% have exactly one node) - a 6.2x gap.
|
| 38 |
+
# On a partially annotated case most true nodes are unlabelled, so a correct detection
|
| 39 |
+
# scores as a false positive and a T/L measurement has no reference. Such cases cannot
|
| 40 |
+
# serve as benchmark ground truth.
|
| 41 |
+
# ====================================
|
| 42 |
+
|
| 43 |
+
NBIA_BASE = "https://services.cancerimagingarchive.net/nbia-api/services/v1"
|
| 44 |
+
COLLECTION = "MEDIASTINAL-LYMPH-NODE-SEG"
|
| 45 |
+
|
| 46 |
+
# Value of the SEG series' DICOM SeriesDescription that marks exhaustive annotation.
|
| 47 |
+
FULLY_ANNOTATED_DESC = "Fully Annotated"
|
| 48 |
+
N_FULL_EXPECTED = 120
|
| 49 |
+
N_PARTIAL_EXPECTED = 393
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def _get_series_list():
|
| 53 |
+
"""Query the NBIA REST API for all series in the collection (no auth needed)."""
|
| 54 |
+
url = f"{NBIA_BASE}/getSeries?Collection={COLLECTION}"
|
| 55 |
+
|
| 56 |
+
def _fetch():
|
| 57 |
+
with urllib.request.urlopen(url) as resp:
|
| 58 |
+
return json.load(resp)
|
| 59 |
+
|
| 60 |
+
return retry_call(_fetch, label="LNQ2023.getSeries")
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def _download_series_zip(series_uid, dest_zip):
|
| 64 |
+
"""Download one DICOM series as a zip via getImage."""
|
| 65 |
+
url = f"{NBIA_BASE}/getImage?SeriesInstanceUID={series_uid}"
|
| 66 |
+
download_url(url, dest_zip)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def _extract_zip(zip_path, dest_dir):
|
| 70 |
+
os.makedirs(dest_dir, exist_ok=True)
|
| 71 |
+
with zipfile.ZipFile(zip_path, "r") as zf:
|
| 72 |
+
zf.extractall(dest_dir)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def _read_ct_series(series_dir):
|
| 76 |
+
"""Read a directory of CT DICOM slices into a single sitk volume."""
|
| 77 |
+
reader = sitk.ImageSeriesReader()
|
| 78 |
+
dicom_names = reader.GetGDCMSeriesFileNames(series_dir)
|
| 79 |
+
reader.SetFileNames(dicom_names)
|
| 80 |
+
return reader.Execute()
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def _read_seg_on_grid(seg_dir, ref_img):
|
| 84 |
+
"""Decode a DICOM-SEG into a binary (foreground=1) label volume on the CT grid.
|
| 85 |
+
|
| 86 |
+
LNQ SEGs may cover only a subset of slices; resampling onto the reference CT
|
| 87 |
+
grid (nearest-neighbour) places every segment correctly and unions them.
|
| 88 |
+
"""
|
| 89 |
+
seg_files = glob.glob(os.path.join(seg_dir, "*.dcm")) or glob.glob(
|
| 90 |
+
os.path.join(seg_dir, "*")
|
| 91 |
+
)
|
| 92 |
+
seg_files = [f for f in seg_files if os.path.isfile(f)]
|
| 93 |
+
if not seg_files:
|
| 94 |
+
raise FileNotFoundError(f"No DICOM-SEG file found in {seg_dir}")
|
| 95 |
+
|
| 96 |
+
dcm = pydicom.dcmread(seg_files[0])
|
| 97 |
+
reader = pydicom_seg.SegmentReader()
|
| 98 |
+
result = reader.read(dcm)
|
| 99 |
+
|
| 100 |
+
label = sitk.Image(ref_img.GetSize(), sitk.sitkUInt8)
|
| 101 |
+
label.CopyInformation(ref_img)
|
| 102 |
+
label_arr = sitk.GetArrayFromImage(label) # zeros, shape (z, y, x)
|
| 103 |
+
|
| 104 |
+
for seg_number in result.available_segments:
|
| 105 |
+
seg_img = result.segment_image(seg_number) # binary sitk.Image
|
| 106 |
+
seg_on_grid = sitk.Resample(
|
| 107 |
+
seg_img,
|
| 108 |
+
ref_img,
|
| 109 |
+
sitk.Transform(),
|
| 110 |
+
sitk.sitkNearestNeighbor,
|
| 111 |
+
0,
|
| 112 |
+
sitk.sitkUInt8,
|
| 113 |
+
)
|
| 114 |
+
seg_arr = sitk.GetArrayFromImage(seg_on_grid)
|
| 115 |
+
label_arr[seg_arr > 0] = 1
|
| 116 |
+
|
| 117 |
+
out = sitk.GetImageFromArray(label_arr)
|
| 118 |
+
out.CopyInformation(ref_img)
|
| 119 |
+
return out
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
def _process_patient(patient_id, ct_uid, seg_uid, work_dir, images_dir, masks_dir):
|
| 123 |
+
"""Download + convert one patient (1 CT + 1 SEG). Returns caseID or None."""
|
| 124 |
+
case_id = patient_id
|
| 125 |
+
patient_tmp = os.path.join(work_dir, case_id)
|
| 126 |
+
ct_extract = os.path.join(patient_tmp, "ct")
|
| 127 |
+
seg_extract = os.path.join(patient_tmp, "seg")
|
| 128 |
+
try:
|
| 129 |
+
os.makedirs(patient_tmp, exist_ok=True)
|
| 130 |
+
|
| 131 |
+
# CT series -> nii.gz
|
| 132 |
+
ct_zip = os.path.join(patient_tmp, "ct.zip")
|
| 133 |
+
_download_series_zip(ct_uid, ct_zip)
|
| 134 |
+
_extract_zip(ct_zip, ct_extract)
|
| 135 |
+
ct_img = _read_ct_series(ct_extract)
|
| 136 |
+
sitk.WriteImage(ct_img, os.path.join(images_dir, f"{case_id}.nii.gz"))
|
| 137 |
+
|
| 138 |
+
# DICOM-SEG -> binary label on CT grid -> nii.gz
|
| 139 |
+
seg_zip = os.path.join(patient_tmp, "seg.zip")
|
| 140 |
+
_download_series_zip(seg_uid, seg_zip)
|
| 141 |
+
_extract_zip(seg_zip, seg_extract)
|
| 142 |
+
seg_img = _read_seg_on_grid(seg_extract, ct_img)
|
| 143 |
+
sitk.WriteImage(seg_img, os.path.join(masks_dir, f"{case_id}.nii.gz"))
|
| 144 |
+
|
| 145 |
+
return case_id
|
| 146 |
+
except Exception as exc: # noqa: BLE001
|
| 147 |
+
print(f"[LNQ2023] Skipping patient {patient_id}: {exc}")
|
| 148 |
+
# Keep a skipped case atomic: if the CT image was already written but the
|
| 149 |
+
# SEG step failed, drop the orphan image so the final dataset never contains
|
| 150 |
+
# an Image without a matching Mask (which would break Image/Mask pairing).
|
| 151 |
+
for _d in (images_dir, masks_dir):
|
| 152 |
+
_p = os.path.join(_d, f"{case_id}.nii.gz")
|
| 153 |
+
if os.path.exists(_p):
|
| 154 |
+
os.remove(_p)
|
| 155 |
+
return None
|
| 156 |
+
finally:
|
| 157 |
+
shutil.rmtree(patient_tmp, ignore_errors=True)
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 161 |
+
"""
|
| 162 |
+
Download and extract the LNQ2023 dataset from the TCIA release.
|
| 163 |
+
|
| 164 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 165 |
+
the other arguments must be kwargs
|
| 166 |
+
"""
|
| 167 |
+
max_workers = kwargs.get("max_workers", 1)
|
| 168 |
+
|
| 169 |
+
current_dir = os.getcwd()
|
| 170 |
+
os.chdir(dataset_dir)
|
| 171 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 172 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 173 |
+
os.chdir(tmp_dir)
|
| 174 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 175 |
+
|
| 176 |
+
# ====================================
|
| 177 |
+
# Add download logic here [!]
|
| 178 |
+
# ====================================
|
| 179 |
+
images_dir = os.path.join(tmp_dir, "Images")
|
| 180 |
+
masks_dir = os.path.join(tmp_dir, "Masks")
|
| 181 |
+
work_dir = os.path.join(tmp_dir, "dicom_tmp")
|
| 182 |
+
os.makedirs(images_dir, exist_ok=True)
|
| 183 |
+
os.makedirs(masks_dir, exist_ok=True)
|
| 184 |
+
os.makedirs(work_dir, exist_ok=True)
|
| 185 |
+
|
| 186 |
+
# 1) Enumerate series, pair 1 CT + 1 SEG per patient.
|
| 187 |
+
# Keep ONLY fully annotated cases - see FULLY_ANNOTATED_DESC.
|
| 188 |
+
series = _get_series_list()
|
| 189 |
+
ct_by_patient = {}
|
| 190 |
+
seg_by_patient = {}
|
| 191 |
+
n_partial = 0
|
| 192 |
+
for s in series:
|
| 193 |
+
pid = s.get("PatientID")
|
| 194 |
+
modality = s.get("Modality")
|
| 195 |
+
uid = s.get("SeriesInstanceUID")
|
| 196 |
+
if not (pid and modality and uid):
|
| 197 |
+
continue
|
| 198 |
+
if modality == "SEG":
|
| 199 |
+
desc = (s.get("SeriesDescription") or "").strip()
|
| 200 |
+
if desc != FULLY_ANNOTATED_DESC:
|
| 201 |
+
n_partial += 1
|
| 202 |
+
continue
|
| 203 |
+
seg_by_patient.setdefault(pid, uid)
|
| 204 |
+
elif modality == "CT":
|
| 205 |
+
ct_by_patient.setdefault(pid, uid)
|
| 206 |
+
|
| 207 |
+
patients = sorted(set(ct_by_patient) & set(seg_by_patient))
|
| 208 |
+
print(
|
| 209 |
+
f"[LNQ2023] {len(patients)} fully annotated patients with paired CT+SEG "
|
| 210 |
+
f"(dropped {n_partial} partially annotated SEG series)"
|
| 211 |
+
)
|
| 212 |
+
assert n_partial == N_PARTIAL_EXPECTED, (
|
| 213 |
+
f"expected {N_PARTIAL_EXPECTED} partially annotated SEG series, found {n_partial}"
|
| 214 |
+
)
|
| 215 |
+
assert len(patients) == N_FULL_EXPECTED, (
|
| 216 |
+
f"expected {N_FULL_EXPECTED} fully annotated cases, found {len(patients)}"
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
# 2) Download + convert per patient (parallelised across patients)
|
| 220 |
+
n_ok = 0
|
| 221 |
+
with ThreadPoolExecutor(max_workers=max_workers) as pool:
|
| 222 |
+
futures = [
|
| 223 |
+
pool.submit(
|
| 224 |
+
_process_patient,
|
| 225 |
+
pid,
|
| 226 |
+
ct_by_patient[pid],
|
| 227 |
+
seg_by_patient[pid],
|
| 228 |
+
work_dir,
|
| 229 |
+
images_dir,
|
| 230 |
+
masks_dir,
|
| 231 |
+
)
|
| 232 |
+
for pid in patients
|
| 233 |
+
]
|
| 234 |
+
for fut in as_completed(futures):
|
| 235 |
+
if fut.result() is not None:
|
| 236 |
+
n_ok += 1
|
| 237 |
+
print(f"[LNQ2023] Wrote {n_ok} CT/SEG pairs")
|
| 238 |
+
|
| 239 |
+
shutil.rmtree(work_dir, ignore_errors=True)
|
| 240 |
+
|
| 241 |
+
# 3) Copy Nifti header (geometry) of images onto masks (returns float64)
|
| 242 |
+
print("Copying Nifti headers from images to masks...")
|
| 243 |
+
img_files = list(glob.glob(os.path.join(images_dir, "*.nii.gz")))
|
| 244 |
+
copy_img_header_to_mask(img_files, masks_dir, workers_limit=max_workers)
|
| 245 |
+
|
| 246 |
+
# 4) Cast masks back to uint16 (order matters: after header copy)
|
| 247 |
+
convert_mask_to_uint16_per_dir(masks_dir, workers_limit=max_workers)
|
| 248 |
+
|
| 249 |
+
# 5) Reorient Images + Masks to RAS+ in place (dtype-preserving, idempotent)
|
| 250 |
+
reorient_niigz_RASplus_batch_inplace(tmp_dir, workers_limit=max_workers)
|
| 251 |
+
|
| 252 |
+
# Move folders to dataset_dir
|
| 253 |
+
folders_to_move = [
|
| 254 |
+
"Images",
|
| 255 |
+
"Masks",
|
| 256 |
+
]
|
| 257 |
+
for folder in folders_to_move:
|
| 258 |
+
move_folder(
|
| 259 |
+
os.path.join(tmp_dir, folder),
|
| 260 |
+
os.path.join(dataset_dir, folder),
|
| 261 |
+
create_dest=True,
|
| 262 |
+
)
|
| 263 |
+
# ====================================
|
| 264 |
+
|
| 265 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 266 |
+
os.chdir(dataset_dir)
|
| 267 |
+
shutil.rmtree(tmp_dir)
|
| 268 |
+
os.chdir(current_dir)
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 272 |
+
# Create dataset directory
|
| 273 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 274 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 275 |
+
|
| 276 |
+
# Change to dataset directory
|
| 277 |
+
os.chdir(dataset_dir)
|
| 278 |
+
|
| 279 |
+
# Download and extract dataset
|
| 280 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
if __name__ == "__main__":
|
| 284 |
+
# Set up argument parser
|
| 285 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 286 |
+
parser.add_argument(
|
| 287 |
+
"-d",
|
| 288 |
+
"--dir_datasets_data",
|
| 289 |
+
help="Directory path where datasets will be stored",
|
| 290 |
+
required=True,
|
| 291 |
+
)
|
| 292 |
+
parser.add_argument(
|
| 293 |
+
"-n",
|
| 294 |
+
"--dataset_name",
|
| 295 |
+
help="Name of the dataset",
|
| 296 |
+
required=True,
|
| 297 |
+
)
|
| 298 |
+
parser.add_argument(
|
| 299 |
+
"--max_workers",
|
| 300 |
+
type=int,
|
| 301 |
+
default=1,
|
| 302 |
+
help="Maximum number of workers for download",
|
| 303 |
+
)
|
| 304 |
+
args = parser.parse_args()
|
| 305 |
+
|
| 306 |
+
# Extract known arguments and pass the rest as kwargs
|
| 307 |
+
kwargs = {"max_workers": args.max_workers}
|
| 308 |
+
|
| 309 |
+
main(
|
| 310 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 311 |
+
dataset_name=args.dataset_name,
|
| 312 |
+
**kwargs,
|
| 313 |
+
)
|
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerBiometry_fromSeg
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# ====================================
|
| 12 |
+
CLUSTER_SIZE_THRESHOLD = 20
|
| 13 |
+
|
| 14 |
+
dataset_info = {
|
| 15 |
+
"dataset": "LNQ2023",
|
| 16 |
+
"dataset_website": "https://lnq2023.grand-challenge.org/",
|
| 17 |
+
"dataset_data": [
|
| 18 |
+
"https://www.cancerimagingarchive.net/collection/mediastinal-lymph-node-seg/",
|
| 19 |
+
],
|
| 20 |
+
"license": ["CC BY 4.0"],
|
| 21 |
+
"paper": ["https://doi.org/10.7937/QVAZ-JA09"],
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
labels_map = {
|
| 25 |
+
"1": "mediastinal lymph node",
|
| 26 |
+
}
|
| 27 |
+
# ====================================
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# ===============
|
| 31 |
+
# DO NOT CHANGE
|
| 32 |
+
# ===============
|
| 33 |
+
landmarks_map = {
|
| 34 |
+
"P1": "most right/anterior/superior endpoint of the major axis",
|
| 35 |
+
"P2": "most left/superior/inferior endpoint of the major axis",
|
| 36 |
+
"P3": "most right/anterior/superior endpoint of the minor axis",
|
| 37 |
+
"P4": "most left/superior/inferior endpoint of the minor axis",
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
lines_map = {
|
| 41 |
+
"L-1-2": {
|
| 42 |
+
"name": "marjor axis of the fitted ellipse",
|
| 43 |
+
"element_keys": ["P1", "P2"],
|
| 44 |
+
"element_map_name": "landmarks_map",
|
| 45 |
+
},
|
| 46 |
+
"L-3-4": {
|
| 47 |
+
"name": "minor axis of the fitted ellipse",
|
| 48 |
+
"element_keys": ["P3", "P4"],
|
| 49 |
+
"element_map_name": "landmarks_map",
|
| 50 |
+
},
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
angles_map = {}
|
| 54 |
+
|
| 55 |
+
biometrics_map = [
|
| 56 |
+
{
|
| 57 |
+
"metric_type": "distance",
|
| 58 |
+
"metric_map_name": "lines_map",
|
| 59 |
+
"metric_key": "L-1-2",
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"metric_type": "distance",
|
| 63 |
+
"metric_map_name": "lines_map",
|
| 64 |
+
"metric_key": "L-3-4",
|
| 65 |
+
},
|
| 66 |
+
]
|
| 67 |
+
# ===============
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
benchmark_plan = {
|
| 71 |
+
"dataset_info": dataset_info,
|
| 72 |
+
"tasks": [
|
| 73 |
+
{
|
| 74 |
+
"image_modality": "CT",
|
| 75 |
+
"image_description": "contrast-enhanced chest computed tomography (CT) scan",
|
| 76 |
+
"image_folder": "Images",
|
| 77 |
+
"mask_folder": "Masks",
|
| 78 |
+
"landmark_folder": "Landmarks-Label1",
|
| 79 |
+
"landmark_figure_folder": "Landmarks-Label1-fig",
|
| 80 |
+
"image_prefix": "",
|
| 81 |
+
"image_suffix": ".nii.gz",
|
| 82 |
+
"mask_prefix": "",
|
| 83 |
+
"mask_suffix": ".nii.gz",
|
| 84 |
+
"landmark_prefix": "",
|
| 85 |
+
"landmark_suffix": ".json.gz",
|
| 86 |
+
"labels_map": labels_map,
|
| 87 |
+
"landmarks_map": landmarks_map,
|
| 88 |
+
"lines_map": lines_map,
|
| 89 |
+
"angles_map": angles_map,
|
| 90 |
+
"biometrics_map": biometrics_map,
|
| 91 |
+
"target_label": 1,
|
| 92 |
+
"cluster_size_threshold": CLUSTER_SIZE_THRESHOLD,
|
| 93 |
+
},
|
| 94 |
+
],
|
| 95 |
+
}
|
| 96 |
+
# ====================================
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def main(
|
| 100 |
+
dir_datasets_data,
|
| 101 |
+
dataset_name,
|
| 102 |
+
benchmark_plan=benchmark_plan,
|
| 103 |
+
random_seed=1024,
|
| 104 |
+
split_ratio=0.7,
|
| 105 |
+
shrunken_bbox_scale=0.9,
|
| 106 |
+
enlarged_bbox_scale=1.1,
|
| 107 |
+
force_uint16_mask=False,
|
| 108 |
+
reorient2RAS=False,
|
| 109 |
+
visualization=True,
|
| 110 |
+
):
|
| 111 |
+
# Create dataset directory
|
| 112 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 113 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 114 |
+
|
| 115 |
+
# Change to dataset directory
|
| 116 |
+
os.chdir(dataset_dir)
|
| 117 |
+
|
| 118 |
+
# Process dataset for segmentation task
|
| 119 |
+
planner = MedVision_BenchmarkPlannerBiometry_fromSeg(
|
| 120 |
+
dataset_dir=dataset_dir,
|
| 121 |
+
bm_plan=benchmark_plan,
|
| 122 |
+
dataset_name=dataset_name,
|
| 123 |
+
seed=random_seed,
|
| 124 |
+
split_ratio=split_ratio,
|
| 125 |
+
shrunk_bbox_scale=shrunken_bbox_scale,
|
| 126 |
+
enlarged_bbox_scale=enlarged_bbox_scale,
|
| 127 |
+
force_uint16_mask=force_uint16_mask,
|
| 128 |
+
reorient2RAS=reorient2RAS,
|
| 129 |
+
visualization=visualization,
|
| 130 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 131 |
+
)
|
| 132 |
+
planner.process()
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
if __name__ == "__main__":
|
| 136 |
+
# Set up argument parser
|
| 137 |
+
parser = argparse.ArgumentParser(
|
| 138 |
+
description="Generate benchmark planner for biometric measurement task."
|
| 139 |
+
)
|
| 140 |
+
parser.add_argument(
|
| 141 |
+
"-d",
|
| 142 |
+
"--dir_datasets_data",
|
| 143 |
+
type=str,
|
| 144 |
+
help="Directory path where datasets will be stored",
|
| 145 |
+
required=True,
|
| 146 |
+
)
|
| 147 |
+
parser.add_argument(
|
| 148 |
+
"-n",
|
| 149 |
+
"--dataset_name",
|
| 150 |
+
type=str,
|
| 151 |
+
help="Name of the dataset",
|
| 152 |
+
required=True,
|
| 153 |
+
)
|
| 154 |
+
parser.add_argument(
|
| 155 |
+
"--random_seed",
|
| 156 |
+
type=int,
|
| 157 |
+
default=1024,
|
| 158 |
+
help="Random seed for reproducibility",
|
| 159 |
+
)
|
| 160 |
+
parser.add_argument(
|
| 161 |
+
"--split_ratio",
|
| 162 |
+
type=float,
|
| 163 |
+
default=0.7,
|
| 164 |
+
help="Train/test split ratio (0-1)",
|
| 165 |
+
)
|
| 166 |
+
parser.add_argument(
|
| 167 |
+
"--shrunken_bbox_scale",
|
| 168 |
+
type=float,
|
| 169 |
+
default=0.9,
|
| 170 |
+
help="Scale factor for shrunken bounding box",
|
| 171 |
+
)
|
| 172 |
+
parser.add_argument(
|
| 173 |
+
"--enlarged_bbox_scale",
|
| 174 |
+
type=float,
|
| 175 |
+
default=1.1,
|
| 176 |
+
help="Scale factor for enlarged bounding box",
|
| 177 |
+
)
|
| 178 |
+
parser.add_argument(
|
| 179 |
+
"--force_uint16_mask",
|
| 180 |
+
action="store_true",
|
| 181 |
+
help="Force mask to be uint16",
|
| 182 |
+
)
|
| 183 |
+
parser.add_argument(
|
| 184 |
+
"--reorient2RAS",
|
| 185 |
+
action="store_true",
|
| 186 |
+
help="Reorient images and masks to RAS orientation",
|
| 187 |
+
)
|
| 188 |
+
parser.add_argument(
|
| 189 |
+
"--visualization",
|
| 190 |
+
action=argparse.BooleanOptionalAction,
|
| 191 |
+
default=True,
|
| 192 |
+
help="Save T/L ellipse landmark figures (Landmarks-Label<N>-fig); default: on",
|
| 193 |
+
)
|
| 194 |
+
args = parser.parse_args()
|
| 195 |
+
|
| 196 |
+
main(
|
| 197 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 198 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 199 |
+
dataset_name=args.dataset_name,
|
| 200 |
+
random_seed=args.random_seed,
|
| 201 |
+
split_ratio=args.split_ratio,
|
| 202 |
+
shrunken_bbox_scale=args.shrunken_bbox_scale,
|
| 203 |
+
enlarged_bbox_scale=args.enlarged_bbox_scale,
|
| 204 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 205 |
+
reorient2RAS=args.reorient2RAS,
|
| 206 |
+
visualization=args.visualization,
|
| 207 |
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerDetection
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# - labels_map
|
| 12 |
+
# ====================================
|
| 13 |
+
dataset_info = {
|
| 14 |
+
"dataset": "LNQ2023",
|
| 15 |
+
"dataset_website": "https://lnq2023.grand-challenge.org/",
|
| 16 |
+
"dataset_data": [
|
| 17 |
+
"https://www.cancerimagingarchive.net/collection/mediastinal-lymph-node-seg/",
|
| 18 |
+
],
|
| 19 |
+
"license": ["CC BY 4.0"],
|
| 20 |
+
"paper": ["https://doi.org/10.7937/QVAZ-JA09"],
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
labels_map = {
|
| 24 |
+
"1": "mediastinal lymph node",
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
benchmark_plan = {
|
| 28 |
+
"dataset_info": dataset_info,
|
| 29 |
+
"tasks": [
|
| 30 |
+
{
|
| 31 |
+
"image_modality": "CT",
|
| 32 |
+
"image_description": "contrast-enhanced chest computed tomography (CT) scan",
|
| 33 |
+
"image_folder": "Images",
|
| 34 |
+
"mask_folder": "Masks",
|
| 35 |
+
"image_prefix": "",
|
| 36 |
+
"image_suffix": ".nii.gz",
|
| 37 |
+
"mask_prefix": "",
|
| 38 |
+
"mask_suffix": ".nii.gz",
|
| 39 |
+
"labels_map": labels_map,
|
| 40 |
+
},
|
| 41 |
+
],
|
| 42 |
+
}
|
| 43 |
+
# ====================================
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def main(
|
| 47 |
+
dir_datasets_data,
|
| 48 |
+
dataset_name,
|
| 49 |
+
benchmark_plan=benchmark_plan,
|
| 50 |
+
random_seed=1024,
|
| 51 |
+
split_ratio=0.7,
|
| 52 |
+
force_uint16_mask=False,
|
| 53 |
+
reorient2RAS=False,
|
| 54 |
+
):
|
| 55 |
+
# Create dataset directory
|
| 56 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 57 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 58 |
+
|
| 59 |
+
# Change to dataset directory
|
| 60 |
+
os.chdir(dataset_dir)
|
| 61 |
+
|
| 62 |
+
# Process dataset for detection task
|
| 63 |
+
planner = MedVision_BenchmarkPlannerDetection(
|
| 64 |
+
dataset_dir=dataset_dir,
|
| 65 |
+
bm_plan=benchmark_plan,
|
| 66 |
+
dataset_name=dataset_name,
|
| 67 |
+
seed=random_seed,
|
| 68 |
+
split_ratio=split_ratio,
|
| 69 |
+
force_uint16_mask=force_uint16_mask,
|
| 70 |
+
reorient2RAS=reorient2RAS,
|
| 71 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 72 |
+
)
|
| 73 |
+
planner.process()
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
if __name__ == "__main__":
|
| 77 |
+
# Set up argument parser
|
| 78 |
+
parser = argparse.ArgumentParser(
|
| 79 |
+
description="Generate benchmark planner for detection task."
|
| 80 |
+
)
|
| 81 |
+
parser.add_argument(
|
| 82 |
+
"-d",
|
| 83 |
+
"--dir_datasets_data",
|
| 84 |
+
type=str,
|
| 85 |
+
help="Directory path where datasets will be stored",
|
| 86 |
+
required=True,
|
| 87 |
+
)
|
| 88 |
+
parser.add_argument(
|
| 89 |
+
"-n",
|
| 90 |
+
"--dataset_name",
|
| 91 |
+
type=str,
|
| 92 |
+
help="Name of the dataset",
|
| 93 |
+
required=True,
|
| 94 |
+
)
|
| 95 |
+
parser.add_argument(
|
| 96 |
+
"--random_seed",
|
| 97 |
+
type=int,
|
| 98 |
+
default=1024,
|
| 99 |
+
help="Random seed for reproducibility",
|
| 100 |
+
)
|
| 101 |
+
parser.add_argument(
|
| 102 |
+
"--split_ratio",
|
| 103 |
+
type=float,
|
| 104 |
+
default=0.7,
|
| 105 |
+
help="Train/test split ratio (0-1)",
|
| 106 |
+
)
|
| 107 |
+
parser.add_argument(
|
| 108 |
+
"--force_uint16_mask",
|
| 109 |
+
action="store_true",
|
| 110 |
+
help="Force mask to be uint16",
|
| 111 |
+
)
|
| 112 |
+
parser.add_argument(
|
| 113 |
+
"--reorient2RAS",
|
| 114 |
+
action="store_true",
|
| 115 |
+
help="Reorient images and masks to RAS orientation",
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
args = parser.parse_args()
|
| 119 |
+
|
| 120 |
+
main(
|
| 121 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 122 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 123 |
+
dataset_name=args.dataset_name,
|
| 124 |
+
random_seed=args.random_seed,
|
| 125 |
+
split_ratio=args.split_ratio,
|
| 126 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 127 |
+
reorient2RAS=args.reorient2RAS,
|
| 128 |
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerSegmentation
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# - labels_map
|
| 12 |
+
# ====================================
|
| 13 |
+
dataset_info = {
|
| 14 |
+
"dataset": "LNQ2023",
|
| 15 |
+
"dataset_website": "https://lnq2023.grand-challenge.org/",
|
| 16 |
+
"dataset_data": [
|
| 17 |
+
"https://www.cancerimagingarchive.net/collection/mediastinal-lymph-node-seg/",
|
| 18 |
+
],
|
| 19 |
+
"license": ["CC BY 4.0"],
|
| 20 |
+
"paper": ["https://doi.org/10.7937/QVAZ-JA09"],
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
labels_map = {
|
| 24 |
+
"1": "mediastinal lymph node",
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
benchmark_plan = {
|
| 28 |
+
"dataset_info": dataset_info,
|
| 29 |
+
"tasks": [
|
| 30 |
+
{
|
| 31 |
+
"image_modality": "CT",
|
| 32 |
+
"image_description": "contrast-enhanced chest computed tomography (CT) scan",
|
| 33 |
+
"image_folder": "Images",
|
| 34 |
+
"mask_folder": "Masks",
|
| 35 |
+
"image_prefix": "",
|
| 36 |
+
"image_suffix": ".nii.gz",
|
| 37 |
+
"mask_prefix": "",
|
| 38 |
+
"mask_suffix": ".nii.gz",
|
| 39 |
+
"labels_map": labels_map,
|
| 40 |
+
},
|
| 41 |
+
],
|
| 42 |
+
}
|
| 43 |
+
# ====================================
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def main(
|
| 47 |
+
dir_datasets_data,
|
| 48 |
+
dataset_name,
|
| 49 |
+
benchmark_plan=benchmark_plan,
|
| 50 |
+
random_seed=1024,
|
| 51 |
+
split_ratio=0.7,
|
| 52 |
+
force_uint16_mask=False,
|
| 53 |
+
reorient2RAS=False,
|
| 54 |
+
):
|
| 55 |
+
# Create dataset directory
|
| 56 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 57 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 58 |
+
|
| 59 |
+
# Change to dataset directory
|
| 60 |
+
os.chdir(dataset_dir)
|
| 61 |
+
|
| 62 |
+
# Process dataset for segmentation task
|
| 63 |
+
planner = MedVision_BenchmarkPlannerSegmentation(
|
| 64 |
+
dataset_dir=dataset_dir,
|
| 65 |
+
bm_plan=benchmark_plan,
|
| 66 |
+
dataset_name=dataset_name,
|
| 67 |
+
seed=random_seed,
|
| 68 |
+
split_ratio=split_ratio,
|
| 69 |
+
force_uint16_mask=force_uint16_mask,
|
| 70 |
+
reorient2RAS=reorient2RAS,
|
| 71 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 72 |
+
)
|
| 73 |
+
planner.process()
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
if __name__ == "__main__":
|
| 77 |
+
# Set up argument parser
|
| 78 |
+
parser = argparse.ArgumentParser(
|
| 79 |
+
description="Generate benchmark planner for segmentation task."
|
| 80 |
+
)
|
| 81 |
+
parser.add_argument(
|
| 82 |
+
"-d",
|
| 83 |
+
"--dir_datasets_data",
|
| 84 |
+
type=str,
|
| 85 |
+
help="Directory path where datasets will be stored",
|
| 86 |
+
required=True,
|
| 87 |
+
)
|
| 88 |
+
parser.add_argument(
|
| 89 |
+
"-n",
|
| 90 |
+
"--dataset_name",
|
| 91 |
+
type=str,
|
| 92 |
+
help="Name of the dataset",
|
| 93 |
+
required=True,
|
| 94 |
+
)
|
| 95 |
+
parser.add_argument(
|
| 96 |
+
"--random_seed",
|
| 97 |
+
type=int,
|
| 98 |
+
default=1024,
|
| 99 |
+
help="Random seed for reproducibility",
|
| 100 |
+
)
|
| 101 |
+
parser.add_argument(
|
| 102 |
+
"--split_ratio",
|
| 103 |
+
type=float,
|
| 104 |
+
default=0.7,
|
| 105 |
+
help="Train/test split ratio (0-1)",
|
| 106 |
+
)
|
| 107 |
+
parser.add_argument(
|
| 108 |
+
"--force_uint16_mask",
|
| 109 |
+
action="store_true",
|
| 110 |
+
help="Force mask to be uint16",
|
| 111 |
+
)
|
| 112 |
+
parser.add_argument(
|
| 113 |
+
"--reorient2RAS",
|
| 114 |
+
action="store_true",
|
| 115 |
+
help="Reorient images and masks to RAS orientation",
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
args = parser.parse_args()
|
| 119 |
+
|
| 120 |
+
main(
|
| 121 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 122 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 123 |
+
dataset_name=args.dataset_name,
|
| 124 |
+
random_seed=args.random_seed,
|
| 125 |
+
split_ratio=args.split_ratio,
|
| 126 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 127 |
+
reorient2RAS=args.reorient2RAS,
|
| 128 |
+
)
|
|
File without changes
|
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import zipfile
|
| 6 |
+
from huggingface_hub import snapshot_download
|
| 7 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# ====================================
|
| 11 |
+
# Dataset Info [!]
|
| 12 |
+
# ====================================
|
| 13 |
+
# Dataset: MAMA-MIA
|
| 14 |
+
# Website: https://github.com/LidiaGarrucho/MAMA-MIA
|
| 15 |
+
# Official Release: https://www.synapse.org/Synapse:syn60868042 (needs SYNAPSE_TOKEN)
|
| 16 |
+
# HF Release: https://huggingface.co/datasets/YongchengYAO/MAMA-MIA-Lite
|
| 17 |
+
# Format: nii.gz
|
| 18 |
+
# NOTE: the HF mirror holds only the FIRST post-contrast phase ('_0001') -- the phase the
|
| 19 |
+
# expert mask is drawn on -- not the full DCE series, hence '-Lite'.
|
| 20 |
+
# ====================================
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 25 |
+
"""
|
| 26 |
+
Download and extract the MAMA-MIA dataset from the HuggingFace mirror.
|
| 27 |
+
|
| 28 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 29 |
+
the other arguments must be kwargs
|
| 30 |
+
"""
|
| 31 |
+
# Download files
|
| 32 |
+
current_dir = os.getcwd()
|
| 33 |
+
os.chdir(dataset_dir)
|
| 34 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 35 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 36 |
+
os.chdir(tmp_dir)
|
| 37 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 38 |
+
|
| 39 |
+
# ====================================
|
| 40 |
+
# Add download logic here [!]
|
| 41 |
+
# ====================================
|
| 42 |
+
# Download dataset (image + mask archives, sharded as data-part*.zip)
|
| 43 |
+
snapshot_download(
|
| 44 |
+
repo_id="YongchengYAO/MAMA-MIA-Lite",
|
| 45 |
+
allow_patterns="*.zip",
|
| 46 |
+
repo_type="dataset",
|
| 47 |
+
revision="989c74c2f1c45266117c3eaa4484485c237c1999", # squashed single commit, 2026-07-27
|
| 48 |
+
local_dir=".",
|
| 49 |
+
max_workers=kwargs.get("max_workers", 1),
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# Extract all zip files
|
| 53 |
+
for zip_file in sorted(glob.glob("*.zip")):
|
| 54 |
+
print(f"extracting {zip_file}")
|
| 55 |
+
with zipfile.ZipFile(zip_file, "r") as zip_ref:
|
| 56 |
+
zip_ref.extractall(".")
|
| 57 |
+
os.remove(zip_file)
|
| 58 |
+
print(f"{zip_file} deleted")
|
| 59 |
+
|
| 60 |
+
# Move folder to dataset_dir
|
| 61 |
+
folders_to_move = [
|
| 62 |
+
"Images",
|
| 63 |
+
"Masks",
|
| 64 |
+
]
|
| 65 |
+
for folder in folders_to_move:
|
| 66 |
+
move_folder(
|
| 67 |
+
os.path.join(tmp_dir, folder),
|
| 68 |
+
os.path.join(dataset_dir, folder),
|
| 69 |
+
create_dest=True,
|
| 70 |
+
)
|
| 71 |
+
# ====================================
|
| 72 |
+
|
| 73 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 74 |
+
os.chdir(dataset_dir)
|
| 75 |
+
shutil.rmtree(tmp_dir)
|
| 76 |
+
os.chdir(current_dir)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 80 |
+
# Create dataset directory
|
| 81 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 82 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 83 |
+
|
| 84 |
+
# Change to dataset directory
|
| 85 |
+
os.chdir(dataset_dir)
|
| 86 |
+
|
| 87 |
+
# Download and extract dataset
|
| 88 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
if __name__ == "__main__":
|
| 92 |
+
# Set up argument parser
|
| 93 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 94 |
+
parser.add_argument(
|
| 95 |
+
"-d",
|
| 96 |
+
"--dir_datasets_data",
|
| 97 |
+
help="Directory path where datasets will be stored",
|
| 98 |
+
required=True,
|
| 99 |
+
)
|
| 100 |
+
parser.add_argument(
|
| 101 |
+
"-n",
|
| 102 |
+
"--dataset_name",
|
| 103 |
+
help="Name of the dataset",
|
| 104 |
+
required=True,
|
| 105 |
+
)
|
| 106 |
+
parser.add_argument(
|
| 107 |
+
"--max_workers",
|
| 108 |
+
type=int,
|
| 109 |
+
default=1,
|
| 110 |
+
help="Maximum number of workers for download",
|
| 111 |
+
)
|
| 112 |
+
args = parser.parse_args()
|
| 113 |
+
|
| 114 |
+
# Extract known arguments and pass the rest as kwargs
|
| 115 |
+
kwargs = {"max_workers": args.max_workers}
|
| 116 |
+
|
| 117 |
+
main(
|
| 118 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 119 |
+
dataset_name=args.dataset_name,
|
| 120 |
+
**kwargs,
|
| 121 |
+
)
|
|
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import nibabel as nib
|
| 6 |
+
import synapseclient
|
| 7 |
+
from medvision_ds.utils.preprocess_utils import move_folder, _get_cgroup_limited_cpus
|
| 8 |
+
from medvision_ds.utils.data_conversion import (
|
| 9 |
+
convert_mask_to_uint16_per_dir,
|
| 10 |
+
copy_img_header_to_mask,
|
| 11 |
+
)
|
| 12 |
+
from medvision_ds.utils.download_utils import retry_call
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# ====================================
|
| 16 |
+
# Dataset Info [!]
|
| 17 |
+
# ====================================
|
| 18 |
+
# Dataset: MAMA-MIA
|
| 19 |
+
# Website: https://github.com/LidiaGarrucho/MAMA-MIA
|
| 20 |
+
# Data: https://www.synapse.org/Synapse:syn60868042 (requires SYNAPSE_TOKEN)
|
| 21 |
+
# Format: nii.gz
|
| 22 |
+
# Notes:
|
| 23 |
+
# - Breast DCE-MRI. images/<ID>/<ID>_0000.nii.gz (pre-contrast),
|
| 24 |
+
# <ID>_0001.nii.gz (FIRST post-contrast), <ID>_0002.. (later phases).
|
| 25 |
+
# Phase index convention confirmed against the official reader
|
| 26 |
+
# (MAMA-MIA/src/preprocessing.py::read_mri_phase_from_patient_id).
|
| 27 |
+
# - Expert tumour masks: segmentations/expert/<ID>.nii.gz (drawn on the
|
| 28 |
+
# FIRST post-contrast image). Binary mask, label 1 = breast tumor.
|
| 29 |
+
# - We use ONLY <ID>_0001.nii.gz as the image (1 volume per subject).
|
| 30 |
+
# - 1506 cases (DUKE / ISPY1 / ISPY2 / NACT), each with an expert mask.
|
| 31 |
+
# - We download ONLY the files we need (~5 phases per case exist, plus
|
| 32 |
+
# automatic segmentations and nnUNet weights that we never use), so we
|
| 33 |
+
# resolve the entities case by case instead of syncing the whole project.
|
| 34 |
+
# - Note: synapseclient also keeps a copy of every download in its cache
|
| 35 |
+
# (~/.synapseCache); set SYNAPSE_CACHE_LOCATION or clear it if disk is tight.
|
| 36 |
+
# ====================================
|
| 37 |
+
|
| 38 |
+
PROJECT_ID = "syn60868042"
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def _resolve_entity(syn, name, parent_id):
|
| 42 |
+
"""Resolve a child entity by name, failing loudly if the layout changed."""
|
| 43 |
+
entity_id = retry_call(
|
| 44 |
+
syn.findEntityId, name, parent=parent_id, label=f"findEntityId({name})"
|
| 45 |
+
)
|
| 46 |
+
if entity_id is None:
|
| 47 |
+
raise FileNotFoundError(
|
| 48 |
+
f"Synapse entity '{name}' not found under {parent_id}"
|
| 49 |
+
)
|
| 50 |
+
return entity_id
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 54 |
+
"""
|
| 55 |
+
Download and extract the MAMA-MIA dataset.
|
| 56 |
+
|
| 57 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 58 |
+
the other arguments must be kwargs
|
| 59 |
+
"""
|
| 60 |
+
# Download files
|
| 61 |
+
current_dir = os.getcwd()
|
| 62 |
+
os.chdir(dataset_dir)
|
| 63 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 64 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 65 |
+
os.chdir(tmp_dir)
|
| 66 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 67 |
+
|
| 68 |
+
# ====================================
|
| 69 |
+
# Add download logic here [!]
|
| 70 |
+
# ====================================
|
| 71 |
+
# Initialize Synapse client
|
| 72 |
+
syn = synapseclient.Synapse()
|
| 73 |
+
token = os.environ.get("SYNAPSE_TOKEN")
|
| 74 |
+
if not token:
|
| 75 |
+
raise ValueError("SYNAPSE_TOKEN environment variable not set")
|
| 76 |
+
syn.login(authToken=token)
|
| 77 |
+
|
| 78 |
+
# Resolve the project layout: images/<ID>/ and segmentations/expert/
|
| 79 |
+
images_id = _resolve_entity(syn, "images", PROJECT_ID)
|
| 80 |
+
segmentations_id = _resolve_entity(syn, "segmentations", PROJECT_ID)
|
| 81 |
+
expert_id = _resolve_entity(syn, "expert", segmentations_id)
|
| 82 |
+
|
| 83 |
+
# Create Images and Masks directories
|
| 84 |
+
os.makedirs("Images", exist_ok=True)
|
| 85 |
+
os.makedirs("Masks", exist_ok=True)
|
| 86 |
+
|
| 87 |
+
# Iterate over expert masks (one per case) to guarantee 1 volume per subject
|
| 88 |
+
expert_children = retry_call(
|
| 89 |
+
lambda: list(syn.getChildren(expert_id, includeTypes=["file"])),
|
| 90 |
+
label="getChildren(expert)",
|
| 91 |
+
)
|
| 92 |
+
expert_masks = {
|
| 93 |
+
child["name"][: -len(".nii.gz")]: child["id"]
|
| 94 |
+
for child in expert_children
|
| 95 |
+
if child["name"].endswith(".nii.gz")
|
| 96 |
+
}
|
| 97 |
+
if not expert_masks:
|
| 98 |
+
raise FileNotFoundError(
|
| 99 |
+
f"No expert segmentations found under segmentations/expert ({expert_id})"
|
| 100 |
+
)
|
| 101 |
+
print(f"-- Found {len(expert_masks)} expert segmentations")
|
| 102 |
+
|
| 103 |
+
image_children = retry_call(
|
| 104 |
+
lambda: list(syn.getChildren(images_id, includeTypes=["folder"])),
|
| 105 |
+
label="getChildren(images)",
|
| 106 |
+
)
|
| 107 |
+
case_folders = {
|
| 108 |
+
child["name"]: child["id"] for child in image_children
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
downloaded = 0
|
| 112 |
+
for case_id, mask_syn_id in sorted(expert_masks.items()):
|
| 113 |
+
# Case-level resume: a crashed run leaves tmp/ intact, so skip cases whose
|
| 114 |
+
# final renamed pair already exists (os.replace is atomic, so existence == complete).
|
| 115 |
+
if os.path.exists(os.path.join("Images", f"{case_id}.nii.gz")) and os.path.exists(
|
| 116 |
+
os.path.join("Masks", f"{case_id}.nii.gz")
|
| 117 |
+
):
|
| 118 |
+
downloaded += 1
|
| 119 |
+
continue
|
| 120 |
+
|
| 121 |
+
folder_id = case_folders.get(case_id)
|
| 122 |
+
if folder_id is None:
|
| 123 |
+
print(f"-- Skipping {case_id}: no images/{case_id}/ folder found")
|
| 124 |
+
continue
|
| 125 |
+
|
| 126 |
+
# Locate the FIRST post-contrast image for this case (_0000 is pre-contrast)
|
| 127 |
+
img_syn_id = retry_call(
|
| 128 |
+
syn.findEntityId,
|
| 129 |
+
f"{case_id}_0001.nii.gz",
|
| 130 |
+
parent=folder_id,
|
| 131 |
+
label=f"findEntityId({case_id}_0001)",
|
| 132 |
+
)
|
| 133 |
+
if img_syn_id is None:
|
| 134 |
+
print(f"-- Skipping {case_id}: no {case_id}_0001.nii.gz found")
|
| 135 |
+
continue
|
| 136 |
+
|
| 137 |
+
img_ent = retry_call(
|
| 138 |
+
syn.get,
|
| 139 |
+
img_syn_id,
|
| 140 |
+
downloadLocation="Images",
|
| 141 |
+
ifcollision="overwrite.local",
|
| 142 |
+
label=f"syn.get(img {case_id})",
|
| 143 |
+
)
|
| 144 |
+
mask_ent = retry_call(
|
| 145 |
+
syn.get,
|
| 146 |
+
mask_syn_id,
|
| 147 |
+
downloadLocation="Masks",
|
| 148 |
+
ifcollision="overwrite.local",
|
| 149 |
+
label=f"syn.get(mask {case_id})",
|
| 150 |
+
)
|
| 151 |
+
os.replace(img_ent.path, os.path.join("Images", f"{case_id}.nii.gz"))
|
| 152 |
+
os.replace(mask_ent.path, os.path.join("Masks", f"{case_id}.nii.gz"))
|
| 153 |
+
downloaded += 1
|
| 154 |
+
print(f"-- Downloaded {case_id} ({downloaded}/{len(expert_masks)})")
|
| 155 |
+
print(f"-- Downloaded {downloaded} image/mask pairs")
|
| 156 |
+
|
| 157 |
+
# Copy Nifti header of images to masks (Multiprocessing)
|
| 158 |
+
print("Copying Nifti headers from images to masks...")
|
| 159 |
+
available_cpus = kwargs.get("max_workers", 1) or _get_cgroup_limited_cpus()
|
| 160 |
+
img_files = list(glob.glob(os.path.join("Images", "*.nii.gz")))
|
| 161 |
+
|
| 162 |
+
# The header copy overwrites the mask affine with the image affine, which is
|
| 163 |
+
# only valid if both are sampled on the same grid -- verify before doing it.
|
| 164 |
+
# At full scale a single bad pair must NOT abort the whole run (that would discard
|
| 165 |
+
# a multi-GB download and re-fail identically on every restart): skip+log the bad
|
| 166 |
+
# cases, removing BOTH files so the shipped dataset only holds header-consistent pairs.
|
| 167 |
+
mismatched = [
|
| 168 |
+
os.path.basename(f)
|
| 169 |
+
for f in img_files
|
| 170 |
+
if nib.load(f).shape
|
| 171 |
+
!= nib.load(os.path.join("Masks", os.path.basename(f))).shape
|
| 172 |
+
]
|
| 173 |
+
if mismatched:
|
| 174 |
+
print(
|
| 175 |
+
f"⚠️ Image/mask shape mismatch for {len(mismatched)} case(s); "
|
| 176 |
+
f"dropping them, e.g. {mismatched[:5]}"
|
| 177 |
+
)
|
| 178 |
+
mismatched_set = set(mismatched)
|
| 179 |
+
for name in mismatched:
|
| 180 |
+
for sub in ("Images", "Masks"):
|
| 181 |
+
fp = os.path.join(sub, name)
|
| 182 |
+
if os.path.exists(fp):
|
| 183 |
+
os.remove(fp)
|
| 184 |
+
img_files = [
|
| 185 |
+
f for f in img_files if os.path.basename(f) not in mismatched_set
|
| 186 |
+
]
|
| 187 |
+
|
| 188 |
+
copy_img_header_to_mask(img_files, "Masks", workers_limit=available_cpus)
|
| 189 |
+
|
| 190 |
+
# Convert masks to uint16 (Multiprocessing) -- must run AFTER header copy
|
| 191 |
+
convert_mask_to_uint16_per_dir("Masks", workers_limit=available_cpus)
|
| 192 |
+
|
| 193 |
+
# Move folder to dataset_dir
|
| 194 |
+
folders_to_move = [
|
| 195 |
+
"Images",
|
| 196 |
+
"Masks",
|
| 197 |
+
]
|
| 198 |
+
for folder in folders_to_move:
|
| 199 |
+
move_folder(
|
| 200 |
+
os.path.join(tmp_dir, folder),
|
| 201 |
+
os.path.join(dataset_dir, folder),
|
| 202 |
+
create_dest=True,
|
| 203 |
+
)
|
| 204 |
+
# ====================================
|
| 205 |
+
|
| 206 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 207 |
+
os.chdir(dataset_dir)
|
| 208 |
+
shutil.rmtree(tmp_dir)
|
| 209 |
+
os.chdir(current_dir)
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 213 |
+
# Create dataset directory
|
| 214 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 215 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 216 |
+
|
| 217 |
+
# Change to dataset directory
|
| 218 |
+
os.chdir(dataset_dir)
|
| 219 |
+
|
| 220 |
+
# Download and extract dataset
|
| 221 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
if __name__ == "__main__":
|
| 225 |
+
# Set up argument parser
|
| 226 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 227 |
+
parser.add_argument(
|
| 228 |
+
"-d",
|
| 229 |
+
"--dir_datasets_data",
|
| 230 |
+
help="Directory path where datasets will be stored",
|
| 231 |
+
required=True,
|
| 232 |
+
)
|
| 233 |
+
parser.add_argument(
|
| 234 |
+
"-n",
|
| 235 |
+
"--dataset_name",
|
| 236 |
+
help="Name of the dataset",
|
| 237 |
+
required=True,
|
| 238 |
+
)
|
| 239 |
+
parser.add_argument(
|
| 240 |
+
"--max_workers",
|
| 241 |
+
type=int,
|
| 242 |
+
default=1,
|
| 243 |
+
help="Maximum number of workers for download",
|
| 244 |
+
)
|
| 245 |
+
args = parser.parse_args()
|
| 246 |
+
|
| 247 |
+
# Extract known arguments and pass the rest as kwargs
|
| 248 |
+
kwargs = {"max_workers": args.max_workers}
|
| 249 |
+
|
| 250 |
+
main(
|
| 251 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 252 |
+
dataset_name=args.dataset_name,
|
| 253 |
+
**kwargs,
|
| 254 |
+
)
|
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerBiometry_fromSeg
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# ====================================
|
| 12 |
+
CLUSTER_SIZE_THRESHOLD = 20
|
| 13 |
+
|
| 14 |
+
dataset_info = {
|
| 15 |
+
"dataset": "MAMA-MIA",
|
| 16 |
+
"dataset_website": "https://github.com/LidiaGarrucho/MAMA-MIA",
|
| 17 |
+
"dataset_data": [
|
| 18 |
+
"https://www.synapse.org/Synapse:syn60868042",
|
| 19 |
+
],
|
| 20 |
+
"license": ["CC BY-NC 4.0"],
|
| 21 |
+
"paper": [
|
| 22 |
+
"https://doi.org/10.1038/s41597-025-04707-4",
|
| 23 |
+
"https://arxiv.org/abs/2603.01250",
|
| 24 |
+
],
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
labels_map = {
|
| 28 |
+
"1": "breast tumor",
|
| 29 |
+
}
|
| 30 |
+
# ====================================
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# ===============
|
| 34 |
+
# DO NOT CHANGE
|
| 35 |
+
# ===============
|
| 36 |
+
landmarks_map = {
|
| 37 |
+
"P1": "most right/anterior/superior endpoint of the major axis",
|
| 38 |
+
"P2": "most left/superior/inferior endpoint of the major axis",
|
| 39 |
+
"P3": "most right/anterior/superior endpoint of the minor axis",
|
| 40 |
+
"P4": "most left/superior/inferior endpoint of the minor axis",
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
lines_map = {
|
| 44 |
+
"L-1-2": {
|
| 45 |
+
"name": "marjor axis of the fitted ellipse",
|
| 46 |
+
"element_keys": ["P1", "P2"],
|
| 47 |
+
"element_map_name": "landmarks_map",
|
| 48 |
+
},
|
| 49 |
+
"L-3-4": {
|
| 50 |
+
"name": "minor axis of the fitted ellipse",
|
| 51 |
+
"element_keys": ["P3", "P4"],
|
| 52 |
+
"element_map_name": "landmarks_map",
|
| 53 |
+
},
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
angles_map = {}
|
| 57 |
+
|
| 58 |
+
biometrics_map = [
|
| 59 |
+
{
|
| 60 |
+
"metric_type": "distance",
|
| 61 |
+
"metric_map_name": "lines_map",
|
| 62 |
+
"metric_key": "L-1-2",
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"metric_type": "distance",
|
| 66 |
+
"metric_map_name": "lines_map",
|
| 67 |
+
"metric_key": "L-3-4",
|
| 68 |
+
},
|
| 69 |
+
]
|
| 70 |
+
# ===============
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
benchmark_plan = {
|
| 74 |
+
"dataset_info": dataset_info,
|
| 75 |
+
"tasks": [
|
| 76 |
+
{
|
| 77 |
+
"image_modality": "MRI",
|
| 78 |
+
"image_description": "breast dynamic contrast-enhanced (first post-contrast) magnetic resonance imaging (MRI) scan",
|
| 79 |
+
"image_folder": "Images",
|
| 80 |
+
"mask_folder": "Masks",
|
| 81 |
+
"landmark_folder": "Landmarks-Label1",
|
| 82 |
+
"landmark_figure_folder": "Landmarks-Label1-fig",
|
| 83 |
+
"image_prefix": "",
|
| 84 |
+
"image_suffix": ".nii.gz",
|
| 85 |
+
"mask_prefix": "",
|
| 86 |
+
"mask_suffix": ".nii.gz",
|
| 87 |
+
"landmark_prefix": "",
|
| 88 |
+
"landmark_suffix": ".json.gz",
|
| 89 |
+
"labels_map": labels_map,
|
| 90 |
+
"landmarks_map": landmarks_map,
|
| 91 |
+
"lines_map": lines_map,
|
| 92 |
+
"angles_map": angles_map,
|
| 93 |
+
"biometrics_map": biometrics_map,
|
| 94 |
+
"target_label": 1,
|
| 95 |
+
"cluster_size_threshold": CLUSTER_SIZE_THRESHOLD,
|
| 96 |
+
},
|
| 97 |
+
],
|
| 98 |
+
}
|
| 99 |
+
# ====================================
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def main(
|
| 103 |
+
dir_datasets_data,
|
| 104 |
+
dataset_name,
|
| 105 |
+
benchmark_plan=benchmark_plan,
|
| 106 |
+
random_seed=1024,
|
| 107 |
+
split_ratio=0.7,
|
| 108 |
+
shrunken_bbox_scale=0.9,
|
| 109 |
+
enlarged_bbox_scale=1.1,
|
| 110 |
+
force_uint16_mask=False,
|
| 111 |
+
reorient2RAS=False,
|
| 112 |
+
visualization=True,
|
| 113 |
+
):
|
| 114 |
+
# Create dataset directory
|
| 115 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 116 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 117 |
+
|
| 118 |
+
# Change to dataset directory
|
| 119 |
+
os.chdir(dataset_dir)
|
| 120 |
+
|
| 121 |
+
# Process dataset for segmentation task
|
| 122 |
+
planner = MedVision_BenchmarkPlannerBiometry_fromSeg(
|
| 123 |
+
dataset_dir=dataset_dir,
|
| 124 |
+
bm_plan=benchmark_plan,
|
| 125 |
+
dataset_name=dataset_name,
|
| 126 |
+
seed=random_seed,
|
| 127 |
+
split_ratio=split_ratio,
|
| 128 |
+
shrunk_bbox_scale=shrunken_bbox_scale,
|
| 129 |
+
enlarged_bbox_scale=enlarged_bbox_scale,
|
| 130 |
+
force_uint16_mask=force_uint16_mask,
|
| 131 |
+
reorient2RAS=reorient2RAS,
|
| 132 |
+
visualization=visualization,
|
| 133 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 134 |
+
)
|
| 135 |
+
planner.process()
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
if __name__ == "__main__":
|
| 139 |
+
# Set up argument parser
|
| 140 |
+
parser = argparse.ArgumentParser(
|
| 141 |
+
description="Generate benchmark planner for biometric measurement task."
|
| 142 |
+
)
|
| 143 |
+
parser.add_argument(
|
| 144 |
+
"-d",
|
| 145 |
+
"--dir_datasets_data",
|
| 146 |
+
type=str,
|
| 147 |
+
help="Directory path where datasets will be stored",
|
| 148 |
+
required=True,
|
| 149 |
+
)
|
| 150 |
+
parser.add_argument(
|
| 151 |
+
"-n",
|
| 152 |
+
"--dataset_name",
|
| 153 |
+
type=str,
|
| 154 |
+
help="Name of the dataset",
|
| 155 |
+
required=True,
|
| 156 |
+
)
|
| 157 |
+
parser.add_argument(
|
| 158 |
+
"--random_seed",
|
| 159 |
+
type=int,
|
| 160 |
+
default=1024,
|
| 161 |
+
help="Random seed for reproducibility",
|
| 162 |
+
)
|
| 163 |
+
parser.add_argument(
|
| 164 |
+
"--split_ratio",
|
| 165 |
+
type=float,
|
| 166 |
+
default=0.7,
|
| 167 |
+
help="Train/test split ratio (0-1)",
|
| 168 |
+
)
|
| 169 |
+
parser.add_argument(
|
| 170 |
+
"--shrunken_bbox_scale",
|
| 171 |
+
type=float,
|
| 172 |
+
default=0.9,
|
| 173 |
+
help="Scale factor for shrunken bounding box",
|
| 174 |
+
)
|
| 175 |
+
parser.add_argument(
|
| 176 |
+
"--enlarged_bbox_scale",
|
| 177 |
+
type=float,
|
| 178 |
+
default=1.1,
|
| 179 |
+
help="Scale factor for enlarged bounding box",
|
| 180 |
+
)
|
| 181 |
+
parser.add_argument(
|
| 182 |
+
"--force_uint16_mask",
|
| 183 |
+
action="store_true",
|
| 184 |
+
help="Force mask to be uint16",
|
| 185 |
+
)
|
| 186 |
+
parser.add_argument(
|
| 187 |
+
"--reorient2RAS",
|
| 188 |
+
action="store_true",
|
| 189 |
+
help="Reorient images and masks to RAS orientation",
|
| 190 |
+
)
|
| 191 |
+
parser.add_argument(
|
| 192 |
+
"--visualization",
|
| 193 |
+
action=argparse.BooleanOptionalAction,
|
| 194 |
+
default=True,
|
| 195 |
+
help="Save T/L ellipse landmark figures (Landmarks-Label<N>-fig); default: on",
|
| 196 |
+
)
|
| 197 |
+
args = parser.parse_args()
|
| 198 |
+
|
| 199 |
+
main(
|
| 200 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 201 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 202 |
+
dataset_name=args.dataset_name,
|
| 203 |
+
random_seed=args.random_seed,
|
| 204 |
+
split_ratio=args.split_ratio,
|
| 205 |
+
shrunken_bbox_scale=args.shrunken_bbox_scale,
|
| 206 |
+
enlarged_bbox_scale=args.enlarged_bbox_scale,
|
| 207 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 208 |
+
reorient2RAS=args.reorient2RAS,
|
| 209 |
+
visualization=args.visualization,
|
| 210 |
+
)
|
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerDetection
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# - labels_map
|
| 12 |
+
# ====================================
|
| 13 |
+
dataset_info = {
|
| 14 |
+
"dataset": "MAMA-MIA",
|
| 15 |
+
"dataset_website": "https://github.com/LidiaGarrucho/MAMA-MIA",
|
| 16 |
+
"dataset_data": [
|
| 17 |
+
"https://www.synapse.org/Synapse:syn60868042",
|
| 18 |
+
],
|
| 19 |
+
"license": ["CC BY-NC 4.0"],
|
| 20 |
+
"paper": [
|
| 21 |
+
"https://doi.org/10.1038/s41597-025-04707-4",
|
| 22 |
+
"https://arxiv.org/abs/2603.01250",
|
| 23 |
+
],
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
labels_map = {
|
| 27 |
+
"1": "breast tumor",
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
benchmark_plan = {
|
| 31 |
+
"dataset_info": dataset_info,
|
| 32 |
+
"tasks": [
|
| 33 |
+
{
|
| 34 |
+
"image_modality": "MRI",
|
| 35 |
+
"image_description": "breast dynamic contrast-enhanced (first post-contrast) magnetic resonance imaging (MRI) scan",
|
| 36 |
+
"image_folder": "Images",
|
| 37 |
+
"mask_folder": "Masks",
|
| 38 |
+
"image_prefix": "",
|
| 39 |
+
"image_suffix": ".nii.gz",
|
| 40 |
+
"mask_prefix": "",
|
| 41 |
+
"mask_suffix": ".nii.gz",
|
| 42 |
+
"labels_map": labels_map,
|
| 43 |
+
},
|
| 44 |
+
],
|
| 45 |
+
}
|
| 46 |
+
# ====================================
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def main(
|
| 50 |
+
dir_datasets_data,
|
| 51 |
+
dataset_name,
|
| 52 |
+
benchmark_plan=benchmark_plan,
|
| 53 |
+
random_seed=1024,
|
| 54 |
+
split_ratio=0.7,
|
| 55 |
+
force_uint16_mask=False,
|
| 56 |
+
reorient2RAS=False,
|
| 57 |
+
):
|
| 58 |
+
# Create dataset directory
|
| 59 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 60 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 61 |
+
|
| 62 |
+
# Change to dataset directory
|
| 63 |
+
os.chdir(dataset_dir)
|
| 64 |
+
|
| 65 |
+
# Process dataset for detection task
|
| 66 |
+
planner = MedVision_BenchmarkPlannerDetection(
|
| 67 |
+
dataset_dir=dataset_dir,
|
| 68 |
+
bm_plan=benchmark_plan,
|
| 69 |
+
dataset_name=dataset_name,
|
| 70 |
+
seed=random_seed,
|
| 71 |
+
split_ratio=split_ratio,
|
| 72 |
+
force_uint16_mask=force_uint16_mask,
|
| 73 |
+
reorient2RAS=reorient2RAS,
|
| 74 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 75 |
+
)
|
| 76 |
+
planner.process()
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
if __name__ == "__main__":
|
| 80 |
+
# Set up argument parser
|
| 81 |
+
parser = argparse.ArgumentParser(
|
| 82 |
+
description="Generate benchmark planner for detection task."
|
| 83 |
+
)
|
| 84 |
+
parser.add_argument(
|
| 85 |
+
"-d",
|
| 86 |
+
"--dir_datasets_data",
|
| 87 |
+
type=str,
|
| 88 |
+
help="Directory path where datasets will be stored",
|
| 89 |
+
required=True,
|
| 90 |
+
)
|
| 91 |
+
parser.add_argument(
|
| 92 |
+
"-n",
|
| 93 |
+
"--dataset_name",
|
| 94 |
+
type=str,
|
| 95 |
+
help="Name of the dataset",
|
| 96 |
+
required=True,
|
| 97 |
+
)
|
| 98 |
+
parser.add_argument(
|
| 99 |
+
"--random_seed",
|
| 100 |
+
type=int,
|
| 101 |
+
default=1024,
|
| 102 |
+
help="Random seed for reproducibility",
|
| 103 |
+
)
|
| 104 |
+
parser.add_argument(
|
| 105 |
+
"--split_ratio",
|
| 106 |
+
type=float,
|
| 107 |
+
default=0.7,
|
| 108 |
+
help="Train/test split ratio (0-1)",
|
| 109 |
+
)
|
| 110 |
+
parser.add_argument(
|
| 111 |
+
"--force_uint16_mask",
|
| 112 |
+
action="store_true",
|
| 113 |
+
help="Force mask to be uint16",
|
| 114 |
+
)
|
| 115 |
+
parser.add_argument(
|
| 116 |
+
"--reorient2RAS",
|
| 117 |
+
action="store_true",
|
| 118 |
+
help="Reorient images and masks to RAS orientation",
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
args = parser.parse_args()
|
| 122 |
+
|
| 123 |
+
main(
|
| 124 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 125 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 126 |
+
dataset_name=args.dataset_name,
|
| 127 |
+
random_seed=args.random_seed,
|
| 128 |
+
split_ratio=args.split_ratio,
|
| 129 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 130 |
+
reorient2RAS=args.reorient2RAS,
|
| 131 |
+
)
|
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerSegmentation
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# - labels_map
|
| 12 |
+
# ====================================
|
| 13 |
+
dataset_info = {
|
| 14 |
+
"dataset": "MAMA-MIA",
|
| 15 |
+
"dataset_website": "https://github.com/LidiaGarrucho/MAMA-MIA",
|
| 16 |
+
"dataset_data": [
|
| 17 |
+
"https://www.synapse.org/Synapse:syn60868042",
|
| 18 |
+
],
|
| 19 |
+
"license": ["CC BY-NC 4.0"],
|
| 20 |
+
"paper": [
|
| 21 |
+
"https://doi.org/10.1038/s41597-025-04707-4",
|
| 22 |
+
"https://arxiv.org/abs/2603.01250",
|
| 23 |
+
],
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
labels_map = {
|
| 27 |
+
"1": "breast tumor",
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
benchmark_plan = {
|
| 31 |
+
"dataset_info": dataset_info,
|
| 32 |
+
"tasks": [
|
| 33 |
+
{
|
| 34 |
+
"image_modality": "MRI",
|
| 35 |
+
"image_description": "breast dynamic contrast-enhanced (first post-contrast) magnetic resonance imaging (MRI) scan",
|
| 36 |
+
"image_folder": "Images",
|
| 37 |
+
"mask_folder": "Masks",
|
| 38 |
+
"image_prefix": "",
|
| 39 |
+
"image_suffix": ".nii.gz",
|
| 40 |
+
"mask_prefix": "",
|
| 41 |
+
"mask_suffix": ".nii.gz",
|
| 42 |
+
"labels_map": labels_map,
|
| 43 |
+
},
|
| 44 |
+
],
|
| 45 |
+
}
|
| 46 |
+
# ====================================
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def main(
|
| 50 |
+
dir_datasets_data,
|
| 51 |
+
dataset_name,
|
| 52 |
+
benchmark_plan=benchmark_plan,
|
| 53 |
+
random_seed=1024,
|
| 54 |
+
split_ratio=0.7,
|
| 55 |
+
force_uint16_mask=False,
|
| 56 |
+
reorient2RAS=False,
|
| 57 |
+
):
|
| 58 |
+
# Create dataset directory
|
| 59 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 60 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 61 |
+
|
| 62 |
+
# Change to dataset directory
|
| 63 |
+
os.chdir(dataset_dir)
|
| 64 |
+
|
| 65 |
+
# Process dataset for segmentation task
|
| 66 |
+
planner = MedVision_BenchmarkPlannerSegmentation(
|
| 67 |
+
dataset_dir=dataset_dir,
|
| 68 |
+
bm_plan=benchmark_plan,
|
| 69 |
+
dataset_name=dataset_name,
|
| 70 |
+
seed=random_seed,
|
| 71 |
+
split_ratio=split_ratio,
|
| 72 |
+
force_uint16_mask=force_uint16_mask,
|
| 73 |
+
reorient2RAS=reorient2RAS,
|
| 74 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 75 |
+
)
|
| 76 |
+
planner.process()
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
if __name__ == "__main__":
|
| 80 |
+
# Set up argument parser
|
| 81 |
+
parser = argparse.ArgumentParser(
|
| 82 |
+
description="Generate benchmark planner for segmentation task."
|
| 83 |
+
)
|
| 84 |
+
parser.add_argument(
|
| 85 |
+
"-d",
|
| 86 |
+
"--dir_datasets_data",
|
| 87 |
+
type=str,
|
| 88 |
+
help="Directory path where datasets will be stored",
|
| 89 |
+
required=True,
|
| 90 |
+
)
|
| 91 |
+
parser.add_argument(
|
| 92 |
+
"-n",
|
| 93 |
+
"--dataset_name",
|
| 94 |
+
type=str,
|
| 95 |
+
help="Name of the dataset",
|
| 96 |
+
required=True,
|
| 97 |
+
)
|
| 98 |
+
parser.add_argument(
|
| 99 |
+
"--random_seed",
|
| 100 |
+
type=int,
|
| 101 |
+
default=1024,
|
| 102 |
+
help="Random seed for reproducibility",
|
| 103 |
+
)
|
| 104 |
+
parser.add_argument(
|
| 105 |
+
"--split_ratio",
|
| 106 |
+
type=float,
|
| 107 |
+
default=0.7,
|
| 108 |
+
help="Train/test split ratio (0-1)",
|
| 109 |
+
)
|
| 110 |
+
parser.add_argument(
|
| 111 |
+
"--force_uint16_mask",
|
| 112 |
+
action="store_true",
|
| 113 |
+
help="Force mask to be uint16",
|
| 114 |
+
)
|
| 115 |
+
parser.add_argument(
|
| 116 |
+
"--reorient2RAS",
|
| 117 |
+
action="store_true",
|
| 118 |
+
help="Reorient images and masks to RAS orientation",
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
args = parser.parse_args()
|
| 122 |
+
|
| 123 |
+
main(
|
| 124 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 125 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 126 |
+
dataset_name=args.dataset_name,
|
| 127 |
+
random_seed=args.random_seed,
|
| 128 |
+
split_ratio=args.split_ratio,
|
| 129 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 130 |
+
reorient2RAS=args.reorient2RAS,
|
| 131 |
+
)
|
|
File without changes
|
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
import glob
|
| 5 |
+
import zipfile
|
| 6 |
+
from huggingface_hub import snapshot_download
|
| 7 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# ====================================
|
| 11 |
+
# Dataset Info [!]
|
| 12 |
+
# ====================================
|
| 13 |
+
# Dataset: PDDCA (Public Domain Database for Computational Anatomy)
|
| 14 |
+
# Website: http://www.imagenglab.com/newsite/pddca/
|
| 15 |
+
# Official Release: https://www.imagenglab.com/data/pddca/
|
| 16 |
+
# HF Release: https://huggingface.co/datasets/YongchengYAO/PDDCA
|
| 17 |
+
# Format: nii.gz
|
| 18 |
+
# ====================================
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def _link_landmark_subset(dataset_dir, src_folder, dst_folder):
|
| 22 |
+
"""Rebuild the biometry image subset by linking the cases named in ``Landmarks/``.
|
| 23 |
+
|
| 24 |
+
The biometry planner enumerates cases from its task's ``image_folder`` and raises
|
| 25 |
+
``FileNotFoundError`` if any image there has no landmark file, so that folder must be
|
| 26 |
+
exactly 1:1 with ``Landmarks/``. Rather than mirroring those volumes into the HF repo
|
| 27 |
+
(they are a strict subset of ``Images/``), they are re-linked here.
|
| 28 |
+
|
| 29 |
+
This is safe because ``MedVision.py`` extracts the annotation zip carrying ``Landmarks/``
|
| 30 |
+
in step 3.1, BEFORE invoking this script in step 3.2.
|
| 31 |
+
"""
|
| 32 |
+
landmarks_dir = os.path.join(dataset_dir, "Landmarks")
|
| 33 |
+
if not os.path.isdir(landmarks_dir):
|
| 34 |
+
print(f" - No {landmarks_dir}; skipping {dst_folder} (biometry task will be unavailable)")
|
| 35 |
+
return
|
| 36 |
+
src_dir = os.path.join(dataset_dir, src_folder)
|
| 37 |
+
dst_dir = os.path.join(dataset_dir, dst_folder)
|
| 38 |
+
os.makedirs(dst_dir, exist_ok=True)
|
| 39 |
+
n_linked = 0
|
| 40 |
+
for landmark_file in sorted(glob.glob(os.path.join(landmarks_dir, "*.json.gz"))):
|
| 41 |
+
caseID = os.path.basename(landmark_file)[: -len(".json.gz")]
|
| 42 |
+
src = os.path.join(src_dir, f"{caseID}.nii.gz")
|
| 43 |
+
dst = os.path.join(dst_dir, f"{caseID}.nii.gz")
|
| 44 |
+
if not os.path.exists(src) or os.path.exists(dst):
|
| 45 |
+
continue
|
| 46 |
+
try:
|
| 47 |
+
os.link(src, dst) # hardlink: no extra disk for a duplicate volume
|
| 48 |
+
except OSError:
|
| 49 |
+
shutil.copy2(src, dst) # filesystem without hardlink support
|
| 50 |
+
n_linked += 1
|
| 51 |
+
print(f" - Built {dst_folder}: {n_linked} cases")
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 55 |
+
"""
|
| 56 |
+
Download and extract the PDDCA dataset from the HuggingFace mirror.
|
| 57 |
+
|
| 58 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 59 |
+
the other arguments must be kwargs
|
| 60 |
+
"""
|
| 61 |
+
# Download files
|
| 62 |
+
current_dir = os.getcwd()
|
| 63 |
+
os.chdir(dataset_dir)
|
| 64 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 65 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 66 |
+
os.chdir(tmp_dir)
|
| 67 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 68 |
+
|
| 69 |
+
# ====================================
|
| 70 |
+
# Add download logic here [!]
|
| 71 |
+
# ====================================
|
| 72 |
+
# Download dataset (image + mask archives, sharded as data-part*.zip)
|
| 73 |
+
snapshot_download(
|
| 74 |
+
repo_id="YongchengYAO/PDDCA-Lite",
|
| 75 |
+
allow_patterns="*.zip",
|
| 76 |
+
repo_type="dataset",
|
| 77 |
+
revision="dd814c9679d6f08e2adf918018cf917fc879e6e7", # squashed single commit, 2026-07-27
|
| 78 |
+
local_dir=".",
|
| 79 |
+
max_workers=kwargs.get("max_workers", 1),
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
# Extract all zip files
|
| 83 |
+
for zip_file in sorted(glob.glob("*.zip")):
|
| 84 |
+
print(f"extracting {zip_file}")
|
| 85 |
+
with zipfile.ZipFile(zip_file, "r") as zip_ref:
|
| 86 |
+
zip_ref.extractall(".")
|
| 87 |
+
os.remove(zip_file)
|
| 88 |
+
print(f"{zip_file} deleted")
|
| 89 |
+
|
| 90 |
+
# Move folder to dataset_dir
|
| 91 |
+
folders_to_move = [
|
| 92 |
+
"Images",
|
| 93 |
+
"Masks",
|
| 94 |
+
]
|
| 95 |
+
for folder in folders_to_move:
|
| 96 |
+
move_folder(
|
| 97 |
+
os.path.join(tmp_dir, folder),
|
| 98 |
+
os.path.join(dataset_dir, folder),
|
| 99 |
+
create_dest=True,
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
# Rebuild the biometry image subset (not mirrored - a strict subset of Images/)
|
| 103 |
+
_link_landmark_subset(dataset_dir, "Images", "Images-landmark")
|
| 104 |
+
|
| 105 |
+
# ====================================
|
| 106 |
+
|
| 107 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 108 |
+
os.chdir(dataset_dir)
|
| 109 |
+
shutil.rmtree(tmp_dir)
|
| 110 |
+
os.chdir(current_dir)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 114 |
+
# Create dataset directory
|
| 115 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 116 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 117 |
+
|
| 118 |
+
# Change to dataset directory
|
| 119 |
+
os.chdir(dataset_dir)
|
| 120 |
+
|
| 121 |
+
# Download and extract dataset
|
| 122 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
if __name__ == "__main__":
|
| 126 |
+
# Set up argument parser
|
| 127 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 128 |
+
parser.add_argument(
|
| 129 |
+
"-d",
|
| 130 |
+
"--dir_datasets_data",
|
| 131 |
+
help="Directory path where datasets will be stored",
|
| 132 |
+
required=True,
|
| 133 |
+
)
|
| 134 |
+
parser.add_argument(
|
| 135 |
+
"-n",
|
| 136 |
+
"--dataset_name",
|
| 137 |
+
help="Name of the dataset",
|
| 138 |
+
required=True,
|
| 139 |
+
)
|
| 140 |
+
parser.add_argument(
|
| 141 |
+
"--max_workers",
|
| 142 |
+
type=int,
|
| 143 |
+
default=1,
|
| 144 |
+
help="Maximum number of workers for download",
|
| 145 |
+
)
|
| 146 |
+
args = parser.parse_args()
|
| 147 |
+
|
| 148 |
+
# Extract known arguments and pass the rest as kwargs
|
| 149 |
+
kwargs = {"max_workers": args.max_workers}
|
| 150 |
+
|
| 151 |
+
main(
|
| 152 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 153 |
+
dataset_name=args.dataset_name,
|
| 154 |
+
**kwargs,
|
| 155 |
+
)
|
|
@@ -0,0 +1,361 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import glob
|
| 4 |
+
import gzip
|
| 5 |
+
import json
|
| 6 |
+
import argparse
|
| 7 |
+
import zipfile
|
| 8 |
+
import numpy as np
|
| 9 |
+
import nibabel as nib
|
| 10 |
+
import nrrd
|
| 11 |
+
from medvision_ds.utils.preprocess_utils import move_folder
|
| 12 |
+
from medvision_ds.utils.download_utils import download_url
|
| 13 |
+
from medvision_ds.utils.landmark_viz import render_landmarks_batch
|
| 14 |
+
from medvision_ds.utils.data_conversion import (
|
| 15 |
+
convert_nrrd_to_nifti,
|
| 16 |
+
copy_img_header_to_mask,
|
| 17 |
+
convert_mask_to_uint16_per_dir,
|
| 18 |
+
reorient_niigz_RASplus_batch_inplace,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# ====================================
|
| 23 |
+
# Dataset Info [!]
|
| 24 |
+
# ====================================
|
| 25 |
+
# Dataset: PDDCA (Public Domain Database for Computational Anatomy)
|
| 26 |
+
# Website: http://www.imagenglab.com/newsite/pddca/
|
| 27 |
+
# Data: https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part{1,2,3}.zip
|
| 28 |
+
# Source: TCIA Head-Neck Cetuximab collection
|
| 29 |
+
# Format: NRRD (image + per-structure masks), .fcsv (3D Slicer landmarks)
|
| 30 |
+
# ====================================
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# Download URLs (anonymous HTTPS)
|
| 34 |
+
DOWNLOAD_URLS = [
|
| 35 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part1.zip",
|
| 36 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part2.zip",
|
| 37 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part3.zip",
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
# Structure NRRD name (in <case>/structures/) -> integer label value in the mask.
|
| 41 |
+
# Matches labels_map in preprocess_segmentation.py / preprocess_detection.py.
|
| 42 |
+
STRUCT_TO_LABEL = {
|
| 43 |
+
"Mandible": 1,
|
| 44 |
+
"BrainStem": 2,
|
| 45 |
+
"Parotid_L": 3,
|
| 46 |
+
"Parotid_R": 4,
|
| 47 |
+
"Submandibular_L": 5,
|
| 48 |
+
"Submandibular_R": 6,
|
| 49 |
+
"OpticNerve_L": 7,
|
| 50 |
+
"OpticNerve_R": 8,
|
| 51 |
+
"Chiasm": 9,
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
# .fcsv point label -> landmark id (P1..P5). Matches landmarks_map in preprocess_biometry.py.
|
| 55 |
+
LANDMARK_NAME_TO_PID = {
|
| 56 |
+
"chin": "P1",
|
| 57 |
+
"mand_r": "P2",
|
| 58 |
+
"mand_l": "P3",
|
| 59 |
+
"odont_proc": "P4",
|
| 60 |
+
"occ_bone": "P5",
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def _fix_lps_affine_to_ras(nii_dir):
|
| 65 |
+
"""Rewrite the affine of every .nii.gz in nii_dir from LPS to RAS world space.
|
| 66 |
+
|
| 67 |
+
The PDDCA NRRDs declare `space: left-posterior-superior`, but
|
| 68 |
+
convert_nrrd_to_nifti copies the NRRD direction matrix / origin verbatim
|
| 69 |
+
into the NIfTI affine, which NIfTI defines as RAS. The result is an
|
| 70 |
+
LPS mapping mislabelled as RAS: left/right and anterior/posterior are
|
| 71 |
+
mirrored, and reorient_niigz_RASplus_batch_inplace sees a positive-diagonal
|
| 72 |
+
affine and does nothing. Left-multiplying by diag(-1, -1, 1) makes the
|
| 73 |
+
affine describe the true RAS world position; the voxel array is untouched
|
| 74 |
+
(the later RAS+ reorientation then flips the data for real).
|
| 75 |
+
"""
|
| 76 |
+
lps_to_ras = np.diag([-1.0, -1.0, 1.0, 1.0])
|
| 77 |
+
for nii_file in sorted(glob.glob(os.path.join(nii_dir, "*.nii.gz"))):
|
| 78 |
+
nii = nib.load(nii_file)
|
| 79 |
+
data = np.asanyarray(nii.dataobj)
|
| 80 |
+
fixed = nib.Nifti1Image(data, lps_to_ras @ nii.affine)
|
| 81 |
+
fixed.header.set_zooms(nii.header.get_zooms())
|
| 82 |
+
nib.save(fixed, nii_file)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def _build_multilabel_mask(case_dir, ref_img_path, out_mask_path):
|
| 86 |
+
"""Build ONE multi-label mask on the image grid from per-structure NRRD files.
|
| 87 |
+
|
| 88 |
+
Assigns each available structure its integer label from STRUCT_TO_LABEL.
|
| 89 |
+
Missing structures are simply skipped (availability varies per case).
|
| 90 |
+
"""
|
| 91 |
+
img_nii = nib.load(ref_img_path)
|
| 92 |
+
ref_shape = img_nii.shape
|
| 93 |
+
mask = np.zeros(ref_shape, dtype=np.uint16)
|
| 94 |
+
|
| 95 |
+
structures_dir = os.path.join(case_dir, "structures")
|
| 96 |
+
for struct_name, label_val in STRUCT_TO_LABEL.items():
|
| 97 |
+
struct_path = os.path.join(structures_dir, f"{struct_name}.nrrd")
|
| 98 |
+
if not os.path.exists(struct_path):
|
| 99 |
+
continue
|
| 100 |
+
data, _ = nrrd.read(struct_path)
|
| 101 |
+
if data.shape != ref_shape:
|
| 102 |
+
raise ValueError(
|
| 103 |
+
f"Structure {struct_name} shape {data.shape} != image shape "
|
| 104 |
+
f"{ref_shape} for case {os.path.basename(case_dir)}"
|
| 105 |
+
)
|
| 106 |
+
mask[data > 0] = label_val
|
| 107 |
+
|
| 108 |
+
nib.save(nib.Nifti1Image(mask, img_nii.affine), out_mask_path)
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def _parse_fcsv(fcsv_path):
|
| 112 |
+
"""Parse a 3D Slicer .fcsv Markups file (CoordinateSystem = 0 == RAS world-mm).
|
| 113 |
+
|
| 114 |
+
Returns {landmark_name: (x, y, z)} for the 5 expected points.
|
| 115 |
+
Columns: id,x,y,z,...,label -> x,y,z are fields 1..3, label is field 11.
|
| 116 |
+
"""
|
| 117 |
+
points = {}
|
| 118 |
+
with open(fcsv_path, "r") as f:
|
| 119 |
+
for line in f:
|
| 120 |
+
line = line.strip()
|
| 121 |
+
if not line or line.startswith("#"):
|
| 122 |
+
continue
|
| 123 |
+
parts = line.split(",")
|
| 124 |
+
if len(parts) < 12:
|
| 125 |
+
continue
|
| 126 |
+
name = parts[11].strip()
|
| 127 |
+
if name in LANDMARK_NAME_TO_PID:
|
| 128 |
+
x, y, z = float(parts[1]), float(parts[2]), float(parts[3])
|
| 129 |
+
points[name] = (x, y, z)
|
| 130 |
+
return points
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def _write_landmark_json(fcsv_path, ras_img_path, out_json_path):
|
| 134 |
+
"""Convert RAS world-mm .fcsv points to 0-based voxel indices in the
|
| 135 |
+
already-RAS+ image and write a gzipped landmark JSON.
|
| 136 |
+
|
| 137 |
+
All 5 points are placed in both the sagittal (slice_landmarks_x) and axial
|
| 138 |
+
(slice_landmarks_z) lists so every biometric measurement (regardless of its
|
| 139 |
+
slice_dim) can locate the points it needs in a single slice entry.
|
| 140 |
+
"""
|
| 141 |
+
world_points = _parse_fcsv(fcsv_path)
|
| 142 |
+
if set(world_points.keys()) != set(LANDMARK_NAME_TO_PID.keys()):
|
| 143 |
+
raise ValueError(
|
| 144 |
+
f"Expected landmarks {sorted(LANDMARK_NAME_TO_PID)} in {fcsv_path}, "
|
| 145 |
+
f"found {sorted(world_points)}"
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
affine = nib.load(ras_img_path).affine
|
| 149 |
+
inv_affine = np.linalg.inv(affine)
|
| 150 |
+
|
| 151 |
+
landmarks = {}
|
| 152 |
+
for name, (x, y, z) in world_points.items():
|
| 153 |
+
pid = LANDMARK_NAME_TO_PID[name]
|
| 154 |
+
idx = np.rint(inv_affine @ np.array([x, y, z, 1.0]))[:3].astype(int)
|
| 155 |
+
landmarks[pid] = [int(idx[0]), int(idx[1]), int(idx[2])]
|
| 156 |
+
|
| 157 |
+
# slice_idx values are informational only (the planner recomputes the true
|
| 158 |
+
# slice index from the point coordinates); use a representative point.
|
| 159 |
+
json_dict = {
|
| 160 |
+
"slice_landmarks_x": [
|
| 161 |
+
{"slice_idx": landmarks["P1"][0], "landmarks": landmarks},
|
| 162 |
+
],
|
| 163 |
+
"slice_landmarks_y": [],
|
| 164 |
+
"slice_landmarks_z": [
|
| 165 |
+
{"slice_idx": landmarks["P2"][2], "landmarks": landmarks},
|
| 166 |
+
],
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
with gzip.open(out_json_path, "wt") as f:
|
| 170 |
+
json.dump(json_dict, f, indent=4)
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def download_and_extract(dataset_dir, dataset_name, **kwargs):
|
| 174 |
+
"""
|
| 175 |
+
Download and extract the PDDCA dataset.
|
| 176 |
+
|
| 177 |
+
NOTE: Function signature: the first 2 arguments must be dataset_dir and dataset_name
|
| 178 |
+
the other arguments must be kwargs
|
| 179 |
+
"""
|
| 180 |
+
max_workers = kwargs.get("max_workers", 1)
|
| 181 |
+
|
| 182 |
+
# Download files
|
| 183 |
+
current_dir = os.getcwd()
|
| 184 |
+
os.chdir(dataset_dir)
|
| 185 |
+
tmp_dir = os.path.join(dataset_dir, "tmp")
|
| 186 |
+
os.makedirs(tmp_dir, exist_ok=True)
|
| 187 |
+
os.chdir(tmp_dir)
|
| 188 |
+
print(f"Downloading {dataset_name} dataset to {dataset_dir}...")
|
| 189 |
+
|
| 190 |
+
# ====================================
|
| 191 |
+
# Add download logic here [!]
|
| 192 |
+
# ====================================
|
| 193 |
+
# Download and extract the 3 zip parts
|
| 194 |
+
for url in DOWNLOAD_URLS:
|
| 195 |
+
out_file = os.path.basename(url)
|
| 196 |
+
print(f"Downloading {url}...")
|
| 197 |
+
download_url(url, out_file)
|
| 198 |
+
print(f"Extracting {out_file}...")
|
| 199 |
+
with zipfile.ZipFile(out_file, "r") as zip_ref:
|
| 200 |
+
zip_ref.extractall(tmp_dir)
|
| 201 |
+
|
| 202 |
+
# Staging / output directories
|
| 203 |
+
img_nrrd_dir = os.path.join(tmp_dir, "img_nrrd")
|
| 204 |
+
os.makedirs(img_nrrd_dir, exist_ok=True)
|
| 205 |
+
os.makedirs("Masks", exist_ok=True)
|
| 206 |
+
os.makedirs("Images-landmark", exist_ok=True)
|
| 207 |
+
os.makedirs("Landmarks", exist_ok=True)
|
| 208 |
+
|
| 209 |
+
# Locate all case folders (each contains img.nrrd)
|
| 210 |
+
case_img_paths = sorted(
|
| 211 |
+
glob.glob(os.path.join(tmp_dir, "**", "img.nrrd"), recursive=True)
|
| 212 |
+
)
|
| 213 |
+
print(f"Found {len(case_img_paths)} cases")
|
| 214 |
+
|
| 215 |
+
# Stage image NRRDs as <cid>.nrrd so convert_nrrd_to_nifti names outputs by case ID
|
| 216 |
+
case_dirs = {}
|
| 217 |
+
for img_path in case_img_paths:
|
| 218 |
+
case_dir = os.path.dirname(img_path)
|
| 219 |
+
cid = os.path.basename(case_dir)
|
| 220 |
+
case_dirs[cid] = case_dir
|
| 221 |
+
shutil.copy(img_path, os.path.join(img_nrrd_dir, f"{cid}.nrrd"))
|
| 222 |
+
|
| 223 |
+
# Convert staged image NRRDs -> Images/<cid>.nii.gz
|
| 224 |
+
convert_nrrd_to_nifti(img_nrrd_dir, "Images")
|
| 225 |
+
|
| 226 |
+
# The NRRDs are LPS; make the NIfTI affines describe true RAS world space
|
| 227 |
+
# before anything (masks, reorientation, landmarks) is derived from them.
|
| 228 |
+
_fix_lps_affine_to_ras("Images")
|
| 229 |
+
|
| 230 |
+
# Build one multi-label mask per case on the image grid
|
| 231 |
+
for cid, case_dir in case_dirs.items():
|
| 232 |
+
ref_img_path = os.path.join("Images", f"{cid}.nii.gz")
|
| 233 |
+
out_mask_path = os.path.join("Masks", f"{cid}.nii.gz")
|
| 234 |
+
_build_multilabel_mask(case_dir, ref_img_path, out_mask_path)
|
| 235 |
+
|
| 236 |
+
# Fix mask geometry then dtype (order matters: header-copy returns float64)
|
| 237 |
+
img_files = list(glob.glob(os.path.join("Images", "*.nii.gz")))
|
| 238 |
+
copy_img_header_to_mask(img_files, "Masks", max_workers)
|
| 239 |
+
convert_mask_to_uint16_per_dir("Masks", max_workers)
|
| 240 |
+
|
| 241 |
+
# Collect the cases that carry a landmark .fcsv and copy their images into
|
| 242 |
+
# Images-landmark/ so only those cases enter the biometry task
|
| 243 |
+
landmark_cases = {}
|
| 244 |
+
for cid, case_dir in case_dirs.items():
|
| 245 |
+
fcsv_files = glob.glob(os.path.join(case_dir, "*.fcsv"))
|
| 246 |
+
if not fcsv_files:
|
| 247 |
+
continue
|
| 248 |
+
landmark_cases[cid] = fcsv_files[0]
|
| 249 |
+
shutil.copy(
|
| 250 |
+
os.path.join("Images", f"{cid}.nii.gz"),
|
| 251 |
+
os.path.join("Images-landmark", f"{cid}.nii.gz"),
|
| 252 |
+
)
|
| 253 |
+
print(f"Found {len(landmark_cases)} cases with landmarks")
|
| 254 |
+
|
| 255 |
+
# Reorient everything to RAS+ IN PLACE (Images, Masks, Images-landmark).
|
| 256 |
+
# Landmark voxel indices MUST be computed in this already-RAS+ space, so this
|
| 257 |
+
# reorientation happens BEFORE landmark JSON generation.
|
| 258 |
+
reorient_niigz_RASplus_batch_inplace(tmp_dir, max_workers)
|
| 259 |
+
|
| 260 |
+
# Generate landmark JSON files from RAS world-mm .fcsv against RAS+ images.
|
| 261 |
+
# Isolate per case: a single case with a nonstandard .fcsv (missing/extra
|
| 262 |
+
# points, or an unexpected column layout) must NOT abort the whole run after
|
| 263 |
+
# the full multi-GB download + conversion. Log + skip it, and drop its now
|
| 264 |
+
# orphaned Images-landmark copy so Images-landmark/ and Landmarks/ stay 1:1.
|
| 265 |
+
landmark_failures = []
|
| 266 |
+
for cid, fcsv_path in landmark_cases.items():
|
| 267 |
+
ras_img_path = os.path.join("Images-landmark", f"{cid}.nii.gz")
|
| 268 |
+
out_json_path = os.path.join("Landmarks", f"{cid}.json.gz")
|
| 269 |
+
try:
|
| 270 |
+
_write_landmark_json(fcsv_path, ras_img_path, out_json_path)
|
| 271 |
+
except Exception as e:
|
| 272 |
+
print(f"⚠️ Skipping landmarks for case {cid}: {type(e).__name__}: {e}")
|
| 273 |
+
landmark_failures.append(cid)
|
| 274 |
+
if os.path.exists(out_json_path):
|
| 275 |
+
os.remove(out_json_path)
|
| 276 |
+
if os.path.exists(ras_img_path):
|
| 277 |
+
os.remove(ras_img_path)
|
| 278 |
+
if landmark_failures:
|
| 279 |
+
print(
|
| 280 |
+
f"⚠️ {len(landmark_failures)}/{len(landmark_cases)} landmark case(s) "
|
| 281 |
+
f"skipped: {landmark_failures}"
|
| 282 |
+
)
|
| 283 |
+
|
| 284 |
+
# Landmark-overlay figures from the landmark-subset images (paired with Landmarks/):
|
| 285 |
+
# Landmarks-fig/ -> one figure per plane per landmark-bearing slice,
|
| 286 |
+
# each point drawn on its own exact slice
|
| 287 |
+
# Landmarks-fig-w-projection/ -> 3 overview figures per case, all 5 points
|
| 288 |
+
# projected onto the slice through P1 (chin)
|
| 289 |
+
print("Rendering landmark figures...")
|
| 290 |
+
render_landmarks_batch(
|
| 291 |
+
"Images-landmark", "Landmarks", "Landmarks-fig",
|
| 292 |
+
fig_dir_projection="Landmarks-fig-w-projection",
|
| 293 |
+
image_modality="CT", norm_label="mandible", dataset_name="PDDCA",
|
| 294 |
+
max_workers=max_workers,
|
| 295 |
+
)
|
| 296 |
+
|
| 297 |
+
# Move folders to dataset_dir
|
| 298 |
+
folders_to_move = [
|
| 299 |
+
"Images",
|
| 300 |
+
"Masks",
|
| 301 |
+
"Images-landmark",
|
| 302 |
+
"Landmarks",
|
| 303 |
+
"Landmarks-fig",
|
| 304 |
+
"Landmarks-fig-w-projection",
|
| 305 |
+
]
|
| 306 |
+
for folder in folders_to_move:
|
| 307 |
+
move_folder(
|
| 308 |
+
os.path.join(tmp_dir, folder),
|
| 309 |
+
os.path.join(dataset_dir, folder),
|
| 310 |
+
create_dest=True,
|
| 311 |
+
)
|
| 312 |
+
# ====================================
|
| 313 |
+
|
| 314 |
+
print(f"Download and extraction completed for {dataset_name}")
|
| 315 |
+
os.chdir(dataset_dir)
|
| 316 |
+
shutil.rmtree(tmp_dir)
|
| 317 |
+
os.chdir(current_dir)
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
def main(dir_datasets_data, dataset_name, **kwargs):
|
| 321 |
+
# Create dataset directory
|
| 322 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 323 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 324 |
+
|
| 325 |
+
# Change to dataset directory
|
| 326 |
+
os.chdir(dataset_dir)
|
| 327 |
+
|
| 328 |
+
# Download and extract dataset
|
| 329 |
+
download_and_extract(dataset_dir, dataset_name, **kwargs)
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
if __name__ == "__main__":
|
| 333 |
+
# Set up argument parser
|
| 334 |
+
parser = argparse.ArgumentParser(description="Download and extract dataset")
|
| 335 |
+
parser.add_argument(
|
| 336 |
+
"-d",
|
| 337 |
+
"--dir_datasets_data",
|
| 338 |
+
help="Directory path where datasets will be stored",
|
| 339 |
+
required=True,
|
| 340 |
+
)
|
| 341 |
+
parser.add_argument(
|
| 342 |
+
"-n",
|
| 343 |
+
"--dataset_name",
|
| 344 |
+
help="Name of the dataset",
|
| 345 |
+
required=True,
|
| 346 |
+
)
|
| 347 |
+
parser.add_argument(
|
| 348 |
+
"--max_workers",
|
| 349 |
+
type=int,
|
| 350 |
+
default=1,
|
| 351 |
+
help="Maximum number of workers for processing",
|
| 352 |
+
)
|
| 353 |
+
args = parser.parse_args()
|
| 354 |
+
|
| 355 |
+
kwargs = {"max_workers": args.max_workers}
|
| 356 |
+
|
| 357 |
+
main(
|
| 358 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 359 |
+
dataset_name=args.dataset_name,
|
| 360 |
+
**kwargs,
|
| 361 |
+
)
|
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerBiometry
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# Do not change the dictionray names
|
| 12 |
+
# - dataset_info, landmarks_map, lines_map, angles_map, biometrics_map
|
| 13 |
+
# ====================================
|
| 14 |
+
dataset_info = {
|
| 15 |
+
"dataset": "PDDCA",
|
| 16 |
+
"dataset_website": "http://www.imagenglab.com/newsite/pddca/",
|
| 17 |
+
"dataset_data": [
|
| 18 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part1.zip",
|
| 19 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part2.zip",
|
| 20 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part3.zip",
|
| 21 |
+
],
|
| 22 |
+
"license": ["N/A (public domain)", "CC BY 3.0"],
|
| 23 |
+
"paper": ["https://doi.org/10.1002/mp.12197"],
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
landmarks_map = {
|
| 27 |
+
"P1": "chin (most anterior-inferior point of the mandibular symphysis)",
|
| 28 |
+
"P2": "right mandibular condyle",
|
| 29 |
+
"P3": "left mandibular condyle",
|
| 30 |
+
"P4": "odontoid process (dens) of the axis (C2)",
|
| 31 |
+
"P5": "occipital bone (basion/occiput)",
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
lines_map = {
|
| 35 |
+
"L-2-3": {
|
| 36 |
+
"name": "bicondylar width",
|
| 37 |
+
"element_keys": ["P2", "P3"],
|
| 38 |
+
"element_map_name": "landmarks_map",
|
| 39 |
+
},
|
| 40 |
+
"L-1-5": {
|
| 41 |
+
"name": "symphysis-occiput distance",
|
| 42 |
+
"element_keys": ["P1", "P5"],
|
| 43 |
+
"element_map_name": "landmarks_map",
|
| 44 |
+
},
|
| 45 |
+
"L-1-4": {
|
| 46 |
+
"name": "chin-dens distance",
|
| 47 |
+
"element_keys": ["P1", "P4"],
|
| 48 |
+
"element_map_name": "landmarks_map",
|
| 49 |
+
},
|
| 50 |
+
"L-4-5": {
|
| 51 |
+
"name": "dens-occiput distance",
|
| 52 |
+
"element_keys": ["P4", "P5"],
|
| 53 |
+
"element_map_name": "landmarks_map",
|
| 54 |
+
},
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
angles_map = {}
|
| 58 |
+
|
| 59 |
+
biometrics_map = [
|
| 60 |
+
{
|
| 61 |
+
"metric_type": "distance",
|
| 62 |
+
"metric_map_name": "lines_map",
|
| 63 |
+
"metric_key": "L-2-3",
|
| 64 |
+
"slice_dim": 2,
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"metric_type": "distance",
|
| 68 |
+
"metric_map_name": "lines_map",
|
| 69 |
+
"metric_key": "L-1-5",
|
| 70 |
+
"slice_dim": 0,
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"metric_type": "distance",
|
| 74 |
+
"metric_map_name": "lines_map",
|
| 75 |
+
"metric_key": "L-1-4",
|
| 76 |
+
"slice_dim": 0,
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"metric_type": "distance",
|
| 80 |
+
"metric_map_name": "lines_map",
|
| 81 |
+
"metric_key": "L-4-5",
|
| 82 |
+
"slice_dim": 0,
|
| 83 |
+
},
|
| 84 |
+
]
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
# ------------
|
| 88 |
+
# Task-specific benchmark planning configuration
|
| 89 |
+
# ------------
|
| 90 |
+
# - dataset_info: Dictionary containing dataset metadata
|
| 91 |
+
# - tasks: List of task configurations where each task contains:
|
| 92 |
+
# - image_modality: Type of medical imaging (e.g., "CT", "MRI")
|
| 93 |
+
# - image_description: Description of image, used in text prompts
|
| 94 |
+
# - image_folder: Directory for .nii.gz image files
|
| 95 |
+
# - landmark_folder: Directory for landmark files
|
| 96 |
+
# - image_prefix: Filename part before case ID for images
|
| 97 |
+
# - image_suffix: Filename part after case ID for images
|
| 98 |
+
# - landmark_prefix: Filename part before case ID for landmarks
|
| 99 |
+
# - landmark_suffix: Filename part after case ID for landmarks
|
| 100 |
+
# - landmarks_map: Dictionary mapping landmarks to their descriptions
|
| 101 |
+
# NOTE:
|
| 102 |
+
# - These keys should match the variable names:
|
| 103 |
+
# "landmarks_map": landmarks_map,
|
| 104 |
+
# "lines_map": lines_map,
|
| 105 |
+
# "angles_map": angles_map,
|
| 106 |
+
# "biometrics_map": biometrics_map,
|
| 107 |
+
# ------------
|
| 108 |
+
benchmark_plan = {
|
| 109 |
+
"dataset_info": dataset_info,
|
| 110 |
+
"tasks": [
|
| 111 |
+
{
|
| 112 |
+
"image_modality": "CT",
|
| 113 |
+
"image_description": "head and neck computed tomography (CT) scan",
|
| 114 |
+
"image_folder": "Images-landmark",
|
| 115 |
+
"landmark_folder": "Landmarks",
|
| 116 |
+
"image_prefix": "",
|
| 117 |
+
"image_suffix": ".nii.gz",
|
| 118 |
+
"landmark_prefix": "",
|
| 119 |
+
"landmark_suffix": ".json.gz",
|
| 120 |
+
"landmarks_map": landmarks_map,
|
| 121 |
+
"lines_map": lines_map,
|
| 122 |
+
"angles_map": angles_map,
|
| 123 |
+
"biometrics_map": biometrics_map,
|
| 124 |
+
},
|
| 125 |
+
],
|
| 126 |
+
}
|
| 127 |
+
# ====================================
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def main(
|
| 131 |
+
dir_datasets_data,
|
| 132 |
+
dataset_name,
|
| 133 |
+
benchmark_plan=benchmark_plan,
|
| 134 |
+
random_seed=1024,
|
| 135 |
+
split_ratio=0.7,
|
| 136 |
+
):
|
| 137 |
+
# Create dataset directory
|
| 138 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 139 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 140 |
+
|
| 141 |
+
# Change to dataset directory
|
| 142 |
+
os.chdir(dataset_dir)
|
| 143 |
+
|
| 144 |
+
# Process dataset for biometric measurement task
|
| 145 |
+
planner = MedVision_BenchmarkPlannerBiometry(
|
| 146 |
+
dataset_dir=dataset_dir,
|
| 147 |
+
bm_plan=benchmark_plan,
|
| 148 |
+
dataset_name=dataset_name,
|
| 149 |
+
seed=random_seed,
|
| 150 |
+
split_ratio=split_ratio,
|
| 151 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 152 |
+
)
|
| 153 |
+
planner.process()
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
if __name__ == "__main__":
|
| 157 |
+
# Set up argument parser
|
| 158 |
+
parser = argparse.ArgumentParser(
|
| 159 |
+
description="Generate benchmark planner for biometric measurement task."
|
| 160 |
+
)
|
| 161 |
+
parser.add_argument(
|
| 162 |
+
"-d",
|
| 163 |
+
"--dir_datasets_data",
|
| 164 |
+
type=str,
|
| 165 |
+
help="Directory path where datasets will be stored",
|
| 166 |
+
required=True,
|
| 167 |
+
)
|
| 168 |
+
parser.add_argument(
|
| 169 |
+
"-n",
|
| 170 |
+
"--dataset_name",
|
| 171 |
+
type=str,
|
| 172 |
+
help="Name of the dataset",
|
| 173 |
+
required=True,
|
| 174 |
+
)
|
| 175 |
+
parser.add_argument(
|
| 176 |
+
"--random_seed",
|
| 177 |
+
type=int,
|
| 178 |
+
default=1024,
|
| 179 |
+
help="Random seed for reproducibility",
|
| 180 |
+
)
|
| 181 |
+
parser.add_argument(
|
| 182 |
+
"--split_ratio",
|
| 183 |
+
type=float,
|
| 184 |
+
default=0.7,
|
| 185 |
+
help="Train/test split ratio (0-1)",
|
| 186 |
+
)
|
| 187 |
+
args = parser.parse_args()
|
| 188 |
+
|
| 189 |
+
main(
|
| 190 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 191 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 192 |
+
dataset_name=args.dataset_name,
|
| 193 |
+
random_seed=args.random_seed,
|
| 194 |
+
split_ratio=args.split_ratio,
|
| 195 |
+
)
|
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import argparse
|
| 3 |
+
from medvision_ds.utils.preprocess_utils import _get_cgroup_limited_cpus
|
| 4 |
+
from medvision_ds.utils.benchmark_planner import MedVision_BenchmarkPlannerDetection
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# ====================================
|
| 8 |
+
# Dataset Info [!]
|
| 9 |
+
# Do not change keys in
|
| 10 |
+
# - benchmark_plan
|
| 11 |
+
# - labels_map
|
| 12 |
+
# ====================================
|
| 13 |
+
dataset_info = {
|
| 14 |
+
"dataset": "PDDCA",
|
| 15 |
+
"dataset_website": "http://www.imagenglab.com/newsite/pddca/",
|
| 16 |
+
"dataset_data": [
|
| 17 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part1.zip",
|
| 18 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part2.zip",
|
| 19 |
+
"https://www.imagenglab.com/data/pddca/PDDCA-1.4.1_part3.zip",
|
| 20 |
+
],
|
| 21 |
+
"license": ["N/A (public domain)", "CC BY 3.0"],
|
| 22 |
+
"paper": ["https://doi.org/10.1002/mp.12197"],
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
labels_map = {
|
| 26 |
+
"1": "mandible",
|
| 27 |
+
"2": "brainstem",
|
| 28 |
+
"3": "left parotid gland",
|
| 29 |
+
"4": "right parotid gland",
|
| 30 |
+
"5": "left submandibular gland",
|
| 31 |
+
"6": "right submandibular gland",
|
| 32 |
+
"7": "left optic nerve",
|
| 33 |
+
"8": "right optic nerve",
|
| 34 |
+
"9": "optic chiasm",
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
benchmark_plan = {
|
| 38 |
+
"dataset_info": dataset_info,
|
| 39 |
+
"tasks": [
|
| 40 |
+
{
|
| 41 |
+
"image_modality": "CT",
|
| 42 |
+
"image_description": "head and neck computed tomography (CT) scan",
|
| 43 |
+
"image_folder": "Images",
|
| 44 |
+
"mask_folder": "Masks",
|
| 45 |
+
"image_prefix": "",
|
| 46 |
+
"image_suffix": ".nii.gz",
|
| 47 |
+
"mask_prefix": "",
|
| 48 |
+
"mask_suffix": ".nii.gz",
|
| 49 |
+
"labels_map": labels_map,
|
| 50 |
+
},
|
| 51 |
+
],
|
| 52 |
+
}
|
| 53 |
+
# ====================================
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def main(
|
| 57 |
+
dir_datasets_data,
|
| 58 |
+
dataset_name,
|
| 59 |
+
benchmark_plan=benchmark_plan,
|
| 60 |
+
random_seed=1024,
|
| 61 |
+
split_ratio=0.7,
|
| 62 |
+
force_uint16_mask=False,
|
| 63 |
+
reorient2RAS=False,
|
| 64 |
+
):
|
| 65 |
+
# Create dataset directory
|
| 66 |
+
dataset_dir = os.path.join(dir_datasets_data, dataset_name)
|
| 67 |
+
os.makedirs(dataset_dir, exist_ok=True)
|
| 68 |
+
|
| 69 |
+
# Change to dataset directory
|
| 70 |
+
os.chdir(dataset_dir)
|
| 71 |
+
|
| 72 |
+
# Process dataset for detection task
|
| 73 |
+
planner = MedVision_BenchmarkPlannerDetection(
|
| 74 |
+
dataset_dir=dataset_dir,
|
| 75 |
+
bm_plan=benchmark_plan,
|
| 76 |
+
dataset_name=dataset_name,
|
| 77 |
+
seed=random_seed,
|
| 78 |
+
split_ratio=split_ratio,
|
| 79 |
+
force_uint16_mask=force_uint16_mask,
|
| 80 |
+
reorient2RAS=reorient2RAS,
|
| 81 |
+
num_proc=_get_cgroup_limited_cpus(),
|
| 82 |
+
)
|
| 83 |
+
planner.process()
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
if __name__ == "__main__":
|
| 87 |
+
# Set up argument parser
|
| 88 |
+
parser = argparse.ArgumentParser(
|
| 89 |
+
description="Generate benchmark planner for detection task."
|
| 90 |
+
)
|
| 91 |
+
parser.add_argument(
|
| 92 |
+
"-d",
|
| 93 |
+
"--dir_datasets_data",
|
| 94 |
+
type=str,
|
| 95 |
+
help="Directory path where datasets will be stored",
|
| 96 |
+
required=True,
|
| 97 |
+
)
|
| 98 |
+
parser.add_argument(
|
| 99 |
+
"-n",
|
| 100 |
+
"--dataset_name",
|
| 101 |
+
type=str,
|
| 102 |
+
help="Name of the dataset",
|
| 103 |
+
required=True,
|
| 104 |
+
)
|
| 105 |
+
parser.add_argument(
|
| 106 |
+
"--random_seed",
|
| 107 |
+
type=int,
|
| 108 |
+
default=1024,
|
| 109 |
+
help="Random seed for reproducibility",
|
| 110 |
+
)
|
| 111 |
+
parser.add_argument(
|
| 112 |
+
"--split_ratio",
|
| 113 |
+
type=float,
|
| 114 |
+
default=0.7,
|
| 115 |
+
help="Train/test split ratio (0-1)",
|
| 116 |
+
)
|
| 117 |
+
parser.add_argument(
|
| 118 |
+
"--force_uint16_mask",
|
| 119 |
+
action="store_true",
|
| 120 |
+
help="Force mask to be uint16",
|
| 121 |
+
)
|
| 122 |
+
parser.add_argument(
|
| 123 |
+
"--reorient2RAS",
|
| 124 |
+
action="store_true",
|
| 125 |
+
help="Reorient images and masks to RAS orientation",
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
args = parser.parse_args()
|
| 129 |
+
|
| 130 |
+
main(
|
| 131 |
+
benchmark_plan=benchmark_plan, # global variable
|
| 132 |
+
dir_datasets_data=args.dir_datasets_data,
|
| 133 |
+
dataset_name=args.dataset_name,
|
| 134 |
+
random_seed=args.random_seed,
|
| 135 |
+
split_ratio=args.split_ratio,
|
| 136 |
+
force_uint16_mask=args.force_uint16_mask,
|
| 137 |
+
reorient2RAS=args.reorient2RAS,
|
| 138 |
+
)
|