Skip to content

Commit

Permalink
use np.allclose as suggested in #2282
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianIsensee committed Jun 19, 2024
1 parent ec229b5 commit ed88855
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nnunetv2/imageio/base_reader_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
class BaseReaderWriter(ABC):
@staticmethod
def _check_all_same(input_list):
# compare all entries to the first
for i in input_list[1:]:
if i != input_list[0]:
return False
return True
if len(input_list) == 1:
return True
else:
# compare all entries to the first
return np.allclose(input_list[0], input_list[1:])

@staticmethod
def _check_all_same_array(input_list):
Expand Down

0 comments on commit ed88855

Please sign in to comment.