Skip to content

Commit 6ffeeac

Browse files
author
manifest-rules
committed
RF: Make sure that ASCII-encoded DataArrays are returned with expected shape
1 parent 79792de commit 6ffeeac

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

nibabel/gifti/parse_gifti_fast.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ def read_data_block(darray, fname, data, mmap):
7474
# GIFTI_ENCODING_ASCII
7575
c = StringIO(data)
7676
da = np.loadtxt(c, dtype=dtype)
77+
# Reshape to dims specified in GiftiDataArray attributes, but preserve
78+
# existing behaviour of loading as 1D for arrays with a dimension of
79+
# length 1
80+
da = da.reshape(darray.dims).squeeze()
7781
return da # independent of the endianness
7882
elif enclabel not in ('B64BIN', 'B64GZ', 'External'):
7983
return 0

0 commit comments

Comments
 (0)