-
Notifications
You must be signed in to change notification settings - Fork 24
/
main.py
30 lines (23 loc) · 839 Bytes
/
main.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
import slideseg
import os
def main():
"""
Runs SlideSeg with the parameters specified in Parameters.txt
:return: image chips and masks
"""
def str2bool(value):
return value.lower() in ("true", "yes", "1")
params = slideseg.load_parameters('Parameters.txt')
print('running __main__ with parameters: {0}'.format(params))
if not os.path.isdir(params["slide_path"]):
path, filename = os.path.split(params["slide_path"])
xpath, xml_filename = os.path.split(params["xml_path"])
params["slide_path"] = path
params["xml_path"] = xpath
print('loading {0}'.format(filename))
slideseg.run(params, filename)
else:
for filename in os.listdir(params["slide_path"]):
slideseg.run(params, filename)
if __name__ == "__main__":
main()