From fb2998baa9d729d1690c15fb063b3541c73d8a2a Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 21 Nov 2021 23:07:57 +0000 Subject: [PATCH] . --- rapids/models.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/rapids/models.py b/rapids/models.py index 878df523..9c03cac7 100644 --- a/rapids/models.py +++ b/rapids/models.py @@ -461,11 +461,19 @@ class RapidImage(models.Model): # TODO: improve? dataset = pydicom.dcmread(self.image) print(dataset) - flatten = dataset.pixel_array.astype(str).flatten() - print("flatteded") - pre_join = ",".join(flatten).encode() - print(pre_join) - hash = hashlib.md5(pre_join).hexdigest() + #flatten = dataset.pixel_array.astype(str).flatten() + #print("flatteded") + #pre_join = ",".join(flatten) + #print(pre_join) + #hash = hashlib.md5(pre_join.encode()).hexdigest() + md5 = hashlib.md5() + for i in dataset.pixel_array.flatten(): + md5.update(f"{str(i)},".encode()) + print(0) + + hash = md5.hexdigest() + + print(1) self.is_dicom = True except pydicom.errors.InvalidDicomError: