| Total Complexity | 0 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 2 | Download the demo data |
||
| 3 | """ |
||
| 4 | import os |
||
| 5 | import shutil |
||
| 6 | |||
| 7 | from tensorflow.keras.utils import get_file |
||
| 8 | |||
| 9 | MAIN_PATH = os.getcwd() |
||
| 10 | PROJECT_DIR = "demos/classical_mr_prostate_nonrigid" |
||
| 11 | os.chdir(PROJECT_DIR) |
||
| 12 | |||
| 13 | DATA_PATH = "dataset" |
||
| 14 | FILE_PATH = os.path.abspath(os.path.join(DATA_PATH, "demo2.h5")) |
||
| 15 | ORIGIN = "https://github.com/YipengHu/example-data/raw/master/promise12/demo2.h5" |
||
| 16 | |||
| 17 | if os.path.exists(DATA_PATH): |
||
| 18 | shutil.rmtree(DATA_PATH) |
||
| 19 | os.mkdir(DATA_PATH) |
||
| 20 | |||
| 21 | get_file(FILE_PATH, ORIGIN) |
||
| 22 | print("Prostate MR data downloaded: %s." % FILE_PATH) |
||
| 23 | |||
| 24 | os.chdir(MAIN_PATH) |
||
| 25 |