This commit is contained in:
Ross
2023-12-26 17:41:09 +00:00
parent 73bc0fe7ff
commit 337e73c331
+3 -1
View File
@@ -191,7 +191,8 @@ def get_image_hash(img, hash_type="blake3", direct_pixel_data=True) -> (str, boo
is_dicom = True
# ----
except pydicom.errors.InvalidDicomError as e:
# Random error catching is bad
except (pydicom.errors.InvalidDicomError, TypeError) as e:
print("dicom error", img)
try: # This is horrible (but needed for current unit tests)
# (we use a temporary file that breaks here)
@@ -202,6 +203,7 @@ def get_image_hash(img, hash_type="blake3", direct_pixel_data=True) -> (str, boo
case "blake3":
hash = blake3(img.read()).hexdigest()
except AttributeError:
print("BAD")
return hash, False
return hash, is_dicom