.
This commit is contained in:
+13
-5
@@ -461,11 +461,19 @@ class RapidImage(models.Model):
|
|||||||
# TODO: improve?
|
# TODO: improve?
|
||||||
dataset = pydicom.dcmread(self.image)
|
dataset = pydicom.dcmread(self.image)
|
||||||
print(dataset)
|
print(dataset)
|
||||||
flatten = dataset.pixel_array.astype(str).flatten()
|
#flatten = dataset.pixel_array.astype(str).flatten()
|
||||||
print("flatteded")
|
#print("flatteded")
|
||||||
pre_join = ",".join(flatten).encode()
|
#pre_join = ",".join(flatten)
|
||||||
print(pre_join)
|
#print(pre_join)
|
||||||
hash = hashlib.md5(pre_join).hexdigest()
|
#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
|
self.is_dicom = True
|
||||||
except pydicom.errors.InvalidDicomError:
|
except pydicom.errors.InvalidDicomError:
|
||||||
|
|||||||
Reference in New Issue
Block a user