forked from mlcommons/GaNDLF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gandlf_patchMiner
55 lines (46 loc) · 1.49 KB
/
gandlf_patchMiner
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
#!usr/bin/env python
# -*- coding: utf-8 -*-
import os, argparse
from datetime import date
from GANDLF.cli.patch_extraction import patch_extraction
from GANDLF.utils import fix_paths
fix_paths(os.getcwd()) # add relevant vips path
if __name__ == "__main__":
copyrightMessage = (
"Contact: [email protected]\n\n"
+ "This program is NOT FDA/CE approved and NOT intended for clinical use.\nCopyright (c) "
+ str(date.today().year)
+ " University of Pennsylvania. All rights reserved."
)
parser = argparse.ArgumentParser(
prog="GANDLF_PatchMiner",
formatter_class=argparse.RawTextHelpFormatter,
description="Construct patches from whole slide image(s).\n\n"
+ copyrightMessage,
)
parser.add_argument(
"-i",
"--input_CSV",
dest="input_path",
help="input path for the tissue",
required=True,
)
parser.add_argument(
"-o",
"--output_path",
dest="output_path",
default=None,
required=True,
help="output path for the patches",
)
parser.add_argument(
"-c",
"--config",
type=str,
dest="config",
help="config (in YAML) for running OPM. Needs 'scale' and 'patch_size' to be defined, otherwise defaults to 16 and (256, 256), respectively.",
required=False,
)
args = parser.parse_args()
patch_extraction(args.input_path, args.output_path, args.config)
print("Finished.")