Skip to content

Commit 3351d16

Browse files
committed
FIX: ECAT data must be coerced after reading
1 parent 70987fb commit 3351d16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nibabel/ecat.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,13 @@ def __array__(self, dtype=None):
708708
Scaled image data with type `dtype`.
709709
'''
710710
# dtype=None is interpreted as float64
711-
data = np.empty(self.shape, dtype=dtype)
711+
data = np.empty(self.shape)
712712
frame_mapping = get_frame_order(self._subheader._mlist)
713713
for i in sorted(frame_mapping):
714714
data[:, :, :, i] = self._subheader.data_from_fileobj(
715715
frame_mapping[i][0])
716+
if dtype is not None:
717+
data = data.astype(dtype, copy=False)
716718
return data
717719

718720
def __getitem__(self, sliceobj):

0 commit comments

Comments
 (0)