Skip to content

Commit 32438b2

Browse files
committed
added seed_distance to parameters of mitochondria segmentation
1 parent 9847f1b commit 32438b2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

synapse_net/inference/mitochondria.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def _run_segmentation(
1212
foreground, boundaries, verbose, min_size,
1313
# blocking shapes for parallel computation
1414
block_shape=(128, 256, 256),
15-
halo=(48, 48, 48)
15+
halo=(48, 48, 48),
16+
seed_distance=6
1617
):
1718
t0 = time.time()
1819
boundary_threshold = 0.25
@@ -24,7 +25,6 @@ def _run_segmentation(
2425

2526
# Get the segmentation via seeded watershed.
2627
t0 = time.time()
27-
seed_distance = 6
2828
seeds = np.logical_and(foreground > 0.5, dist > seed_distance)
2929
seeds = parallel.label(seeds, block_shape=block_shape, verbose=verbose)
3030
if verbose:
@@ -65,6 +65,7 @@ def segment_mitochondria(
6565
return_predictions: bool = False,
6666
scale: Optional[List[float]] = None,
6767
mask: Optional[np.ndarray] = None,
68+
seed_distance: int = 6,
6869
) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]:
6970
"""Segment mitochondria in an input volume.
7071
@@ -97,7 +98,7 @@ def segment_mitochondria(
9798

9899
# Run segmentation and rescale the result if necessary.
99100
foreground, boundaries = pred[:2]
100-
seg = _run_segmentation(foreground, boundaries, verbose=verbose, min_size=min_size)
101+
seg = _run_segmentation(foreground, boundaries, verbose=verbose, min_size=min_size, seed_distance=seed_distance)
101102
seg = scaler.rescale_output(seg, is_segmentation=True)
102103

103104
if return_predictions:

0 commit comments

Comments
 (0)