This commit is contained in:
Ross
2021-11-21 19:45:52 +00:00
parent d2e8c06066
commit 3bf1961598
+2 -1
View File
@@ -459,7 +459,8 @@ class RapidImage(models.Model):
try: try:
# and generate a hash from the pixel data # and generate a hash from the pixel data
dataset = pydicom.dcmread(self.image) dataset = pydicom.dcmread(self.image)
hash = hashlib.md5(",".join([str(i) for i in dataset.pixel_array.tostring()])).hexdigest() hash = hashlib.md5(",".join([str(i) for i in list(dataset.pixel_array.flatten())])).hexdigest()
self.is_dicom = True self.is_dicom = True
except pydicom.errors.InvalidDicomError: except pydicom.errors.InvalidDicomError:
self.image.file.open() self.image.file.open()