test_annotation.py 1.0 KB

1234567891011121314151617181920
  1. import os
  2. from freesurfer_surface import Annotation
  3. from conftest import SUBJECTS_DIR
  4. def test_load_annotation():
  5. annotation = Annotation.read(os.path.join(SUBJECTS_DIR, 'fabian', 'label', 'lh.aparc.annot'))
  6. assert len(annotation.vertex_values) == 155622
  7. assert annotation.vertex_values[0] == (((100 << 8) + 20) << 8) + 220
  8. assert annotation.vertex_values[1] == (((100 << 8) + 20) << 8) + 220
  9. assert annotation.vertex_values[42] == (((140 << 8) + 30) << 8) + 20
  10. assert annotation.colortable_path == b'/autofs/space/tanha_002/users/greve' \
  11. b'/fsdev.build/average/colortable_desikan_killiany.txt'
  12. assert len(annotation.labels) == 36
  13. assert vars(annotation.labels[0]) == {'index': 0, 'name': 'unknown',
  14. 'red': 25, 'blue': 5, 'green': 25, 'transparency': 0}
  15. assert vars(annotation.labels[35]) == {'index': 35, 'name': 'insula',
  16. 'red': 255, 'blue': 192, 'green': 32, 'transparency': 0}