Skip to content

Commit

Permalink
add script to set license
Browse files Browse the repository at this point in the history
  • Loading branch information
wasserth committed Aug 24, 2023
1 parent 784d633 commit a26fa89
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ TotalSegmentator -i ct.nii.gz -o segmentations -ta lung_vessels
```
Overview of available subtasks and the classes which they contain.

Openly available:
Openly available for any usage:
* **lung_vessels**: lung_vessels (cite [paper](https://www.sciencedirect.com/science/article/pii/S0720048X22001097)), lung_trachea_bronchia
* **cerebral_bleed**: intracerebral_hemorrhage (cite [paper](https://www.mdpi.com/2077-0383/12/7/2631))
* **hip_implant**: hip_implant
* **coronary_arteries**: coronary_arteries
* **body**: body, body_trunc, body_extremities, skin
* **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))

Available after purchase of a license (free licenses possible for academic projects). Contact [email protected] if you are interested:
* **bones_extremities**: femur, patella, tibia, fibula, tarsal, metatarsal, phalanges_feet, humerus, ulna, radius, carpal, metacarpal, phalanges_hand, sternum, skull, spinal_cord
Available with a license. Free licenses available for non-commercial usage [here](https://backend.totalsegmentator.com/license-academic/). For a commercial license contact [email protected].
* **heartchambers_highres**: myocardium, atrium_left, ventricle_left, atrium_right, ventricle_right, aorta, pulmonary_artery (trained on sub-millimeter resolution)
* **appendicular_bones**: patella, tibia, fibula, tarsal, metatarsal, phalanges_feet, ulna, radius, carpal, metacarpal, phalanges_hand
* **tissue_types**: subcutaneous_fat, skeletal_muscle, torso_fat
* **heartchambers_highres**: myocardium, atrium_left, ventricle_left, atrium_right, ventricle_right, aorta, pulmonary_artery (more precise heart chamber segmentation, trained on sub-millimeter resolution)
* **head**: mandible, teeth, brainstem, subarachnoid_cavity, venous_sinuses, septum_pellucidum, cerebellum, caudate_nucleus, lentiform_nucleus, insular_cortex, internal_capsule, ventricle, central_sulcus, frontal_lobe, parietal_lobe, occipital_lobe, temporal_lobe, thalamus, tyroid (trained on sub-millimeter resolution)
* **aortic_branches**: brachiocephalic_trunc, subclavian_artery_right, subclavian_artery_left, common_carotid_artery_right, common_carotid_artery_left, brachiocephalic_vein_left, brachiocephalic_vein_right, atrial_appendage_left, superior_vena_cava, pulmunary_vein, tyroid
* **face**: face_region



### Run via docker
Expand Down
30 changes: 30 additions & 0 deletions bin/totalseg_set_license
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
import sys
from pathlib import Path
import argparse

from totalsegmentator.config import setup_totalseg, set_license_number


if __name__ == "__main__":
"""
Set your totalsegmentator license number
Usage:
totalseg_set_license -l aca_12345678910
"""
parser = argparse.ArgumentParser(description="Set license.",
epilog="Written by Jakob Wasserthal. If you use this tool please cite https://pubs.rsna.org/doi/10.1148/ryai.230024")

parser.add_argument("-l", "--license_number", type=str, help="TotalSegmentator license number.",
required=True)

args = parser.parse_args()

if not args.license_number.startswith("aca_"):
raise ValueError("license number must start with 'aca_' or 'com_' ")
if len(args.license_number) != 18:
raise ValueError("license number must have exactly 18 characters.")

setup_totalseg() # create config file if not exists
set_license_number(args.license_number)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
scripts=[
'bin/TotalSegmentator', 'bin/totalseg_combine_masks', 'bin/crop_to_body',
'bin/totalseg_import_weights', 'bin/totalseg_download_weights',
'bin/totalseg_setup_manually'
'bin/totalseg_setup_manually', 'bin/totalseg_set_license'
]
)
7 changes: 3 additions & 4 deletions totalsegmentator/python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ def show_license_info():
# textwarp needed to remove the indentation of the multiline string
print(textwrap.dedent("""\
In contrast to the other tasks this task is not openly available.
It requires a license. For academic usage a free license can be
It requires a license. For non-commercial usage a free license can be
acquired here:
https://totalsegmentator-academic.streamlit.app
https://backend.totalsegmentator.com/license-academic/
For commercial usage see:
https://totalsegmentator-commercial.streamlit.app
For commercial usage contact: [email protected]
"""))
sys.exit(1)
elif status == "invalid_license":
Expand Down

0 comments on commit a26fa89

Please sign in to comment.