.
This commit is contained in:
+9
-10
@@ -242,7 +242,6 @@ class SeriesImageBase(models.Model):
|
||||
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
|
||||
|
||||
image_blake3_hash, is_dicom = get_image_hash(self.image, dataset=ds, hash_type="blake3", direct_pixel_data=True)
|
||||
@@ -254,17 +253,17 @@ class SeriesImageBase(models.Model):
|
||||
def save(self, *args, **kwargs):
|
||||
"""Override save method to add image hash"""
|
||||
if self.image:
|
||||
print(self.pk, self.image)
|
||||
if not self.image_md5_hash:
|
||||
image_hash, is_dicom = get_image_hash(self.image, hash_type="md5", direct_pixel_data=False)
|
||||
with pydicom.dcmread(self.image) as ds:
|
||||
if not self.image_md5_hash:
|
||||
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
|
||||
|
||||
if not self.image_blake3_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
|
||||
if not self.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
|
||||
|
||||
## Hack for tests
|
||||
#if image_hash != "12345ABCD":
|
||||
|
||||
Reference in New Issue
Block a user