| """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 = { |
| |
| "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": [], |
| }, |
| |
| "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/.", |
| }, |
| |
| "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).", |
| }, |
| } |
|
|