.
This commit is contained in:
+3
-2
@@ -457,10 +457,11 @@ class RapidImage(models.Model):
|
|||||||
if self.image:
|
if self.image:
|
||||||
# Try and read the file as a dicom
|
# Try and read the file as a dicom
|
||||||
try:
|
try:
|
||||||
hash = ",".join(pydicom.dcmread(self.image).pixel_array.tostring())
|
hash = ",".join(pydicom.dcmread(self.image).pixel_array.to())
|
||||||
self.is_dicom = True
|
self.is_dicom = True
|
||||||
except pydicom.errors.InvalidDicomError:
|
except pydicom.errors.InvalidDicomError:
|
||||||
hash = hashlib.md5(self.image).hexdigest()
|
with self.image.open("r") as f:
|
||||||
|
hash = hashlib.md5(f).hexdigest()
|
||||||
|
|
||||||
self.image_md5_hash = hash
|
self.image_md5_hash = hash
|
||||||
super().save(*args, **kwargs) # Call the "real" save() method.
|
super().save(*args, **kwargs) # Call the "real" save() method.
|
||||||
|
|||||||
Reference in New Issue
Block a user