.
This commit is contained in:
+13
-5
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user