diff --git a/requirements-py312.txt b/requirements-py312.txt new file mode 100644 index 0000000..ca6e562 --- /dev/null +++ b/requirements-py312.txt @@ -0,0 +1,74 @@ +aiohttp==3.9.5 +aiosignal==1.3.1 +albumentations==1.4.4 +annotated-types==0.6.0 +asttokens==2.4.1 +attrs==23.2.0 +certifi==2024.2.2 +charset-normalizer==3.3.2 +contourpy==1.2.1 +cycler==0.12.1 +dataclasses==0.6 +decorator==5.1.1 +executing==2.0.1 +filelock==3.13.4 +fonttools==4.51.0 +frozenlist==1.4.1 +fsspec==2024.3.1 +idna==3.7 +imageio==2.34.0 +iniconfig==2.0.0 +ipython==8.23.0 +jedi==0.19.1 +Jinja2==3.1.3 +joblib==1.4.0 +kiwisolver==1.4.5 +lazy_loader==0.4 +lightning-utilities==0.11.2 +MarkupSafe==2.1.5 +matplotlib==3.8.4 +matplotlib-inline==0.1.7 +mpmath==1.3.0 +multidict==6.0.5 +networkx==3.3 +nibabel==5.2.1 +numpy==1.26.4 +opencv-python-headless==4.9.0.80 +packaging==24.0 +pandas==2.2.2 +parso==0.8.4 +pexpect==4.9.0 +pillow==10.3.0 +pluggy==1.4.0 +prompt-toolkit==3.0.43 +ptyprocess==0.7.0 +pure-eval==0.2.2 +pydantic==2.7.0 +pydantic_core==2.18.1 +Pygments==2.17.2 +pyparsing==3.1.2 +pytest==8.1.1 +python-dateutil==2.9.0.post0 +pytorch-lightning==2.2.2 +pytz==2024.1 +PyYAML==6.0.1 +requests==2.31.0 +scikit-image==0.23.1 +scikit-learn==1.4.2 +scipy==1.13.0 +setuptools==69.5.1 +six==1.16.0 +stack-data==0.6.3 +sympy==1.12 +threadpoolctl==3.4.0 +tifffile==2024.4.18 +torch==2.2.2 +torchmetrics==1.3.2 +torchvision==0.17.2 +tqdm==4.66.2 +traitlets==5.14.2 +typing_extensions==4.11.0 +tzdata==2024.1 +urllib3==2.2.1 +wcwidth==0.2.13 +yarl==1.9.4 diff --git a/requirements-py39.txt b/requirements-py39.txt new file mode 100644 index 0000000..d2cd28a --- /dev/null +++ b/requirements-py39.txt @@ -0,0 +1,63 @@ +absl-py==2.1.0 +aiohttp==3.9.5 +aiosignal==1.3.1 +albumentations==0.5.2 +async-timeout==4.0.3 +attrs==23.2.0 +certifi==2024.2.2 +charset-normalizer==3.3.2 +contourpy==1.2.1 +cycler==0.12.1 +dataclasses==0.6 +exceptiongroup==1.2.0 +fonttools==4.51.0 +frozenlist==1.4.1 +fsspec==2024.3.1 +future==1.0.0 +grpcio==1.62.1 +idna==3.7 +imageio==2.34.0 +imgaug==0.4.0 +importlib_metadata==7.1.0 +importlib_resources==6.4.0 +iniconfig==2.0.0 +kiwisolver==1.4.5 +Markdown==3.6 +MarkupSafe==2.1.5 +matplotlib==3.8.4 +multidict==6.0.5 +networkx==3.2.1 +nibabel==3.2.1 +numpy==1.22.4 +opencv-python==4.9.0.80 +opencv-python-headless==4.9.0.80 +packaging==24.0 +pandas==1.2.1 +pillow==10.3.0 +pluggy==1.4.0 +protobuf==5.26.1 +pyparsing==3.1.2 +pytest==8.1.1 +python-dateutil==2.9.0.post0 +pytorch-lightning==1.2.10 +pytz==2024.1 +PyWavelets==1.6.0 +PyYAML==6.0.1 +requests==2.31.0 +scikit-image==0.19.3 +scipy==1.7.0 +shapely==2.0.4 +six==1.16.0 +tensorboard==2.16.2 +tensorboard-data-server==0.7.2 +tifffile==2024.4.18 +tomli==2.0.1 +torch==1.8.1 +torchmetrics==0.2.0 +torchvision==0.9.1 +tqdm==4.66.2 +typing_extensions==4.11.0 +urllib3==2.2.1 +Werkzeug==3.0.2 +yarl==1.9.4 +zipp==3.18.1 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e335c0b..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -pytorch_lightning==1.2.10 -nibabel==3.2.1 -scipy==1.7.0 -albumentations==0.5.2 -dataclasses -pandas==1.2.1 -torch==1.8.1 -torchvision==0.9.1 diff --git a/setup.py b/setup.py index d5fc3fb..3393220 100644 --- a/setup.py +++ b/setup.py @@ -13,14 +13,19 @@ package_data={"bpreg": ["settings/body-part-metadata.md"]}, test_suite="unittest", install_requires=[ - "pytorch_lightning==1.2.10", - "nibabel==3.2.1", - "scipy==1.7.0", - "albumentations==0.5.2", - "dataclasses", - "pandas==1.2.1", - "torch==1.8.1", - "torchvision==0.9.1", + "pytorch_lightning>=1.2.10", + "nibabel>=3.2.1", + "scipy>=1.7.0", + # 1.4.4 includes https://github.com/albumentations-team/albumentations/pull/1646. + # This disallows passing value=None to ShiftScaleRotate. + # The public model version 1.1 sets value=null in its config.json: https://zenodo.org/records/5113483#.YPaBkNaxWEA + "albumentations>=0.5.2,<1.4.4", + "dataclasses; python_version < '3.7'", + "matplotlib", + "pandas>=1.2.1", + "requests", + "torch>=1.8.1", + "torchvision>=0.9.1 ", ], data_files=[("models", ["bpreg/settings/body-part-metadata.md"])], long_description=readme, diff --git a/test/test_inference.py b/test/test_inference.py index 5e774de..a1cbea8 100644 --- a/test/test_inference.py +++ b/test/test_inference.py @@ -1,5 +1,6 @@ import sys, os, json import nibabel as nib +import torch sys.path.append("../") from bpreg.scripts.bpreg_inference import * @@ -59,7 +60,9 @@ def test_npy_inference(): input_path = os.path.join(MAIN_PATH, "data/test_cases/") input_path += os.listdir(input_path)[0] - model = InferenceModel() + if not torch.cuda.is_available(): + gpu_available = False + model = InferenceModel(gpu=gpu_available) metadata1 = model.nifti2json(input_path, "") img = nib.load(input_path)