Skip to content

Commit 723a10a

Browse files
committed
Add example of plotting Freesurfer normalization
1 parent e241747 commit 723a10a

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
522 KB
Binary file not shown.
527 KB
Binary file not shown.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Plot Freesurfer Normalization
3+
=============================
4+
5+
This example shows how PySurfer can be used to examine the quality of
6+
Freesurfer's curvature-driven normalization to a common template.
7+
8+
We are going to plot the contour of the subject's curvature estimate after
9+
transforming that map into the common space (this step is performed outside
10+
of PySurfer using the Freesurfer program ``mri_surf2surf``).
11+
12+
With a perfect transformation, the contour lines should follow the light/dark
13+
gray boundary on the fsaverage surface. Large deviations may reflect problems
14+
with the underlying data that you should investigate.
15+
16+
"""
17+
import nibabel as nib
18+
from surfer import Brain
19+
20+
brain = Brain("fsaverage", "both", "inflated")
21+
22+
for hemi in ["lh", "rh"]:
23+
24+
# This file was created with mri_surf2surf
25+
curv = nib.load("example_data/%s.curv.fsaverage.mgz" % hemi)
26+
27+
# Binarize the curvature at 0
28+
curv_bin = (curv.get_data() > 0).squeeze()
29+
30+
# Add the data as a contour overlay, but turn off the colorbar
31+
brain.add_contour_overlay(curv_bin, 0, 1.15, 2, 3, hemi=hemi)
32+
brain.contour_list[-1]["colorbar"].visible = False
33+
34+
brain.show_view("dorsal")

0 commit comments

Comments
 (0)