We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b99ae4c commit 0e106e9Copy full SHA for 0e106e9
nibabel/nifti1.py
@@ -2014,13 +2014,10 @@ def as_reoriented(self, ornt):
2014
return img
2015
2016
# Also apply the transform to the dim_info fields
2017
- new_dim = list(img.header.get_dim_info())
2018
- for idx, value in enumerate(new_dim):
2019
- # For each value, leave as None if it was that way,
2020
- # otherwise check where we have mapped it to
2021
- if value is None:
2022
- continue
2023
- new_dim[idx] = np.where(ornt[:, 0] == idx)[0]
+ orig_dim_info = img.header.get_dim_info()
+ new_dim = [None] * 3
+ for idx in range(3):
+ new_dim[int(ornt[idx][0])] = orig_dim_info[idx]
2024
2025
img.header.set_dim_info(*new_dim)
2026
0 commit comments