Skip to content

Commit

Permalink
Merge pull request #1070 from AFM-SPM/llwiggins/1066-fix-mask-fragmen…
Browse files Browse the repository at this point in the history
…tation

Combine grain crops rather than overwriting them
  • Loading branch information
llwiggins authored Jan 9, 2025
2 parents 980b1c2 + a21dbf5 commit a480afe
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions topostats/grains.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,11 +1331,12 @@ def assemble_grain_mask_tensor_from_crops(
]

# Update the grain mask tensor
grain_mask_tensor[
min_row + padding : max_row - padding,
min_col + padding : max_col - padding,
:,
] = cropped_grain
grain_mask_tensor[min_row + padding : max_row - padding, min_col + padding : max_col - padding, :] = (
np.maximum(
grain_mask_tensor[min_row + padding : max_row - padding, min_col + padding : max_col - padding, :],
cropped_grain,
)
)

# Update the background class
grain_mask_tensor = Grains.update_background_class(grain_mask_tensor)
Expand Down

0 comments on commit a480afe

Please sign in to comment.