Skip to content

MAINT: Update fsaverage #270

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 12 commits into from
Jun 26, 2019
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
41 changes: 20 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
echo "export DISPLAY=:99" >> $BASH_ENV;
echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV;
echo "export PATH=~/.local/bin:$PATH" >> $BASH_ENV;
echo "export PATTERN=\"plot_\(?\!fmri_activation_volume\|resting_correlations\)\"" >> $BASH_ENV;
- run:
name: Merge with upstream
command: |
Expand All @@ -25,12 +26,6 @@ jobs:
git fetch upstream master;
fi

# Load our data
- restore_cache:
keys:
- data-cache-0
- pip-cache

- run:
name: Spin up Xvfb
command: |
Expand All @@ -43,11 +38,18 @@ jobs:
command: |
sudo apt-get install qt5-default

# Load our data
- restore_cache:
keys:
- data-cache-0
- pip-cache

- run:
name: Get Python running
command: |
pip install --user -q --upgrade pip numpy
pip install --user -q --upgrade --progress-bar off scipy matplotlib vtk pyqt5 pyqt5-sip nibabel sphinx numpydoc pillow imageio imageio-ffmpeg https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master mayavi
pip install --user -q --upgrade --progress-bar off scipy matplotlib vtk pyqt5 pyqt5-sip nibabel sphinx numpydoc pillow imageio imageio-ffmpeg sphinx-gallery
pip install --user -q --upgrade mayavi "https://api.github.com/repos/mne-tools/mne-python/zipball/master"
- save_cache:
key: pip-cache
paths:
Expand All @@ -58,18 +60,19 @@ jobs:
name: Check installation
command: |
LIBGL_DEBUG=verbose python -c "from mayavi import mlab; import matplotlib.pyplot as plt; mlab.figure(); plt.figure()"
echo $SUBJECTS_DIR

- run:
name: Get data
command: |
if [ ! -d $SUBJECTS_DIR ]; then
mkdir $SUBJECTS_DIR;
cd $SUBJECTS_DIR;
wget http://faculty.washington.edu/larsoner/fsaverage_min.zip;
unzip fsaverage_min.zip;
rm fsaverage_min.zip;
fi;
echo $SUBJECTS_DIR
mkdir -p $SUBJECTS_DIR
python -c "import mne; mne.datasets.fetch_fsaverage(verbose=True)"
ls $SUBJECTS_DIR
- save_cache:
key: data-cache-0
paths:
- "~/subjects"

- run:
name: Install PySurfer
command: |
Expand All @@ -79,21 +82,17 @@ jobs:
name: Build docs
command: |
cd doc
sphinx-build -D plot_gallery=1 -D sphinx_gallery_conf.filename_pattern=^\(\(?\!plot_fmri_activation_volume\|plot_morphometry\|plot_label\.py\|plot_probabilistic_label\|plot_resting_correlations\|plot_transparent_brain\|rotate_animation\|save_movie\|save_views\).\)*\$ -b html -d _build/doctrees . _build/html
echo $PATTERN
make html_dev-pattern

- store_artifacts:
path: doc/_build/html/
destination: html

- save_cache:
key: data-cache-0
paths:
- "~/subjects"

workflows:
version: 2

default:
jobs:
- build_docs

36 changes: 13 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
language: c
sudo: false

dist: xenial
services:
- xvfb
env:
global: PYTHON_VERSION=3.7
CONDA_DEPENDENCIES="numpy scipy matplotlib pyqt>=5.9 coverage pytest pytest-cov flake8 pygments traits traitsui pyface"
PIP_DEPENDENCIES="codecov pytest-sugar pytest-faulthandler nibabel imageio imageio-ffmpeg"
DISPLAY=:99.0
SUBJECTS_DIR=~/subjects

matrix:
include:
Expand All @@ -16,11 +19,11 @@ matrix:
packages:
- mencoder

# 2.7, no mencoder
# 3.5, no mencoder
- os: linux
env: PYTHON_VERSION=2.7
CONDA_DEPENDENCIES="numpy scipy matplotlib coverage pytest pytest-cov flake8 mayavi"
PIP_DEPENDENCIES="codecov pytest-sugar faulthandler pytest-faulthandler nibabel imageio"
env: PYTHON_VERSION=3.5
CONDA_DEPENDENCIES="numpy scipy matplotlib coverage pytest pytest-cov flake8"
PIP_DEPENDENCIES="codecov pytest-sugar nibabel imageio imageio-ffmpeg"

# OSX
- os: osx
Expand All @@ -32,32 +35,19 @@ before_install:
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
unset -f cd;
fi;
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
echo "Starting Xvfb...";
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render;
fi;
- git clone https://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda.sh
- if [ "$PYTHON_VERSION" != "2.7" ]; then
pip install vtk;
pip install mayavi;
fi;
- pip install vtk
- pip install mayavi
- mkdir -p $SUBJECTS_DIR
- pip install "https://api.github.com/repos/mne-tools/mne-python/zipball/master"
- python -c "import mne; mne.datasets.fetch_fsaverage(verbose=True)"

install:
- python setup.py build
- python setup.py install
- SRC_DIR=$(pwd)

before_script:
# Let's create a (fake) display on Travis, and let's use a funny resolution
- cd ~
- wget --quiet http://faculty.washington.edu/larsoner/fsaverage_min.zip
- mkdir subjects
- cd subjects
- unzip ../fsaverage_min.zip
- cd ..
- export SUBJECTS_DIR="${PWD}/subjects"

script:
- cd ${SRC_DIR}
- pytest surfer --cov=surfer -v
Expand Down
4 changes: 2 additions & 2 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXOPTS = -nWT --keep-going
SPHINXBUILD = sphinx-build
PAPER =
GPAPER =
BUILDDIR = _build

# Internal variables.
Expand Down
26 changes: 10 additions & 16 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
]

autosummary_generate = True
autodoc_default_flags = ['inherited-members']
autodoc_default_options = {'inherited-members': None}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -250,10 +250,10 @@
# 'python': ('http://docs.python.org/', None),
# 'numpy': ('http://docs.scipy.org/doc/numpy-dev/', None),
# 'scipy': ('http://scipy.github.io/devdocs/', None),
'matplotlib': ('http://matplotlib.org', None),
'imageio': ('http://imageio.readthedocs.io/en/latest', None),
'mayavi': ('http://docs.enthought.com/mayavi/mayavi', None),
'nibabel': ('http://nipy.org/nibabel', None),
'matplotlib': ('https://matplotlib.org', None),
'imageio': ('https://imageio.readthedocs.io/en/latest', None),
'mayavi': ('https://docs.enthought.com/mayavi/mayavi', None),
'nibabel': ('https://nipy.org/nibabel', None),
}

# One entry per manual page. List of tuples
Expand All @@ -268,31 +268,25 @@

try:
from mayavi import mlab
find_mayavi_figures = True
# Do not pop up any mayavi windows while running the
# examples. These are very annoying since they steal the focus.
mlab.options.offscreen = True
scrapers = ('matplotlib', 'mayavi')
except Exception:
find_mayavi_figures = False
scrapers = ('matplotlib',)

sphinx_gallery_conf = {
'doc_module': ('surfer',),
'reference_url': {
'surfer': None,
'matplotlib': 'http://matplotlib.org',
'numpy': 'http://docs.scipy.org/doc/numpy',
'scipy': 'http://docs.scipy.org/doc/scipy/reference',
'mayavi': 'http://docs.enthought.com/mayavi/mayavi',
},
'reference_url': {'surfer': None},
'examples_dirs': examples_dirs,
'gallery_dirs': gallery_dirs,
'within_subsection_order': FileNameSortKey,
'find_mayavi_figures': find_mayavi_figures,
'image_scrapers': scrapers,
'default_thumb_file': os.path.join('_static', 'pysurfer_logo_small.png'),
'backreferences_dir': 'generated',
'download_section_examples': False,
'thumbnail_size': (250, 250),
}
}

numpydoc_class_members_toctree = False
numpydoc_show_inherited_class_members = False
Expand Down
3 changes: 0 additions & 3 deletions doc/documentation/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,3 @@ Other command-line options
As in tksurfer, most aspects of the visualization can be initialized
from the command-line. To get a full documentation of the command-line
interface, simply type ``pysurfer`` at a terminal prompt and hit enter.
For convenience, this usage message is reproduced below.

.. literalinclude:: pysurfer_usage.txt
16 changes: 8 additions & 8 deletions examples/plot_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@

# If the label lives in the normal place in the subjects directory,
# you can plot it by just using the name
brain.add_label("BA1_exvivo")
brain.add_label("BA1")

# Some labels have an associated scalar value at each ID in the label.
# For example, they may be probabilistically defined. You can threshold
# what vertices show up in the label using this scalar data
brain.add_label("BA1_exvivo", color="blue", scalar_thresh=.5)
brain.add_label("BA1", color="blue", scalar_thresh=.5)

# Or you can give a path to a label in an arbitrary location
subj_dir = brain.subjects_dir
label_file = os.path.join(subj_dir, subject_id,
"label", "%s.MT_exvivo.label" % hemi)
"label", "%s.MT.label" % hemi)
brain.add_label(label_file)

# By default the label is 'filled-in', but you can
# plot just the label boundaries
brain.add_label("BA44_exvivo", borders=True)
brain.add_label("BA44", borders=True)

# You can also control the opacity of the label color
brain.add_label("BA6_exvivo", alpha=.7)
brain.add_label("BA6", alpha=.7)

# Finally, you can plot the label in any color you want.
brain.show_view(dict(azimuth=-42, elevation=105, distance=225,
focalpoint=[-30, -20, 15]))

# Use any valid matplotlib color.
brain.add_label("V1_exvivo", color="steelblue", alpha=.6)
brain.add_label("V2_exvivo", color="#FF6347", alpha=.6)
brain.add_label("entorhinal_exvivo", color=(.2, 1, .5), alpha=.6)
brain.add_label("V1", color="steelblue", alpha=.6)
brain.add_label("V2", color="#FF6347", alpha=.6)
brain.add_label("entorhinal", color=(.2, 1, .5), alpha=.6)
10 changes: 5 additions & 5 deletions examples/plot_probabilistic_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@
The easiest way to label any vertex that could be in the region is with
add_label.
"""
brain.add_label("BA1_exvivo", color="#A6BDDB")
brain.add_label("BA1", color="#A6BDDB")

"""
You can also threshold based on the probability of that region being at each
vertex.
"""
brain.add_label("BA1_exvivo", color="#2B8CBE", scalar_thresh=.5)
brain.add_label("BA1", color="#2B8CBE", scalar_thresh=.5)

"""
It's also possible to plot just the label boundary, in case you wanted to
overlay the label on an activation plot to asses whether it falls within that
region.
"""
brain.add_label("BA45_exvivo", color="#F0F8FF", borders=3, scalar_thresh=.5)
brain.add_label("BA45_exvivo", color="#F0F8FF", alpha=.3, scalar_thresh=.5)
brain.add_label("BA45", color="#F0F8FF", borders=3, scalar_thresh=.5)
brain.add_label("BA45", color="#F0F8FF", alpha=.3, scalar_thresh=.5)

"""
Finally, with a few tricks, you can display the whole probabilistic map.
"""
subjects_dir = environ["SUBJECTS_DIR"]
label_file = join(subjects_dir, "fsaverage", "label", "lh.BA6_exvivo.label")
label_file = join(subjects_dir, "fsaverage", "label", "lh.BA6.label")

prob_field = np.zeros_like(brain.geo['lh'].x)
ids, probs = read_label(label_file, read_scalars=True)
Expand Down