Skip to content

Commit 43b6c64

Browse files
Donglai Weiclaude
andcommitted
Use waterz.strip_border instead of inline border thresholding
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 40ff5ca commit 43b6c64

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

connectomics/decoding/decoders/waterz.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,9 @@ def decode_waterz(
269269
else:
270270
seg = waterz_result
271271

272-
# Zero out voxels where mean xy affinity is below threshold,
273-
# creating gaps at weak boundaries to separate segments.
272+
# Strip weak-boundary voxels so dust merge sees true core sizes.
274273
if border_threshold > 0:
275-
xy_mean = affs[1:3].astype(np.float32, copy=False).mean(axis=0)
276-
if is_uint8:
277-
xy_mean /= 255.0
278-
border_mask = xy_mean < border_threshold
279-
n_removed = int(border_mask.sum())
280-
seg[border_mask] = 0
274+
n_removed = waterz.strip_border(seg, affs, threshold=border_threshold, channels="xy")
281275
logger.info("border_threshold=%s: zeroed %d voxels", border_threshold, n_removed)
282276

283277
# Size+affinity dust merge reusing the agglomeration's region graph

0 commit comments

Comments
 (0)