|
18 | 18 | import sys |
19 | 19 | import shutil |
20 | 20 |
|
21 | | -#check if current directory is writable |
| 21 | +# check if current directory is writable |
22 | 22 | current_dir = os.getcwd() |
23 | | -if not os.access(current_dir,os.W_OK): |
24 | | - raise OSError("You don't have write permission in the current directory. Please copy the Examples folder to a different location to run the use cases") |
25 | | - |
| 23 | +if not os.access(current_dir, os.W_OK): |
| 24 | + raise OSError( |
| 25 | + "You don't have write permission in the current directory. Please copy the Examples folder to a different location to run the use cases") |
26 | 26 |
|
27 | 27 | if __name__ == '__main__': |
28 | 28 |
|
|
31 | 31 | import termcolor |
32 | 32 | import DatasetUtils |
33 | 33 | import shapeworks as sw |
| 34 | + |
34 | 35 | print(f"Using shapeworks module from {sw.__file__}") |
35 | 36 |
|
36 | 37 | # make sure the shapeworks executables can be found |
|
41 | 42 |
|
42 | 43 | except ImportError as error: |
43 | 44 | print("\nError: Unable to import ShapeWorks executables, Python module, or dependencies\n") |
44 | | - print("Users: Please make sure you have run \"source install_shapeworks.sh\" (once) and \"conda activate shapeworks\" (each time)") |
| 45 | + print( |
| 46 | + "Users: Please make sure you have run \"source install_shapeworks.sh\" (once) and \"conda activate shapeworks\" (each time)") |
45 | 47 | print("\tSee http://sciinstitute.github.io/ShapeWorks/users/install.html for more information") |
46 | 48 | print("\nDevelopers: Please make sure you have run \"source ./devenv.sh <SOURCE_DIR> <BUILD_DIR>\"") |
47 | | - sys.exit(1) |
48 | 49 |
|
| 50 | + print(f"\nError message: {error}") |
| 51 | + sys.exit(1) |
49 | 52 |
|
50 | 53 | # parse arguments |
51 | 54 | parser = argparse.ArgumentParser(description='Example ShapeWorks Pipeline') |
52 | 55 | parser.add_argument("use_case", help="Must specify which of these use cases to run.", |
53 | | - choices=["ellipsoid", "ellipsoid_evaluate", "ellipsoid_mesh", "ellipsoid_fd", "ellipsoid_cut", "ellipsoid_pca", \ |
54 | | - "ellipsoid_multiple_domain","ellipsoid_multiple_domain_mesh", "lumps", "left_atrium", \ |
55 | | - "femur_cut","femur_pvalues","deep_ssm", "supershapes_1mode_contour", "thin_cavity_bean", |
56 | | - "peanut_shared_boundary", "incremental_supershapes","hip_multiple_domain"]) |
| 56 | + choices=["ellipsoid", "ellipsoid_evaluate", "ellipsoid_mesh", "ellipsoid_fd", "ellipsoid_cut", |
| 57 | + "ellipsoid_pca", \ |
| 58 | + "ellipsoid_multiple_domain", "ellipsoid_multiple_domain_mesh", "lumps", "left_atrium", \ |
| 59 | + "femur_cut", "femur_pvalues", "deep_ssm", "supershapes_1mode_contour", |
| 60 | + "thin_cavity_bean", |
| 61 | + "peanut_shared_boundary", "incremental_supershapes", "hip_multiple_domain"]) |
57 | 62 | parser.add_argument("--use_subsample", help="Run the pipeline for a subset of data", action="store_true") |
58 | 63 | parser.add_argument("--num_subsample", help="Size of subset to run on (default: %(default)s)", type=int, default=3) |
59 | 64 | parser.add_argument("--interactive", help="Run in interactive mode", action="store_true") |
60 | | - parser.add_argument("--use_single_scale", help="Use single scale optimization (default: multi scale)", action="store_true") |
61 | | - parser.add_argument("--mesh_mode", help="Run optimization on meshes rather than distance transforms.",action="store_true") |
| 65 | + parser.add_argument("--use_single_scale", help="Use single scale optimization (default: multi scale)", |
| 66 | + action="store_true") |
| 67 | + parser.add_argument("--mesh_mode", help="Run optimization on meshes rather than distance transforms.", |
| 68 | + action="store_true") |
62 | 69 | parser.add_argument("--tiny_test", help="Run as a short test", action="store_true") |
63 | 70 | parser.add_argument("--verify", help="Run as a full test", action="store_true") |
| 71 | + parser.add_argument("--clean", help="Run from scratch, ignoring intermediate stages", action="store_true") |
64 | 72 | args = parser.parse_args() |
65 | 73 |
|
66 | | - |
67 | 74 | type = "" |
68 | 75 | if args.tiny_test: |
69 | 76 | type = "tiny_test_" |
|
78 | 85 | if args.use_subsample: |
79 | 86 | dataExists = sw.data.dataset_exists_check(args.use_case) |
80 | 87 | args.use_subsample = args.num_subsample |
81 | | - if(dataExists==False): |
82 | | - print("Please note: For --use_subsample argument the entire dataset will be downloaded. For a quick test use the --tiny_test argument") |
| 88 | + if (dataExists == False): |
| 89 | + print( |
| 90 | + "Please note: For --use_subsample argument the entire dataset will be downloaded. For a quick test use the --tiny_test argument") |
83 | 91 | input("Press any key to continue") |
84 | 92 |
|
85 | 93 | # import use case and run |
|
0 commit comments