This commit is contained in:
Ross
2023-12-26 17:53:58 +00:00
parent 67942f147a
commit 05fdb9fbf9
2 changed files with 18 additions and 0 deletions
+12
View File
@@ -238,6 +238,18 @@ class SeriesImageBase(models.Model):
info = "File is not a dicom."
return info
def generate_hashes(self):
image_hash, is_dicom = get_image_hash(self.image, hash_type="md5", direct_pixel_data=False)
self.is_dicom = is_dicom
self.image_md5_hash = image_hash
image_blake3_hash, is_dicom = get_image_hash(self.image, hash_type="blake3", direct_pixel_data=True)
self.is_dicom = is_dicom
self.image_blake3_hash = image_blake3_hash
self.save()
def save(self, *args, **kwargs):
"""Override save method to add image hash"""
if self.image: