Skip to content

Commit 1fc32c3

Browse files
author
Robert D. Vincent
committed
BF: use correct defaults for step in get_zooms().
1 parent a58ee03 commit 1fc32c3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

nibabel/minc1.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,15 @@ def get_data_shape(self):
9494

9595
def get_zooms(self):
9696
""" Get real-world sizes of voxels """
97+
result = []
9798
# zooms must be positive; but steps in MINC can be negative
98-
return tuple(
99-
[abs(float(dim.step)) for dim in self._dims])
99+
for dim in self._dims:
100+
try:
101+
x = abs(float(dim.step))
102+
except AttributeError:
103+
x = 1.0
104+
result.append(x)
105+
return tuple(result)
100106

101107
def get_affine(self):
102108
nspatial = len(self._spatial_dims)

0 commit comments

Comments
 (0)