Skip to content

Fix errors that were crashing doc build #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions examples/plot_morphometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
brain.add_morphometry("sulc", hemi='lh', grayscale=True)

"""
The Brain object can only hold one morphometry
overlay at a time, so adding a new one removes
any existing overlays.
You can also use a custom colormap and tweak its range.
"""
brain.add_morphometry("thickness")
brain.add_morphometry("thickness",
colormap="PuBuGn", min=1, max=4)
5 changes: 3 additions & 2 deletions examples/plot_probabilistic_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from os import environ
from os.path import join
import numpy as np
from surfer import Brain, io
from surfer import Brain
from nibabel.freesurfer import read_label

print(__doc__)

Expand Down Expand Up @@ -44,6 +45,6 @@
label_file = join(subjects_dir, "fsaverage", "label", "lh.BA6.label")

prob_field = np.zeros_like(brain._geo.x)
ids, probs = io.read_label(label_file, read_scalars=True)
ids, probs = read_label(label_file, read_scalars=True)
prob_field[ids] = probs
brain.add_data(prob_field, thresh=1e-5, colormap="RdPu")
19 changes: 2 additions & 17 deletions examples/plot_topographic_contours.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@
contours and use a different line width.
"""
brain.add_contour_overlay(overlay_file,
max=20,
n_contours=9,
min=2, max=20,
n_contours=10,
line_width=2)

"""
At the moment, the Brain object itself does not expose an interface
to manipulate what the contour overlay looks like after it has been
loaded, but if you know a little bit about the underlying Mayavi
engine, you can control aspects of the visualization through the
contour dictionary attribute.
"""
brain.contour['surface'].actor.property.line_width = 1
brain.contour['surface'].contour.number_of_contours = 10

"""
We can save several different views of this hemisphere to one file.
"""
brain.save_montage('examples/fmri_activation.png', colorbar='auto')
5 changes: 5 additions & 0 deletions surfer/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ def _read_scalar_data(self, source, hemi, name=None, cast=True):
return scalar_data, name

def _get_display_range(self, scalar_data, min, max, sign):

if scalar_data.min() >= 0:
sign = "pos"
elif scalar_data.max() <= 0:
Expand All @@ -705,12 +706,16 @@ def _get_display_range(self, scalar_data, min, max, sign):
range_data = np.abs(scalar_data)

# Get a numeric value for the scalar minimum
if min is None:
min = "robust_min"
if min == "robust_min":
min = stats.scoreatpercentile(range_data, 2)
elif min == "actual_min":
min = range_data.min()

# Get a numeric value for the scalar maximum
if max is None:
max = "robust_max"
if max == "robust_max":
max = stats.scoreatpercentile(scalar_data, 98)
elif max == "actual_max":
Expand Down