11
11
@click .option (
12
12
"-i" ,
13
13
"--wsi-dir" ,
14
- type = click .Path (exists = True , file_okay = False , path_type = Path , resolve_path = True ),
14
+ type = click .Path (exists = True , file_okay = False , path_type = Path ),
15
15
required = True ,
16
16
help = "Directory containing whole slide images. This directory can *only* contain"
17
17
" whole slide images." ,
18
18
)
19
19
@click .option (
20
20
"-o" ,
21
21
"--results-dir" ,
22
- type = click .Path (file_okay = False , path_type = Path , resolve_path = True ),
22
+ type = click .Path (file_okay = False , path_type = Path ),
23
23
required = True ,
24
24
help = "Directory to store patch results. If directory exists, will skip"
25
25
" whole slides for which outputs exist." ,
32
32
help = "Physical spacing of the patch in micrometers per pixel." ,
33
33
)
34
34
@click .option (
35
- "--thumbsize" ,
35
+ "--seg- thumbsize" ,
36
36
default = (2048 , 2048 ),
37
37
type = (int , int ),
38
38
help = "The size of the slide thumbnail (in pixels) used for tissue segmentation."
39
39
" The aspect ratio is preserved, and the longest side will have length"
40
40
" max(thumbsize)." ,
41
41
)
42
42
@click .option (
43
- "--median-filter-size" ,
43
+ "--seg- median-filter-size" ,
44
44
default = 7 ,
45
45
type = click .IntRange (min = 3 ),
46
46
help = "The kernel size for median filtering. Must be greater than 1 and odd." ,
47
47
)
48
48
@click .option (
49
- "--binary-threshold" ,
49
+ "--seg- binary-threshold" ,
50
50
default = 7 ,
51
51
type = click .IntRange (min = 1 ),
52
52
help = "The threshold for image binarization." ,
53
53
)
54
54
@click .option (
55
- "--closing-kernel-size" ,
55
+ "--seg- closing-kernel-size" ,
56
56
default = 6 ,
57
57
type = click .IntRange (min = 1 ),
58
58
help = "The kernel size for binary closing (morphological operation)." ,
59
59
)
60
60
@click .option (
61
- "--min-object-size-um2" ,
61
+ "--seg- min-object-size-um2" ,
62
62
default = 200 ** 2 ,
63
63
type = click .FloatRange (min = 0 ),
64
64
help = "The minimum size of an object to keep during tissue detection. If a"
65
65
" contiguous object is smaller than this area, it replaced with background."
66
66
" The default is 200um x 200um. The units of this argument are microns squared." ,
67
67
)
68
68
@click .option (
69
- "--min-hole-size-um2" ,
69
+ "--seg- min-hole-size-um2" ,
70
70
default = 190 ** 2 ,
71
71
type = click .FloatRange (min = 0 ),
72
72
help = "The minimum size of a hole to keep as a hole. If a hole is smaller than this"
@@ -78,23 +78,23 @@ def patch(
78
78
results_dir : str ,
79
79
patch_size_px : int ,
80
80
patch_spacing_um_px : float ,
81
- thumbsize : tuple [int , int ],
82
- median_filter_size : int ,
83
- binary_threshold : int ,
84
- closing_kernel_size : int ,
85
- min_object_size_um2 : float ,
86
- min_hole_size_um2 : float ,
81
+ seg_thumbsize : tuple [int , int ],
82
+ seg_median_filter_size : int ,
83
+ seg_binary_threshold : int ,
84
+ seg_closing_kernel_size : int ,
85
+ seg_min_object_size_um2 : float ,
86
+ seg_min_hole_size_um2 : float ,
87
87
) -> None :
88
88
"""Patch a directory of whole slide iamges."""
89
89
segment_and_patch_directory_of_slides (
90
90
wsi_dir = wsi_dir ,
91
91
save_dir = results_dir ,
92
92
patch_size_px = patch_size_px ,
93
93
patch_spacing_um_px = patch_spacing_um_px ,
94
- thumbsize = thumbsize ,
95
- median_filter_size = median_filter_size ,
96
- binary_threshold = binary_threshold ,
97
- closing_kernel_size = closing_kernel_size ,
98
- min_object_size_um2 = min_object_size_um2 ,
99
- min_hole_size_um2 = min_hole_size_um2 ,
94
+ thumbsize = seg_thumbsize ,
95
+ median_filter_size = seg_median_filter_size ,
96
+ binary_threshold = seg_binary_threshold ,
97
+ closing_kernel_size = seg_closing_kernel_size ,
98
+ min_object_size_um2 = seg_min_object_size_um2 ,
99
+ min_hole_size_um2 = seg_min_hole_size_um2 ,
100
100
)
0 commit comments