try and allow loading jpg etc in new viewer
This commit is contained in:
+8
-2
@@ -14,6 +14,7 @@ from django.utils import timezone
|
||||
|
||||
import pydicom
|
||||
import pydicom.multival
|
||||
from pydicom.errors import InvalidDicomError
|
||||
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.conf import settings
|
||||
@@ -397,8 +398,11 @@ class SeriesImage(SeriesImageBase):
|
||||
|
||||
def get_extra_dicom_data(self):
|
||||
print(self.image)
|
||||
with pydicom.dcmread(self.image) as d:
|
||||
return d
|
||||
try:
|
||||
with pydicom.dcmread(self.image) as d:
|
||||
return d
|
||||
except InvalidDicomError:
|
||||
return {}
|
||||
|
||||
def get_image_dicom_json(self):
|
||||
try:
|
||||
@@ -406,6 +410,8 @@ class SeriesImage(SeriesImageBase):
|
||||
return extract_image_dicom_json_from_ds(ds, url=f"{REMOTE_URL}{self.image.url}")
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
except InvalidDicomError:
|
||||
return []
|
||||
|
||||
|
||||
class SeriesFinding(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user