Datasets:
File size: 14,578 Bytes
dc096c2 8bb3be3 dc096c2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | """Per-dataset build recipes for build_dataset.py.
One entry per dataset in the MedVision catalogue. Everything that can be derived is
derived instead of listed here:
- the annotation version comes from _ANNOTATION_INDEX in MedVision.py (see
build_dataset.py); this file records no version numbers at all;
- whether a preprocess step accepts --reorient2RAS follows from the task kind and,
for biometry, from _BIOMETRY_FAMILY in MedVision.py;
- figure rendering needs no entry: --visualization is on by default in every
biometry script that has it.
Field reference
---------------
pkg directory under src/medvision_ds/datasets/ (underscored)
download module name: "download_raw" (build from source) or "download"
supports_max_workers whether the download module accepts --max_workers
steps preprocess stages, in the order they must run
reorient "download" | "preprocess" -- see the long note below
requires_env environment variables the download WILL fail without
optional_env environment variables that override a working public default
note anything a reader would otherwise have to reconstruct
The dict key is the RUNTIME dataset name passed as -n and used as the directory name
under $MedVision_DATA_DIR/Datasets/. It differs from `pkg` for ten datasets, and there
is no mapping table anywhere in the package -- the authority is the dataset_info
["dataset"] literal at the top of each preprocess_*.py, cross-checked here against
_ANNOTATION_INDEX.
The `reorient` field
--------------------
Ground truth is read in voxel/index space, so every annotation must be computed against
images that are already in RAS+. There are two places that can happen, and which one a
dataset uses is not a style choice.
reorient="download" -- do NOT pass --reorient2RAS to any preprocess step.
These 8 datasets reorient to RAS+ inside their own download_raw.py, via
reorient_niigz_RASplus_batch_inplace(), BEFORE any annotation is computed. The
annotation steps therefore already see RAS+ voxels, and passing the flag again would
be a pure no-op -- _reorient_niigz_RASplus() early-returns on an already-RAS file and,
in the in-place case, writes nothing at all.
It has to live in the downloader rather than the planner because three of them --
AFIDs, PDDCA, VerSe -- derive landmark VOXEL INDICES at download time, and the
landmark-biometry planner has no reorient2RAS parameter at all. Any reorientation
after those indices exist would move the voxels out from under them.
MAMA-MIA and PI-CAI are the two that learned this the hard way: their v1.2.0 shipped
without it, was withdrawn, and was reissued as v1.2.1. See doc/release-v1.2.1.md.
Ordering constraint inside each downloader: reorientation must come AFTER
copy_img_header_to_mask(), which overwrites the mask affine with the image affine.
Reorienting first would leave the mask carrying a pre-flip affine.
reorient="preprocess" -- pass --reorient2RAS to every step that accepts it.
The remaining datasets ship in their source orientation and are reoriented in place by
the planner, on the first annotation step. The flag is passed to every accepting step
rather than only the first: repeat calls cost one header read per file, and it makes
each step independently correct if someone runs just one of them.
Ceph-Biometrics-400 ends up receiving the flag nowhere, and that is correct rather
than special-cased: its only task is landmark biometry, whose planner does not accept
the flag. Its images are 2D X-rays stored as array_size [1, 1935, 2400] with an
identity affine, so they are already RAS in all 400 cases.
"""
DATASETS = {
# ------------------------------------------------------------------ v1.0.0 era
"ACDC": {
"pkg": "ACDC",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"AMOS22": {
"pkg": "AMOS22",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"AbdomenAtlas1.0Mini": {
"pkg": "AbdomenAtlas__1_0__Mini",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"AbdomenCT-1K": {
"pkg": "AbdomenCT_1K",
"download": "download",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"BCV15": {
"pkg": "BCV15",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": ["SYNAPSE_TOKEN"],
"optional_env": [],
},
"BraTS24": {
"pkg": "BraTS24",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "preprocess",
"requires_env": ["SYNAPSE_TOKEN"],
"optional_env": [],
"note": 'dataset_info["dataset"] is the empty string in all three preprocess '
"scripts, so the name comes only from -n.",
},
"CAMUS": {
"pkg": "CAMUS",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"Ceph-Biometrics-400": {
"pkg": "Ceph_Biometrics_400",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["biometry"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
"note": "Landmark biometry only, so --reorient2RAS is never passed (that planner "
"does not accept it). 2D X-ray on an identity affine: already RAS.",
},
"CrossMoDA": {
"pkg": "CrossMoDA",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"FLARE22": {
"pkg": "FLARE22",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"FeTA24": {
"pkg": "FeTA24",
"download": "download",
"supports_max_workers": False,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "preprocess",
"requires_env": ["SYNAPSE_TOKEN"],
"optional_env": [],
"note": "Biometry reads Images-reoriented/, which download.py already produces in "
"RAS+ via im_original_to_realigned(); the planner's recursive reorientation "
"of the dataset directory is a no-op there.",
},
"HNTSMRG24": {
"pkg": "HNTSMRG24",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"ISLES24": {
"pkg": "ISLES24",
"download": "download",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"KiPA22": {
"pkg": "KiPA22",
"download": "download",
"supports_max_workers": False,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": ["BiometricVQA_KiPA22_HF_ID"],
},
"KiTS23": {
"pkg": "KiTS23",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"MSD": {
"pkg": "MSD",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"OAIZIB-CM": {
"pkg": "OAIZIB_CM",
"download": "download",
"supports_max_workers": True,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"SKM-TEA": {
"pkg": "SKM_TEA",
"download": "download",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": ["MedVision_SKMTEA_HF_ID", "HF_TOKEN"],
"note": "Downloads from a HuggingFace mirror; HF_TOKEN is needed only if that "
"mirror is private for you.",
},
"ToothFairy2": {
"pkg": "ToothFairy2",
"download": "download",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": ["MedVision_ToothFairy2_HF_ID", "HF_TOKEN"],
"note": "Same HuggingFace-mirror arrangement as SKM-TEA.",
},
"TopCoW24": {
"pkg": "TopCoW24",
"download": "download",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"TotalSegmentator": {
"pkg": "TotalSegmentator",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
"autoPET-III": {
"pkg": "autoPET_III",
"download": "download_raw",
"supports_max_workers": False,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "preprocess",
"requires_env": [],
"optional_env": [],
},
# ------------------------------------------- added in v1.2.0: reorient in download
"AFIDs": {
"pkg": "AFIDs",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["biometry"],
"reorient": "download",
"requires_env": [],
"optional_env": [],
"note": "Landmark biometry only. The 32 fiducials are converted to voxel indices "
"at download time, which is why the reorientation must precede them.",
},
"DEEP-PSMA": {
"pkg": "DEEP_PSMA",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "download",
"requires_env": [],
"optional_env": [],
"note": "Two tracers in separate image/mask folders so the subject-level split "
"cannot put one patient's PSMA and FDG scans on opposite sides.",
},
"LIDC-IDRI": {
"pkg": "LIDC_IDRI",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "download",
"requires_env": [],
"optional_env": [],
},
"LNQ2023": {
"pkg": "LNQ2023",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "download",
"requires_env": [],
"optional_env": [],
},
"MAMA-MIA": {
"pkg": "MAMA_MIA",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "download",
"requires_env": ["SYNAPSE_TOKEN"],
"optional_env": [],
"note": "Upstream volumes are ('L','A','I') for DUKE and ('P','S','L') for "
"ISPY1/NACT. The v1.2.0 annotations were recorded in those frames and "
"withdrawn; v1.2.1 is the correction.",
},
"PDDCA": {
"pkg": "PDDCA",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "download",
"requires_env": [],
"optional_env": [],
"note": "Only 33 of the 48 cases ship landmarks, so biometry uses its own "
"Images-landmark/ folder while segmentation and detection use all 48.",
},
"PI-CAI": {
"pkg": "PICAI",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "download",
"requires_env": [],
"optional_env": [],
"note": "Source .mha are LPS-derived. Same withdrawal and correction as MAMA-MIA.",
},
"VerSe": {
"pkg": "VerSe",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "download",
"requires_env": [],
"optional_env": [],
"note": "Vertebral centroids are voxel indices in the NATIVE orientation and are "
"mapped through native->world->RAS+ at download time. Only 250 of the 325 "
"scans contain all of L1-L5, so biometry uses Images-lumbar/.",
},
# ------------------------------------------- added in v1.3.0: reorient in download
"MSWAL": {
"pkg": "MSWAL",
"download": "download_raw",
"supports_max_workers": True,
"steps": ["segmentation", "detection", "biometry"],
"reorient": "download",
"requires_env": [],
"optional_env": [],
"note": "Upstream test split (210 cases) was never uploaded to HF; the 484 "
"published imagesTr cases are re-split by the planner (seed 1024, 0.7).",
},
}
|