Skip to content

Commit

Permalink
[BUG] Improve DICOMSeries ordering logic (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandede authored Mar 18, 2024
1 parent 085ce27 commit 259c545
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion imageio/plugins/_dicom.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,12 @@ def _append(self, dcm):
self._entries.append(dcm)

def _sort(self):
self._entries.sort(key=lambda k: k.InstanceNumber)
self._entries.sort(
key=lambda k: (
k.InstanceNumber,
getattr(k, "ImagePositionPatient[2]", None),
)
)

def _finish(self):
"""
Expand Down

0 comments on commit 259c545

Please sign in to comment.