.
This commit is contained in:
+3
-3
@@ -239,10 +239,10 @@ class SeriesImageBase(models.Model):
|
|||||||
return info
|
return info
|
||||||
|
|
||||||
def generate_hashes(self):
|
def generate_hashes(self):
|
||||||
#image_hash, is_dicom = get_image_hash(self.image, hash_type="md5", direct_pixel_data=False)
|
image_hash, is_dicom = get_image_hash(self.image, hash_type="md5", direct_pixel_data=False)
|
||||||
|
|
||||||
#self.is_dicom = is_dicom
|
self.is_dicom = is_dicom
|
||||||
#self.image_md5_hash = image_hash
|
self.image_md5_hash = image_hash
|
||||||
|
|
||||||
image_blake3_hash, is_dicom = get_image_hash(self.image, hash_type="blake3", direct_pixel_data=True)
|
image_blake3_hash, is_dicom = get_image_hash(self.image, hash_type="blake3", direct_pixel_data=True)
|
||||||
self.is_dicom = is_dicom
|
self.is_dicom = is_dicom
|
||||||
|
|||||||
+2
-1
@@ -156,7 +156,8 @@ def print_dicom(dataset, indent=0, include_tag_ids=True):
|
|||||||
|
|
||||||
def get_image_dicom_hash(img, dataset=None, hash_type="md5", direct_pixel_data=True) -> (str, bool):
|
def get_image_dicom_hash(img, dataset=None, hash_type="md5", direct_pixel_data=True) -> (str, bool):
|
||||||
if dataset is None:
|
if dataset is None:
|
||||||
dataset = pydicom.dcmread(img)
|
with pydicom.dcmread(img) as ds:
|
||||||
|
dataset = ds
|
||||||
|
|
||||||
# TODO: improve?
|
# TODO: improve?
|
||||||
match hash_type:
|
match hash_type:
|
||||||
|
|||||||
Reference in New Issue
Block a user