Skip to content

Commit 7a0b5e3

Browse files
committed
FIX : dtype pb with annot on numpy 1.5.1
1 parent 548587e commit 7a0b5e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nibabel/freesurfer/io.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ def read_annot(filepath, orig_ids=False):
226226
ctab[i, 4] = (ctab[i, 0] + ctab[i, 1] * (2 ** 8) +
227227
ctab[i, 2] * (2 ** 16))
228228
ctab[:, 3] = 255
229+
230+
labels = labels.astype(np.int)
231+
229232
if not orig_ids:
230233
ord = np.argsort(ctab[:, -1])
231234
mask = labels != 0
@@ -270,9 +273,9 @@ def write_string(s):
270273
clut_labels[np.where(labels == -1)] = 0
271274

272275
# vno, label
273-
data = np.vstack((np.array(range(vnum)).astype(dt),
274-
clut_labels.astype(dt))).T
275-
data.byteswap().tofile(fobj)
276+
data = np.vstack((np.array(range(vnum)),
277+
clut_labels)).T.astype(dt)
278+
data.tofile(fobj)
276279

277280
# tag
278281
write(1)

0 commit comments

Comments
 (0)