MIC-DKFZ / nnUNet

Apache License 2.0
5.33k stars 1.63k forks source link

verify_dataset_integrity requires exact equality of image properties when "allclose" is sufficient #2282

Closed andylitalo closed 1 week ago

andylitalo commented 2 weeks ago

Running verify_dataset_integrity() checks all input images to make sure they have the exact same spacing, shape, direction, and origin. As a result, if there are negligible (e.g., 1e-10) discrepancies among images, it raises an error when none should be raised.

Suggested fix: make BaseReaderWriter._check_all_same() similar to BaseReaderWriter._check_all_same_array() by replacing this check for exact equality with a check for closeness:

if not np.allclose(i, input_list[0]):
FabianIsensee commented 1 week ago

Thanks for the suggestion. I just changed it to np.allclose in master