Skip to content

Commit 62c56fe

Browse files
BF: ensure that voxel indices have the correct shape
Some CIFTI files write all voxel indices on the same line, leading to a 1D array. This bug fix ensures that nibabel will not crash when reading those files.
1 parent badbbca commit 62c56fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nibabel/cifti2/parse_cifti2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def flush_chardata(self):
547547
# conversion to numpy array
548548
c = BytesIO(data.strip().encode('utf-8'))
549549
parent = self.struct_state[-1]
550-
parent.voxel_indices_ijk.extend(np.genfromtxt(c, dtype=np.int))
550+
parent.voxel_indices_ijk.extend(np.genfromtxt(c, dtype=np.int).reshape(-1, 3))
551551
c.close()
552552

553553
elif self.write_to == 'VertexIndices':

0 commit comments

Comments
 (0)