File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ def distance_transform(label: np.ndarray,
137137
138138 label_shape = label .shape
139139 all_bg_sample = False
140- distance = np .zeros (label_shape , dtype = np .float32 ) + bg_value
140+ distance = np .zeros (label_shape , dtype = np .float32 )
141141 semantic = np .zeros (label_shape , dtype = np .uint8 )
142142
143143 indices = np .unique (label )
@@ -157,6 +157,7 @@ def distance_transform(label: np.ndarray,
157157 energy = boundary_edt / (boundary_edt .max () + eps ) # normalize
158158 distance = np .maximum (distance , energy * temp2 .astype (np .float32 ))
159159
160+ distance [distance == 0 ] = bg_value
160161 if padding :
161162 # Unpad the output array to preserve original shape.
162163 distance = array_unpad (distance , get_padsize (
You can’t perform that action at this time.
0 commit comments