File: plot_parcellation.py

package info (click to toggle)
pysurfer 0.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 16,352 kB
  • sloc: python: 4,786; makefile: 141; sh: 10
file content (46 lines) | stat: -rw-r--r-- 1,214 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Using Annotation Files
======================

Display a Freesurfer cortical parcellation from an annotation file.

"""
import os
from os.path import join as pjoin
from surfer import Brain

print(__doc__)

subject_id = 'fsaverage'
hemi = 'both'
surf = 'inflated'
view = 'frontal'

"""
Bring up the visualization
"""
brain = Brain(subject_id, hemi, surf, views=view,
              cortex="bone", background="ivory")

"""
Display the 'aparc' parcellation borders.
To use annotations that live in your subject's
label directory, just use the annot name.
"""
brain.add_annotation("aparc")

"""
You can also display the regions with "filled in" colors
"""
brain.add_annotation("aparc", borders=False)

"""
You may also provide a full path to an annotation file
at an arbitray location on the disc. You can also
plot things separately for the left and right hemispheres.
"""
subjects_dir = os.environ["SUBJECTS_DIR"]
annot_path = pjoin(subjects_dir, subject_id, "label", "lh.aparc.annot")
brain.add_annotation(annot_path, hemi='lh', borders=False, alpha=.75)
annot_path = pjoin(subjects_dir, subject_id, "label", "rh.aparc.a2009s.annot")
brain.add_annotation(annot_path, hemi='rh', borders=2, remove_existing=False)