This commit is contained in:
Ross
2021-11-21 11:15:57 +00:00
parent 39b9706856
commit 5397e3a453
+2 -1
View File
@@ -458,7 +458,8 @@ class RapidImage(models.Model):
# Try and read the file as a dicom # Try and read the file as a dicom
try: try:
# and generate a hash from the pixel data # and generate a hash from the pixel data
hash = hashlib.md5(",".join(pydicom.dcmread(self.image.path).pixel_array.tostring())).hexdigest() dataset = pydicom.dcmread(self.image)
hash = hashlib.md5(",".join(dataset.pixel_array.tostring())).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()