Skip to content

Commit 2a1b2ed

Browse files
committed
account for asymmetric halos
1 parent 15dfb48 commit 2a1b2ed

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/bioimageio/core/block_meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class BlockMeta:
5252
The outer slice reaches from the sample member origin (0, 0) to the right halo point.
5353
5454
```terminal
55-
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
55+
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
5656
╷ halo(left) ╷
5757
╷ ╷
5858
╷ (0, 0)┏━━━━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━➔

src/bioimageio/core/digest_spec.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,15 @@ def get_input_halo(model: v0_5.ModelDescr, output_halo: PerMember[PerAxis[Halo]]
302302
axis = axes[a]
303303
ref_axis = {a.id: a for a in all_tensors[s.tensor_id].axes}[s.axis_id]
304304

305-
total_output_halo = sum(ah)
306-
total_input_halo = total_output_halo * axis.scale / ref_axis.scale
307-
assert (
308-
total_input_halo == int(total_input_halo) and total_input_halo % 2 == 0
305+
input_halo_left = ah.left * axis.scale / ref_axis.scale
306+
input_halo_right = ah.right * axis.scale / ref_axis.scale
307+
assert input_halo_left == int(input_halo_left), f"{input_halo_left} not int"
308+
assert input_halo_right == int(input_halo_right), (
309+
f"{input_halo_right} not int"
309310
)
311+
310312
input_halo.setdefault(s.tensor_id, {})[a] = Halo(
311-
int(total_input_halo // 2), int(total_input_halo // 2)
313+
int(input_halo_left), int(input_halo_right)
312314
)
313315

314316
return input_halo

0 commit comments

Comments
 (0)