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
|
||||||
import pydicom.multival
|
import pydicom.multival
|
||||||
|
from pydicom.errors import InvalidDicomError
|
||||||
|
|
||||||
from django.core.files.storage import FileSystemStorage
|
from django.core.files.storage import FileSystemStorage
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -397,8 +398,11 @@ class SeriesImage(SeriesImageBase):
|
|||||||
|
|
||||||
def get_extra_dicom_data(self):
|
def get_extra_dicom_data(self):
|
||||||
print(self.image)
|
print(self.image)
|
||||||
with pydicom.dcmread(self.image) as d:
|
try:
|
||||||
return d
|
with pydicom.dcmread(self.image) as d:
|
||||||
|
return d
|
||||||
|
except InvalidDicomError:
|
||||||
|
return {}
|
||||||
|
|
||||||
def get_image_dicom_json(self):
|
def get_image_dicom_json(self):
|
||||||
try:
|
try:
|
||||||
@@ -406,6 +410,8 @@ class SeriesImage(SeriesImageBase):
|
|||||||
return extract_image_dicom_json_from_ds(ds, url=f"{REMOTE_URL}{self.image.url}")
|
return extract_image_dicom_json_from_ds(ds, url=f"{REMOTE_URL}{self.image.url}")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return []
|
return []
|
||||||
|
except InvalidDicomError:
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
class SeriesFinding(models.Model):
|
class SeriesFinding(models.Model):
|
||||||
|
|||||||
Reference in New Issue
Block a user