Skip to content

Commit 8bf48a8

Browse files
committed
Fix errors that were crashing doc build
GH-#115 removed surfer.io.read_label but did not change the example that was referencing it. I'm surprised that got through Travis-- does Travis not build the docs? While fixing this I also noticed a couple of things that had gotten out of date and fixed an oversight from the config file removal.
1 parent 634cd6d commit 8bf48a8

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

examples/plot_morphometry.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
brain.add_morphometry("sulc", hemi='lh', grayscale=True)
3333

3434
"""
35-
The Brain object can only hold one morphometry
36-
overlay at a time, so adding a new one removes
37-
any existing overlays.
35+
You can also use a custom colormap and tweak its range.
3836
"""
39-
brain.add_morphometry("thickness")
37+
brain.add_morphometry("thickness",
38+
colormap="PuBuGn", min=1, max=4)

examples/plot_probabilistic_label.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
from os import environ
1212
from os.path import join
1313
import numpy as np
14-
from surfer import Brain, io
14+
from surfer import Brain
15+
from nibabel.freesurfer import read_label
1516

1617
print(__doc__)
1718

@@ -44,6 +45,6 @@
4445
label_file = join(subjects_dir, "fsaverage", "label", "lh.BA6.label")
4546

4647
prob_field = np.zeros_like(brain._geo.x)
47-
ids, probs = io.read_label(label_file, read_scalars=True)
48+
ids, probs = read_label(label_file, read_scalars=True)
4849
prob_field[ids] = probs
4950
brain.add_data(prob_field, thresh=1e-5, colormap="RdPu")

examples/plot_topographic_contours.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,6 @@
3939
contours and use a different line width.
4040
"""
4141
brain.add_contour_overlay(overlay_file,
42-
max=20,
43-
n_contours=9,
42+
min=2, max=20,
43+
n_contours=10,
4444
line_width=2)
45-
46-
"""
47-
At the moment, the Brain object itself does not expose an interface
48-
to manipulate what the contour overlay looks like after it has been
49-
loaded, but if you know a little bit about the underlying Mayavi
50-
engine, you can control aspects of the visualization through the
51-
contour dictionary attribute.
52-
"""
53-
brain.contour['surface'].actor.property.line_width = 1
54-
brain.contour['surface'].contour.number_of_contours = 10
55-
56-
"""
57-
We can save several different views of this hemisphere to one file.
58-
"""
59-
brain.save_montage('examples/fmri_activation.png', colorbar='auto')

surfer/viz.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ def _read_scalar_data(self, source, hemi, name=None, cast=True):
691691
return scalar_data, name
692692

693693
def _get_display_range(self, scalar_data, min, max, sign):
694+
694695
if scalar_data.min() >= 0:
695696
sign = "pos"
696697
elif scalar_data.max() <= 0:
@@ -705,12 +706,16 @@ def _get_display_range(self, scalar_data, min, max, sign):
705706
range_data = np.abs(scalar_data)
706707

707708
# Get a numeric value for the scalar minimum
709+
if min is None:
710+
min = "robust_min"
708711
if min == "robust_min":
709712
min = stats.scoreatpercentile(range_data, 2)
710713
elif min == "actual_min":
711714
min = range_data.min()
712715

713716
# Get a numeric value for the scalar maximum
717+
if max is None:
718+
max = "robust_max"
714719
if max == "robust_max":
715720
max = stats.scoreatpercentile(scalar_data, 98)
716721
elif max == "actual_max":

0 commit comments

Comments
 (0)