@@ -48,7 +48,6 @@ def read_annotation(annotPath):
48
48
return centroid_map , inst_map , nuclear_map , type_map
49
49
50
50
51
-
52
51
test_folder = glob .glob (os .path .join (config .dataset_raw , "Test/Images" ))[0 ]
53
52
train_folder = glob .glob (os .path .join (config .dataset_raw , "Train/Images" ))[0 ]
54
53
@@ -70,8 +69,7 @@ def read_annotation(annotPath):
70
69
print (img_path )
71
70
image = read_image (img_path )
72
71
centroid_map , inst_map , nuclear_map , type_map = read_annotation (
73
- img_path .replace ("Images" , "Labels" ).replace (".png" , ".mat" )
74
- )
72
+ img_path .replace ("Images" , "Labels" ).replace (".png" , ".mat" ))
75
73
76
74
output_mask = np .zeros ((image .shape [0 ], image .shape [1 ], 7 ))
77
75
output_mask [:, :, :3 ] = image / 255.0
@@ -80,17 +78,14 @@ def read_annotation(annotPath):
80
78
output_mask [:, :, 5 ] = centroid_map # centroids_mask
81
79
output_mask [:, :, 6 ] = type_map # type mask
82
80
83
- output = util .view_as_windows (
84
- output_mask , (256 , 256 , 7 ), step = (245 , 245 , 7 )
85
- ).reshape (
86
- - 1 , 256 , 256 , 7
87
- )
81
+ output = util .view_as_windows (output_mask , (256 , 256 , 7 ),
82
+ step = (245 , 245 , 7 )).reshape (- 1 , 256 , 256 , 7 )
88
83
89
84
for idx in range (output .shape [0 ]):
90
85
np .save (
91
86
"{}/{}_{}.npy" .format (
92
- config .test_dir , os . path . basename ( img_path ). replace ( ".png" , "" ), idx
93
- ),
87
+ config .test_dir ,
88
+ os . path . basename ( img_path ). replace ( ".png" , "" ), idx ),
94
89
output [idx ],
95
90
)
96
91
@@ -99,8 +94,7 @@ def read_annotation(annotPath):
99
94
100
95
image = read_image (img_path )
101
96
centroid_map , inst_map , nuclear_map , type_map = read_annotation (
102
- img_path .replace ("Images" , "Labels" ).replace (".png" , ".mat" )
103
- )
97
+ img_path .replace ("Images" , "Labels" ).replace (".png" , ".mat" ))
104
98
105
99
output_mask = np .zeros ((image .shape [0 ], image .shape [1 ], 7 ))
106
100
output_mask [:, :, :3 ] = image / 255.0
@@ -109,16 +103,13 @@ def read_annotation(annotPath):
109
103
output_mask [:, :, 5 ] = centroid_map # centroids_mask
110
104
output_mask [:, :, 6 ] = type_map # type mask
111
105
112
- output = util .view_as_windows (
113
- output_mask , (256 , 256 , 7 ), step = (128 , 128 , 7 )
114
- ).reshape (
115
- - 1 , 256 , 256 , 7
116
- )
106
+ output = util .view_as_windows (output_mask , (256 , 256 , 7 ),
107
+ step = (128 , 128 , 7 )).reshape (- 1 , 256 , 256 , 7 )
117
108
118
109
for idx in range (output .shape [0 ]):
119
110
np .save (
120
111
"{}/{}_{}.npy" .format (
121
- config .train_dir , os . path . basename ( img_path ). replace ( ".png" , "" ), idx
122
- ),
112
+ config .train_dir ,
113
+ os . path . basename ( img_path ). replace ( ".png" , "" ), idx ),
123
114
output [idx ],
124
115
)
0 commit comments