소스 검색

readme: added python example on how to list labels

Fabian Peter Hammerle 5 년 전
부모
커밋
069514eb23
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      README.md

+ 11 - 1
README.md

@@ -1,6 +1,16 @@
 ## Usage
 
-### List Labels in Annotation Files
+### List Labels in Annotation File
+
+```python
+from freesurfer_surface import Annotation
+
+annotation = Annotation.read('tests/subjects/fabian/label/lh.aparc.annot')
+for label in annotation.labels.values():
+    print(label.index, label.hex_color_code, label.name)
+```
+
+or
 
 ```sh
 $ freesurfer-annotation-labels tests/subjects/fabian/label/lh.aparc.annot