|
1 | 1 | """
|
2 |
| -============================================ |
3 |
| -Plot a label generated at an activation foci |
4 |
| -============================================ |
| 2 | +======================= |
| 3 | +Generate Surface Labels |
| 4 | +======================= |
5 | 5 |
|
6 |
| -Plot a spheroid at a position on the surface manifold |
7 |
| -according to an MNI coordinate, generate a label |
8 |
| -around it and plot it. |
| 6 | +Define a label that is centered on a specific vertex in the surface mesh. Plot |
| 7 | +that label and the focus that defines its center. |
9 | 8 |
|
10 | 9 | """
|
11 | 10 | print __doc__
|
12 | 11 |
|
13 |
| -import os |
14 | 12 | from surfer import Brain, utils
|
15 | 13 |
|
16 | 14 | subject_id = "fsaverage"
|
17 |
| -subjects_dir = os.environ["SUBJECTS_DIR"] |
18 | 15 |
|
19 | 16 | """
|
20 | 17 | Bring up the visualization.
|
21 | 18 | """
|
22 | 19 | brain = Brain(subject_id, "lh", "inflated")
|
23 | 20 |
|
24 | 21 | """
|
25 |
| -First we'll get a set of stereotaxic foci in the MNI |
26 |
| -coordinate system. These might be peak activations from |
27 |
| -a volume based analysis. |
| 22 | +First we'll identify a stereotaxic focus in the MNI coordinate system. This |
| 23 | +might be a peak activations from a volume based analysis. |
28 | 24 | """
|
29 | 25 | coord = [-43, 25, 24]
|
30 | 26 |
|
| 27 | +""" |
| 28 | +Next we grow a label along the surface around the neareset vertex to this |
| 29 | +coordinate in the white surface mesh. The `n_steps` argument controls the size |
| 30 | +of the resulting label. |
| 31 | +""" |
31 | 32 | utils.coord_to_label(subject_id, coord, label='example_data/coord',
|
32 |
| - hemi='lh', n_steps=50, map_surface="white") |
33 |
| -brain.add_label('example_data/coord-lh.label') |
| 33 | + hemi='lh', n_steps=25, map_surface="white") |
| 34 | +brain.add_label('example_data/coord-lh.label', color="darkseagreen", alpha=.8) |
34 | 35 |
|
35 | 36 | """
|
36 |
| -Now we plot the foci on the inflated surface. We will map |
37 |
| -the foci onto the surface by finding the vertex on the "white" |
38 |
| -mesh that is closest to the coordinate of the point we want |
39 |
| -to display. |
| 37 | +Now we plot the focus on the inflated surface at the vertex identified in the |
| 38 | +previous step. |
40 | 39 | """
|
41 |
| -brain.add_foci([coord], map_surface="white", color="gold") |
| 40 | +brain.add_foci([coord], map_surface="white", color="mediumseagreen") |
42 | 41 |
|
43 | 42 | """
|
44 |
| -or using a vertex index |
| 43 | +We can also do this using a vertex index, perhaps defined as the peak |
| 44 | +activation in a surface analysis. This will be more accurate than using a |
| 45 | +volume-based focus. |
45 | 46 | """
|
46 | 47 | coord = 0
|
47 | 48 |
|
48 | 49 | utils.coord_to_label(subject_id, coord, label='example_data/coord',
|
49 |
| - hemi='lh', n_steps=50, map_surface="white", |
| 50 | + hemi='lh', n_steps=40, map_surface="white", |
50 | 51 | coord_as_vert=True)
|
51 |
| -brain.add_label('example_data/coord-lh.label', color='blue') |
| 52 | +brain.add_label('example_data/coord-lh.label', color='royalblue', alpha=.8) |
| 53 | + |
| 54 | +""" |
| 55 | +Now we plot the foci on the inflated surface. We will map the foci onto the |
| 56 | +surface by finding the vertex on the "white" mesh that is closest to the |
| 57 | +coordinate of the point we want to display. |
| 58 | +""" |
| 59 | +brain.add_foci([coord], map_surface="white", coords_as_verts=True, |
| 60 | + color="mediumblue") |
52 | 61 |
|
53 | 62 | """
|
54 |
| -Now we plot the foci on the inflated surface. We will map |
55 |
| -the foci onto the surface by finding the vertex on the "white" |
56 |
| -mesh that is closest to the coordinate of the point we want |
57 |
| -to display. |
| 63 | +Set the camera position to show the extent of the labels. |
58 | 64 | """
|
59 |
| -brain.add_foci([coord], map_surface="white", color="red", coords_as_verts=True) |
| 65 | +brain.show_view(dict(elevation=40, distance=430)) |
0 commit comments