Skip to content

Commit 2d63f5a

Browse files
committed
MAINT: change sort_info to an OrderedDict to enforce a consistent ordering for a given .PAR file
1 parent 80c5a7c commit 2d63f5a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nibabel/parrec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
import re
9696
from io import StringIO
9797
from locale import getpreferredencoding
98+
from collections import OrderedDict
9899

99100
from .keywordonly import kw_only_meth
100101
from .spatialimages import SpatialHeader, SpatialImage
@@ -1160,7 +1161,7 @@ def get_volume_labels(self):
11601161
# the value at slice 1.
11611162
sl1_indices = image_defs['slice number'][sorted_indices] == 1
11621163

1163-
sort_info = {}
1164+
sort_info = OrderedDict(non_unique_keys)
11641165
for key in non_unique_keys:
11651166
sort_info[key] = image_defs[key][sorted_indices][sl1_indices]
11661167
return sort_info

0 commit comments

Comments
 (0)