diff --git a/atlas/models.py b/atlas/models.py
index cd31a5d7..46dc5a6a 100644
--- a/atlas/models.py
+++ b/atlas/models.py
@@ -1326,7 +1326,7 @@ class UncategorisedDicom(models.Model):
def get_dicom_info(self):
try:
- ds = pydicom.read_file(self.image)
+ ds = pydicom.dcmread(self.image)
return ds
except pydicom.errors.InvalidDicomError:
return {"SeriesInstanceUID": "1234"}
diff --git a/atlas/tables.py b/atlas/tables.py
index 29345ec2..94ce192e 100755
--- a/atlas/tables.py
+++ b/atlas/tables.py
@@ -65,6 +65,7 @@ class CaseTable(tables.Table):
"author",
)
sequence = ("view", )#, "series")
+ order_by = "-created_date"
def __init__(self, data=None, *args, **kwargs):
super().__init__(
@@ -125,6 +126,7 @@ class SeriesTable(tables.Table):
"modified_date",
)
sequence = ("view", "popup", "images", "case")
+ order_by = "-created_date"
def __init__(self, data=None, *args, **kwargs):
super().__init__(
diff --git a/atlas/templates/atlas/base.html b/atlas/templates/atlas/base.html
index 3f474304..e37b039a 100755
--- a/atlas/templates/atlas/base.html
+++ b/atlas/templates/atlas/base.html
@@ -8,7 +8,7 @@
Atlas:
{% if request.user.is_authenticated %}
Collections /
- Cases /
+ Cases /
Series /
Categories /
{% comment %} Resources / {% endcomment %}
diff --git a/generic/models.py b/generic/models.py
index 0a040113..cb9bcc4d 100644
--- a/generic/models.py
+++ b/generic/models.py
@@ -488,13 +488,18 @@ class SeriesBase(models.Model):
n = n + 1
def order_by_dicom(self, field="SliceLocation"):
+ print(f"Ordering by dicom field {field}")
images = self.images.filter(removed=False)
+
files = []
for i in images:
files.append((i, pydicom.dcmread(i.image.path)))
+ print("images to order")
+ print(files)
+
# print("file count: {}".format(len(files)))
# skip files with no SliceLocation (eg scout views)
@@ -522,6 +527,7 @@ class SeriesBase(models.Model):
for f in slices:
i = map[f[field].value]
i.position = n
+ print(f"Setting position {n} for {i}")
i.save()
n = n + 1