Skip to content

Commit 63b7a52

Browse files
committed
TEST: Verify we can write files with repeated labels
1 parent c639d9a commit 63b7a52

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

nibabel/freesurfer/tests/test_io.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,3 +356,17 @@ def test_label():
356356
labels, scalars = read_label(label_path, True)
357357
assert_true(np.all(labels == label))
358358
assert_true(len(labels) == len(scalars))
359+
360+
361+
def test_write_annot_maxstruct():
362+
"""Verify we can write files with repeated labels - test by reading"""
363+
with InTemporaryDirectory():
364+
nlabels = 3
365+
names = ['label {}'.format(l) for l in range(1, nlabels + 1)]
366+
# max label < n_labels
367+
labels = np.array([1, 1, 1], dtype=np.int32)
368+
rgba = np.array(np.random.randint(0, 255, (nlabels, 4)), dtype=np.int32)
369+
annot_path = 'c.annot'
370+
371+
write_annot(annot_path, labels, rgba, names)
372+
read_annot(annot_path)

0 commit comments

Comments
 (0)