Skip to content

Commit

Permalink
require torch <2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wasserth committed Jan 30, 2025
1 parent 6b226fc commit 611b54a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TotalSegmentator works on Ubuntu, Mac, and Windows and on CPU and GPU.

Install dependencies:
* Python >= 3.9
* [Pytorch](http://pytorch.org/) >= 2.0.0 (and <2.4 for windows)
* [Pytorch](http://pytorch.org/) >= 2.0.0 and <2.6.0 (and <2.4 for windows)

Optionally:
* if you use the option `--preview` you have to install xvfb (`apt-get install xvfb`) and fury (`pip install fury`)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"resources/ct_brain_atlas_1mm.nii.gz"]
},
install_requires=[
'torch>=2.1.2',
'torch>=2.1.2,<2.6.0',
'numpy<2',
'SimpleITK',
'nibabel>=2.3.0',
Expand Down
4 changes: 2 additions & 2 deletions totalsegmentator/bin/totalseg_evans_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ def run_models(ct_img, verbose=False):
ventricle_parts = totalsegmentator(ct_img, None, task="ventricle_parts", ml=True, nr_thr_saving=1, quiet=not verbose)
return brain_skull, ventricle_parts


# Required if calling from e.g. streamlit; calling python_api not working there
def run_models_shell(ct_img, verbose=False):
quiet = "--quiet" if not verbose else ""
with tempfile.TemporaryDirectory(prefix="totalseg_tmp_2_") as tmp_folder:
tmp_dir = Path(tmp_folder)
ct_img_path = tmp_dir / "ct.nii.gz" # save to tmp folder
ct_img_path = tmp_dir / "ct.nii.gz"
nib.save(ct_img, ct_img_path)
subprocess.call(f"TotalSegmentator -i {ct_img_path} -o {tmp_dir / 'brain_skull.nii.gz'} --roi_subset brain skull --ml --nr_thr_saving 1 {quiet}", shell=True)
subprocess.call(f"TotalSegmentator -i {ct_img_path} -o {tmp_dir / 'ventricle_parts.nii.gz'} --task ventricle_parts --ml --nr_thr_saving 1 {quiet}", shell=True)
Expand Down

0 comments on commit 611b54a

Please sign in to comment.