Skip to content

Commit 3951b58

Browse files
author
Stephan Gerhard
committed
ENH - Add missing test
1 parent 3739189 commit 3951b58

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

nibabel/gifti/tests/test_giftiio.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
DATA_FILE3 = pjoin(IO_DATA_PATH, 'label.gii')
3434
DATA_FILE4 = pjoin(IO_DATA_PATH, 'rh.shape.curv.gii')
3535
DATA_FILE5 = pjoin(IO_DATA_PATH, 'base64bin.gii')
36+
DATA_FILE6 = pjoin(IO_DATA_PATH, 'rh.aparc.annot.gii')
3637

37-
datafiles = [DATA_FILE1, DATA_FILE2, DATA_FILE3, DATA_FILE4, DATA_FILE5]
38-
numda = [2, 1, 1, 1, 2]
38+
datafiles = [DATA_FILE1, DATA_FILE2, DATA_FILE3, DATA_FILE4, DATA_FILE5, DATA_FILE6]
39+
numda = [2, 1, 1, 1, 2, 1]
3940

4041
DATA_FILE1_darr1 = np.array(
4142
[[-16.07201 , -66.187515, 21.266994],
@@ -66,6 +67,8 @@
6667
[-0.48011276],
6768
[-0.45624232],
6869
[-0.31101292]], dtype=np.float32)
70+
71+
DATA_FILE6_darr1 = np.array([9182740, 9182740, 9182740], dtype=np.float32)
6972

7073
DATA_FILE5_darr1 = np.array([[ 155.17539978, 135.58103943, 98.30715179],
7174
[ 140.33973694, 190.0491333 , 73.24776459],
@@ -181,3 +184,16 @@ def test_getbyintent():
181184
assert_equal(len(da), 0)
182185
assert_equal(da, [])
183186

187+
def test_labeltable():
188+
img = gi.read(DATA_FILE6)
189+
assert_array_almost_equal(img.darrays[0].data[:3], DATA_FILE6_darr1)
190+
assert_equal(len(img.labeltable.labels), 36)
191+
labeldict = img.labeltable.get_labels_as_dict()
192+
assert_true(labeldict.has_key(660700))
193+
assert_equal(labeldict[660700], u'entorhinal')
194+
assert_equal(img.labeltable.labels[1].key, 2647065)
195+
assert_equal(img.labeltable.labels[1].red, 0.0980392)
196+
assert_equal(img.labeltable.labels[1].green, 0.392157)
197+
assert_equal(img.labeltable.labels[1].blue, 0.156863)
198+
assert_equal(img.labeltable.labels[1].alpha, 1)
199+

0 commit comments

Comments
 (0)