fix a few small upload bugs

This commit is contained in:
Ross
2024-11-26 22:52:10 +00:00
parent 4bc0e3be93
commit ba29c9c881
3 changed files with 15 additions and 5 deletions
+8 -1
View File
@@ -9,6 +9,7 @@ from PIL import Image, ImageFile
from blake3 import blake3
import pydicom
from pydicom.errors import InvalidDicomError
import sys
import glob
@@ -178,7 +179,13 @@ def get_image_dicom_hash(img, dataset=None, hash_type="md5", direct_pixel_data=T
raise NotImplemented
if direct_pixel_data:
hasher.update(dataset.PixelData)
try:
hasher.update(dataset.PixelData)
except AttributeError as e:
print("Error getting pixel data hash from dataset")
print(dataset)
raise InvalidDicomError("Error getting pixel data hash from dataset")
else:
first = True
for i in dataset.pixel_array.astype(str).flatten():