This commit is contained in:
Ross
2023-12-26 18:04:25 +00:00
parent 7079be8cc1
commit c933038b83
2 changed files with 9 additions and 8 deletions
+7 -6
View File
@@ -239,14 +239,15 @@ class SeriesImageBase(models.Model):
return info
def generate_hashes(self):
image_hash, is_dicom = get_image_hash(self.image, hash_type="md5", direct_pixel_data=False)
with pydicom.dcmread(self.image) as ds:
image_hash, is_dicom = get_image_hash(self.image, dataset=ds, hash_type="md5", direct_pixel_data=False)
self.is_dicom = is_dicom
self.image_md5_hash = image_hash
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
image_blake3_hash, is_dicom = get_image_hash(self.image, dataset=ds, hash_type="blake3", direct_pixel_data=True)
self.is_dicom = is_dicom
self.image_blake3_hash = image_blake3_hash
self.save()