From 5397e3a4533e1dc555b6ee513c56770219ef5d84 Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 21 Nov 2021 11:15:57 +0000 Subject: [PATCH] . --- rapids/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rapids/models.py b/rapids/models.py index b8873759..fbe29db7 100644 --- a/rapids/models.py +++ b/rapids/models.py @@ -458,7 +458,8 @@ class RapidImage(models.Model): # Try and read the file as a dicom try: # and generate a hash from the pixel data - hash = hashlib.md5(",".join(pydicom.dcmread(self.image.path).pixel_array.tostring())).hexdigest() + dataset = pydicom.dcmread(self.image) + hash = hashlib.md5(",".join(dataset.pixel_array.tostring())).hexdigest() self.is_dicom = True except pydicom.errors.InvalidDicomError: self.image.file.open()