Skip to content

Commit 9a092d5

Browse files
committed
fix: py3k bytes reading for numpy
1 parent cc72b49 commit 9a092d5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nibabel/cifti/parse_cifti_fast.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,25 +308,25 @@ def flush_chardata(self):
308308
pair.value = data
309309
elif self.write_to == 'Vertices':
310310
# conversion to numpy array
311-
c = StringIO(data)
311+
c = StringIO(data.strip().decode('utf-8'))
312312
vertices = self.struct_state[-1]
313313
vertices.vertices = np.genfromtxt(c, dtype=np.int)
314314
c.close()
315315
elif self.write_to == 'VoxelIndices':
316316
# conversion to numpy array
317-
c = StringIO(data)
317+
c = StringIO(data.strip().decode('utf-8'))
318318
parent = self.struct_state[-1]
319319
parent.voxelIndicesIJK.indices = np.genfromtxt(c, dtype=np.int)
320320
c.close()
321321
elif self.write_to == 'VertexIndices':
322322
# conversion to numpy array
323-
c = StringIO(data)
323+
c = StringIO(data.strip().decode('utf-8'))
324324
index = self.struct_state[-1]
325325
index.indices = np.genfromtxt(c, dtype=np.int)
326326
c.close()
327327
elif self.write_to == 'TransformMatrix':
328328
# conversion to numpy array
329-
c = StringIO(data)
329+
c = StringIO(data.strip().decode('utf-8'))
330330
transform = self.struct_state[-1]
331331
transform.matrix = np.genfromtxt(c, dtype=np.float)
332332
c.close()

0 commit comments

Comments
 (0)