Skip to content

Commit 2662710

Browse files
committed
Reverse coordinates to account for different format
1 parent a5a6ce8 commit 2662710

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

flamingo_tools/segmentation/ihc_synapse_postprocessing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def find_overlapping_masks(
3030
edit_labels = []
3131
# base array containing only segmentation with too many synapses
3232
arr_base[arr_base != label_id_base] = 0
33+
if np.count_nonzero(arr_base) == 0:
34+
raise ValueError(f"Label id {label_id_base} not found in array. Wrong input?")
3335
arr_base = arr_base.astype(bool)
3436

3537
edit_labels = []
@@ -159,6 +161,9 @@ def postprocess_ihc_synapse(
159161
coords_max = [int(round(c / resolution)) for c in coords_max]
160162
coords_min = [row["bb_min_x"], row["bb_min_y"], row["bb_min_z"]]
161163
coords_min = [int(round(c / resolution)) for c in coords_min]
164+
165+
coords_max.reverse()
166+
coords_min.reverse()
162167
roi = tuple(slice(cmin - roi_pad, cmax + roi_pad) for cmax, cmin in zip(coords_max, coords_min))
163168

164169
roi_base = data_base[roi]

scripts/prediction/postprocess_ihc_synapse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def main():
5858
else:
5959
output_ = ihc_synapse_postprocessing.postprocess_ihc_synapse(
6060
data_base, data_ref, table_base=table_base, synapse_limit=25, min_overlap=0.5,
61-
resolution=0.38, roi_buffer=40,
61+
resolution=0.38, roi_pad=40,
6262
)
6363

6464
if args.tif:

0 commit comments

Comments
 (0)