Skip to content

Commit

Permalink
fix padding bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzLamm committed Jul 14, 2023
1 parent c3ee78a commit c9b3f62
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/membrain_seg/annotations/extract_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def pad_labels(patch, padding, pad_value=2.0):
This function pads the borders of the 3D array with the value of 2.0,
typically used to ignore labels at the boundaries during a subsequent analysis.
"""
if isinstance(padding, int):
padding = [padding, padding, padding]
patch[: padding[0], :, :] = pad_value
patch[-padding[0] :, :, :] = pad_value
patch[:, : padding[1], :] = pad_value
Expand Down

0 comments on commit c9b3f62

Please sign in to comment.