Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added seed_distance to parameters of mitochondria segmentation #93

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions synapse_net/inference/mitochondria.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def _run_segmentation(
foreground, boundaries, verbose, min_size,
# blocking shapes for parallel computation
block_shape=(128, 256, 256),
halo=(48, 48, 48)
halo=(48, 48, 48),
seed_distance=6
):
t0 = time.time()
boundary_threshold = 0.25
Expand All @@ -24,7 +25,6 @@ def _run_segmentation(

# Get the segmentation via seeded watershed.
t0 = time.time()
seed_distance = 6
seeds = np.logical_and(foreground > 0.5, dist > seed_distance)
seeds = parallel.label(seeds, block_shape=block_shape, verbose=verbose)
if verbose:
Expand Down Expand Up @@ -65,6 +65,7 @@ def segment_mitochondria(
return_predictions: bool = False,
scale: Optional[List[float]] = None,
mask: Optional[np.ndarray] = None,
seed_distance: int = 6,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add this to the doc string as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i added watershed tiling to the function's parameters, because i needed to adapt it for some data

) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]:
"""Segment mitochondria in an input volume.

Expand Down Expand Up @@ -97,7 +98,7 @@ def segment_mitochondria(

# Run segmentation and rescale the result if necessary.
foreground, boundaries = pred[:2]
seg = _run_segmentation(foreground, boundaries, verbose=verbose, min_size=min_size)
seg = _run_segmentation(foreground, boundaries, verbose=verbose, min_size=min_size, seed_distance=seed_distance)
seg = scaler.rescale_output(seg, is_segmentation=True)

if return_predictions:
Expand Down
Loading