forked from mlcommons/GaNDLF
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
105 lines (92 loc) · 2.95 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open("README.md") as readme_file:
readme = readme_file.read()
# read version.py
import sys, re
try:
filepath = "GANDLF/version.py"
version_file = open(filepath)
(__version__,) = re.findall('__version__ = "(.*)"', version_file.read())
except Exception as error:
__version__ = "0.0.1"
sys.stderr.write("Warning: Could not open '%s' due %s\n" % (filepath, error))
requirements = [
"numpy==1.19.2",
"scipy",
"SimpleITK==1.2.4",
"torch>=1.7",
"torchvision",
"tqdm",
"torchio==0.18.29",
"pandas",
"pylint",
"scikit-learn==0.23.1",
"pickle5==0.0.11",
"setuptools",
"seaborn",
"pyyaml",
"openslide-python",
"scikit-image",
"matplotlib",
"requests>=2.25.0",
"pyvips",
"pytest",
"pytest-azurepipelines",
"coverage",
"psutil",
"medcam",
]
setup(
name="GANDLF",
version=__version__,
author="Jose Agraz, Ujjwal Baid, Megh Bhalerao, Brandon Edwards, Karol Gotkowski, Caleb Grenko, Sarthak Pati, Micah Sheller, Siddhesh Thakur", # alphabetical order
author_email="[email protected]",
python_requires=">=3.6",
packages=find_packages(),
scripts=[
"gandlf_run",
"gandlf_constructCSV",
"gandlf_collectStats",
"gandlf_patchMiner",
"gandlf_padder",
],
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
description=(
"PyTorch-based framework that handles segmentation/regression/classification using various DL architectures for medical imaging."
),
install_requires=requirements,
license="BSD-3-Clause License",
long_description=readme,
long_description_content_type="text/markdown",
include_package_data=True,
keywords="semantic, segmentation, regression, classification, brain, breast, liver, lung, augmentation, medical-imaging",
zip_safe=False,
)
import os
## submodule update
os.system("git submodule update --init --recursive")
## windows vips installation
if os.name == "nt": # proceed for windows
from pathlib import Path
if not Path(
"./vips/vips-dev-8.10/bin/libvips-42.dll"
).exists(): # download and extract if main dll is absent
print("Downloading and extracting VIPS for Windows")
url = "https://github.com/libvips/libvips/releases/download/v8.10.2/vips-dev-w64-all-8.10.2.zip"
zip_to_extract = "./vips.zip"
import urllib.request, zipfile
urllib.request.urlretrieve(url, zip_to_extract)
z = zipfile.ZipFile(zip_to_extract)
z.extractall("./vips")
z.close()
os.remove(zip_to_extract)