order atlas tables by creation date by default
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user