Skip to content

Commit

Permalink
update coronary_arteries model
Browse files Browse the repository at this point in the history
  • Loading branch information
wasserth committed Jan 16, 2025
1 parent 914faff commit e091ee3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run_tests_nnunet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
run-tests:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest] # fails on windows until https://github.com/MIC-DKFZ/nnUNet/issues/2396 is resolved
# os: [ubuntu-latest, macos-latest]
# os: [ubuntu-latest, windows-latest, macos-latest] # fails on windows until https://github.com/MIC-DKFZ/nnUNet/issues/2396 is resolved
os: [ubuntu-latest, macos-latest]
python-version: ["3.10"]
runs-on: ${{ matrix.os }}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ Openly available for any usage:
* **vertebrae_mr**: sacrum, vertebrae_L5, vertebrae_L4, vertebrae_L3, vertebrae_L2, vertebrae_L1, vertebrae_T12, vertebrae_T11, vertebrae_T10, vertebrae_T9, vertebrae_T8, vertebrae_T7, vertebrae_T6, vertebrae_T5, vertebrae_T4, vertebrae_T3, vertebrae_T2, vertebrae_T1, vertebrae_C7, vertebrae_C6, vertebrae_C5, vertebrae_C4, vertebrae_C3, vertebrae_C2, vertebrae_C1 (for CT this is part of the `total` task)
* **cerebral_bleed**: intracerebral_hemorrhage (cite [paper](https://www.mdpi.com/2077-0383/12/7/2631))*
* **hip_implant**: hip_implant*
* **coronary_arteries**: coronary_arteries*
* **pleural_pericard_effusion**: pleural_effusion (cite [paper](http://dx.doi.org/10.1097/RLI.0000000000000869)), pericardial_effusion (cite [paper](http://dx.doi.org/10.3390/diagnostics12051045))*
* **head_glands_cavities**: eye_left, eye_right, eye_lens_left, eye_lens_right, optic_nerve_left, optic_nerve_right, parotid_gland_left, parotid_gland_right, submandibular_gland_right, submandibular_gland_left, nasopharynx, oropharynx, hypopharynx, nasal_cavity_right, nasal_cavity_left, auditory_canal_right, auditory_canal_left, soft_palate, hard_palate (cite [paper](https://www.mdpi.com/2072-6694/16/2/415))
* **head_muscles**: masseter_right, masseter_left, temporalis_right, temporalis_left, lateral_pterygoid_right, lateral_pterygoid_left, medial_pterygoid_right, medial_pterygoid_left, tongue, digastric_right, digastric_left
* **headneck_bones_vessels**: larynx_air, thyroid_cartilage, hyoid, cricoid_cartilage, zygomatic_arch_right, zygomatic_arch_left, styloid_process_right, styloid_process_left, internal_carotid_artery_right, internal_carotid_artery_left, internal_jugular_vein_right, internal_jugular_vein_left (cite [paper](https://www.mdpi.com/2072-6694/16/2/415))
* **headneck_muscles**: sternocleidomastoid_right, sternocleidomastoid_left, superior_pharyngeal_constrictor, middle_pharyngeal_constrictor, inferior_pharyngeal_constrictor, trapezius_right, trapezius_left, platysma_right, platysma_left, levator_scapulae_right, levator_scapulae_left, anterior_scalene_right, anterior_scalene_left, middle_scalene_right, middle_scalene_left, posterior_scalene_right, posterior_scalene_left, sterno_thyroid_right, sterno_thyroid_left, thyrohyoid_right, thyrohyoid_left, prevertebral_right, prevertebral_left (cite [paper](https://www.mdpi.com/2072-6694/16/2/415))
* **liver_vessels**: liver_vessels, liver_tumor (cite [paper](https://arxiv.org/abs/1902.09063))*
* **oculomotor_muscles**: skull, eyeball_right, lateral_rectus_muscle_right, superior_oblique_muscle_right, levator_palpebrae_superioris_right, superior_rectus_muscle_right, medial_rectus_muscle_left, inferior_oblique_muscle_right, inferior_rectus_muscle_right, optic_nerve_left, eyeball_left, lateral_rectus_muscle_left, superior_oblique_muscle_left, levator_palpebrae_superioris_left, superior_rectus_muscle_left, medial_rectus_muscle_right, inferior_oblique_muscle_left, inferior_rectus_muscle_left, optic_nerve_right*
* **lung_nodules**: lung, lung_nodules (this model is kindly provided by [BLUEMIND AI](https://bluemind.co/))
* **lung_nodules**: lung, lung_nodules (provided by [BLUEMIND AI](https://bluemind.co/): Fitzjalen R., Aladin M., Nanyan G.) (trained on 1353 subjects, partly from LIDC-IDRI)
* **kidney_cysts**: kidney_cyst_left, kidney_cyst_right (strongly improved accuracy compared to kidney_cysts inside of `total` task)
* **breasts**: breast

Expand All @@ -91,6 +90,7 @@ Available with a license (free licenses available for non-commercial usage [here
* **face_mr**: face_region (for anonymization)
* **thigh_shoulder_muscles**: thigh_posterior_compartment_left, thigh_posterior_compartment_right, sartorius_left, sartorius_right, pectoralis_minor, serratus_anterior, teres_major, triceps_brachii (WIP)
* **thigh_shoulder_muscles_mr**: thigh_posterior_compartment_left, thigh_posterior_compartment_right, sartorius_left, sartorius_right, pectoralis_minor, serratus_anterior, teres_major, triceps_brachii (for MR images)
* **coronary_arteries**: coronary_arteries (also works on non-contrast images)

Usage:
```
Expand Down
2 changes: 1 addition & 1 deletion totalsegmentator/bin/totalseg_download_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def main():
"lung_vessels": [258],
"cerebral_bleed": [150],
"hip_implant": [260],
"coronary_arteries": [503],
"coronary_arteries": [507],
"pleural_pericard_effusion": [315],
"body": [299],
"body_fast": [300],
Expand Down
2 changes: 1 addition & 1 deletion totalsegmentator/download_pretrained_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""
Download all pretrained weights
"""
for task_id in [291, 292, 293, 294, 295, 297, 298, 258, 150, 260, 503,
for task_id in [291, 292, 293, 294, 295, 297, 298, 258, 150, 260,
315, 299, 300, 850, 851, 852, 853, 775, 776, 777, 778,
779]:
download_pretrained_weights(task_id)
Expand Down
7 changes: 2 additions & 5 deletions totalsegmentator/libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,6 @@ def download_pretrained_weights(task_id):
# WEIGHTS_URL = "https://zenodo.org/record/7510288/files/Task315_thoraxCT.zip?download=1"
# WEIGHTS_URL = url + "/static/totalseg_v2/Dataset315_thoraxCT.zip"
WEIGHTS_URL = url + "/v2.0.0-weights/Dataset315_thoraxCT.zip"
elif task_id == 503:
weights_path = config_dir / "Dataset503_cardiac_motion"
# WEIGHTS_URL = "https://zenodo.org/record/7271576/files/Task503_cardiac_motion.zip?download=1"
# WEIGHTS_URL = url + "/static/totalseg_v2/Dataset503_cardiac_motion.zip"
WEIGHTS_URL = url + "/v2.0.0-weights/Dataset503_cardiac_motion.zip"
elif task_id == 8:
weights_path = config_dir / "Dataset008_HepaticVessel"
WEIGHTS_URL = url + "/v2.4.0-weights/Dataset008_HepaticVessel.zip"
Expand Down Expand Up @@ -325,6 +320,8 @@ def download_pretrained_weights(task_id):
weights_path = config_dir / "Dataset409_neuro_550subj"
elif task_id == 857:
weights_path = config_dir / "Dataset857_TotalSegMRI_thigh_shoulder_1088subj"
elif task_id == 507:
weights_path = config_dir / "Dataset507_coronary_arteries_cm_nativ_400subj"

else:
raise ValueError(f"For task_id {task_id} no download path was found.")
Expand Down
19 changes: 10 additions & 9 deletions totalsegmentator/python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,6 @@ def totalsegmentator(input: Union[str, Path, Nifti1Image], output: Union[str, Pa
model = "3d_fullres"
folds = [0]
if fast: raise ValueError("task hip_implant does not work with option --fast")
elif task == "coronary_arteries":
task_id = 503
resample = None
trainer = "nnUNetTrainer"
crop = ["heart"]
model = "3d_fullres"
folds = [0]
print("WARNING: The coronary artery model does not work very robustly. Use with care!")
if fast: raise ValueError("task coronary_arteries does not work with option --fast")
elif task == "body":
if fast:
task_id = 300
Expand Down Expand Up @@ -463,6 +454,16 @@ def totalsegmentator(input: Union[str, Path, Nifti1Image], output: Union[str, Pa
folds = [0]
if fast: raise ValueError("task thigh_shoulder_muscles_mr does not work with option --fast")
show_license_info()
elif task == "coronary_arteries":
task_id = 507
resample = [0.7, 0.7, 0.7]
trainer = "nnUNetTrainer_DASegOrd0_NoMirroring"
crop = ["heart"]
crop_addon = [20, 20, 20]
model = "3d_fullres_high"
folds = [0]
if fast: raise ValueError("task coronary_arteries does not work with option --fast")
show_license_info()

elif task == "test":
task_id = [517]
Expand Down

0 comments on commit e091ee3

Please sign in to comment.