@@ -87,7 +87,8 @@ def segment_active_zone(
87
87
verbose: Whether to print timing information.
88
88
scale: The scale factor to use for rescaling the input volume before prediction.
89
89
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.
91
92
92
93
Returns:
93
94
The foreground mask as a numpy array.
@@ -108,13 +109,17 @@ def segment_active_zone(
108
109
print (f"shape { foreground .shape } " )
109
110
110
111
segmentation = _run_segmentation (foreground , verbose = verbose , min_size = min_size )
112
+ segmentation = scaler .rescale_output (segmentation , is_segmentation = True )
111
113
112
- # returning prediciton and intersection not possible atm, but currently do not need prediction anyways
114
+ # Returning prediciton and intersection currently not possible.
113
115
if return_predictions :
116
+ assert compartment is None
114
117
pred = scaler .rescale_output (pred , is_segmentation = False )
115
118
return segmentation , pred
116
119
117
120
if compartment is not None :
121
+ assert not return_predictions
122
+ compartment = scaler .scale_input (input_volume , is_segmentation = True )
118
123
intersection = find_intersection_boundary (segmentation , compartment )
119
124
return segmentation , intersection
120
125
0 commit comments