Skip to content

Commit fb1fcd0

Browse files
Fix issues in active zone segmentation
1 parent a7ff94e commit fb1fcd0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

synapse_net/inference/active_zone.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def segment_active_zone(
8787
verbose: Whether to print timing information.
8888
scale: The scale factor to use for rescaling the input volume before prediction.
8989
mask: An optional mask that is used to restrict the segmentation.
90-
compartment:
90+
compartment: Pass a compartment segmentation, to intersect the boundaries of the
91+
compartments with the active zone prediction.
9192
9293
Returns:
9394
The foreground mask as a numpy array.
@@ -108,13 +109,17 @@ def segment_active_zone(
108109
print(f"shape {foreground.shape}")
109110

110111
segmentation = _run_segmentation(foreground, verbose=verbose, min_size=min_size)
112+
segmentation = scaler.rescale_output(segmentation, is_segmentation=True)
111113

112-
# returning prediciton and intersection not possible atm, but currently do not need prediction anyways
114+
# Returning prediciton and intersection currently not possible.
113115
if return_predictions:
116+
assert compartment is None
114117
pred = scaler.rescale_output(pred, is_segmentation=False)
115118
return segmentation, pred
116119

117120
if compartment is not None:
121+
assert not return_predictions
122+
compartment = scaler.scale_input(input_volume, is_segmentation=True)
118123
intersection = find_intersection_boundary(segmentation, compartment)
119124
return segmentation, intersection
120125

0 commit comments

Comments
 (0)