Skip to content

Commit

Permalink
Fix bug for cornercase in resized volume
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinpape committed Mar 11, 2024
1 parent 77ed54f commit 564af98
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions elf/wrapper/resized_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ def __getitem__(self, key):
for idx, sh, is_single in zip(index, data_shape, singletons))
data = self.volume[index]

# speed ups for empty blocks and masks
dsum = data.sum()
if dsum == 0:
# Speed ups for empty blocks and masks.
if data.sum() == 0:
out = np.zeros(ret_shape, dtype=self.dtype)
elif dsum == data.size:
elif (data == 1).sum() == data.size:
out = np.ones(ret_shape, dtype=self.dtype)
else:
out = self._interpolate(data, ret_shape)
Expand Down

0 comments on commit 564af98

Please sign in to comment.