Skip to content

Commit a0b2441

Browse files
committed
Merge pull request #110 from mwaskom/docs_and_prerelease_stuff
Update docs and other housekeeping before 0.5 release
2 parents 564a369 + 66d8dcf commit a0b2441

File tree

6 files changed

+95
-25
lines changed

6 files changed

+95
-25
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ doc/samples
2222
pysurfer.egg-info
2323
*.avi
2424
.tmp/*.png
25+
examples/example_data/coord-lh.label
26+
.ipynb_checkpoints/

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Michael Waskom <[email protected]> mwaskom <[email protected]>

doc/install.rst

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
.. _install:
22

3-
Installation and Dependencies
4-
=============================
3+
Installing and Getting Started
4+
==============================
55

6-
Installing PySurfer is quite simple with easy_install_::
6+
Installing PySurfer is quite simple with pip_::
77

8-
easy_install -U pysurfer
8+
pip install pysurfer
99

10-
or pip_::
10+
If you already have PySurfer installed, you can also use pip to update it::
1111

12-
pip install pysurfer
12+
pip install -U pysurfer
13+
14+
If you'd like to install the development version, you have two options. You can
15+
use pip::
16+
17+
pip install git+git://github.com/nipy/pysurfer.git#egg=pysurfer
18+
19+
Or you can clone the `git repository <https://github.com/nipy/PySurfer>`_ and
20+
install from the source directory::
21+
22+
python setup.py install
23+
24+
If you don't have pip, you can also install PySurfer with easy_install_, or use
25+
easy_install to get pip.
26+
27+
Dependencies
28+
~~~~~~~~~~~~
29+
30+
PySurfer requires Python 2.7, and it does not work on Python 3.
1331

1432
To use PySurfer, you will need to have the following Python packages:
1533

@@ -19,17 +37,42 @@ To use PySurfer, you will need to have the following Python packages:
1937
* nibabel_
2038
* mayavi_
2139
* matplotlib_
22-
* PIL_
2340

24-
An easy option to get all of these packages is to use the Enthought
25-
Python Distribution (EPD_) which is free for academic use.
41+
Some functions also make use of the Python Imaging Library (PIL_), although
42+
it's not mandatory.
2643

27-
.. include:: links_names.txt
44+
An easy option to set up this environment is the Anaconda_ distribution, which
45+
is free and ships with many of the required packages. If you use Anaconda,
46+
you'll need to install Mayavi separately. This can be done using the ``conda``
47+
command::
48+
49+
conda install mayavi
2850

29-
.. note::
51+
You'll also need to install nibabel, which can be done using ``pip`` as above.
52+
53+
Another option for getting set up is the Enthough Canopy_ environment, which is
54+
similar to Anaconda and free for academic use.
55+
56+
Getting started
57+
~~~~~~~~~~~~~~~
58+
59+
PySurfer generally works out of the box on Linux systems. Getting started on
60+
OSX can be a bit more difficult. We have had success using the Anaconda
61+
distribution with the additional step of setting the environment variable
62+
``QT_API`` to ``pyqt``::
63+
64+
export QT_API=pyqt
65+
66+
If you want to use PySurfer interactively, you should do so in ipython_. After
67+
starting ipython (either in the terminal, qtconsole, or notebook), you have to
68+
activate the correct GUI backend, which is probably qt::
69+
70+
%gui qt
71+
72+
This will allow you to have an open PySurfer window while still being able to
73+
execute code in the console/notebook.
74+
75+
If you are having trouble getting started using PySurfer, please describe the problem on the `nipy mailing list`_.
76+
77+
.. include:: links_names.txt
3078

31-
For optimal results and performance make sure IPython is invoked using the
32-
best GUI back end. In an EPD environment on Mac OS X this would be WX,
33-
so `ipython --pylab wx`. On Linux Debian / Ubuntu (Neurodebian) QT seems
34-
to be more appropriate, so `ipython --pylab qt`. Reports for other platforms
35-
and distributions are appreciated.

doc/links_names.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
.. _EPD: http://www.enthought.com/products/epd.php
7676
.. _Traits: http://code.enthought.com/projects/traits/
7777
.. _PIL: http://www.pythonware.com/products/pil/
78+
.. _Anaconda: https://store.continuum.io/cshop/anaconda/
79+
.. _Canopy: https://www.enthought.com/products/canopy/
7880

7981
.. Python imaging projects
8082
.. _PyMVPA: http://www.pymvpa.org

examples/plot_probabilistic_label.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
overlay the label on an activation plot to asses whether it falls within that
3434
region.
3535
"""
36-
brain.add_label("BA45", color="#F0F8FF", borders=True, scalar_thresh=.5)
36+
brain.add_label("BA45", color="#F0F8FF", borders=3, scalar_thresh=.5)
3737
brain.add_label("BA45", color="#F0F8FF", alpha=.3, scalar_thresh=.5)
3838

3939
"""
@@ -46,10 +46,3 @@
4646
ids, probs = io.read_label(label_file, read_scalars=True)
4747
prob_field[ids] = probs
4848
brain.add_data(prob_field, thresh=1e-5, colormap="RdPu")
49-
50-
"""
51-
Adjust the colorbar to represent the coarseness of the probability estimates
52-
more closely.
53-
"""
54-
brain.data["colorbar"].number_of_colors = 10
55-
brain.data["colorbar"].number_of_labels = 11

setup.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Michael Waskom <[email protected]>
55
# Scott Burns <[email protected]>
66

7-
descr = """PySurfer: Python / FreeSurfer / Mayavi2 for brain imaging"""
7+
descr = """PySurfer: cortical surface visualization using Python."""
88

99
import os
1010
# deal with MPL sandbox violations during easy_install
@@ -30,12 +30,40 @@
3030
DOWNLOAD_URL = 'https://github.com/nipy/PySurfer'
3131
VERSION = version
3232

33+
def check_dependencies():
34+
35+
needed_deps = ["IPython",
36+
"numpy", "scipy", "matplotlib",
37+
"nibabel",
38+
"mayavi",
39+
]
40+
missing_deps = []
41+
for dep in needed_deps:
42+
try:
43+
__import__(dep)
44+
except ImportError:
45+
missing_deps.append(dep)
46+
47+
if missing_deps:
48+
missing = ", ".join(missing_deps)
49+
raise ImportError("Missing dependencies: %s" % missing)
50+
51+
3352
from setuptools import setup
3453

3554
if __name__ == "__main__":
3655
if os.path.exists('MANIFEST'):
3756
os.remove('MANIFEST')
3857

58+
import sys
59+
if not (len(sys.argv) >= 2 and ('--help' in sys.argv[1:] or
60+
sys.argv[1] in ('--help-commands',
61+
'--version',
62+
'egg_info',
63+
'clean'))):
64+
check_dependencies()
65+
66+
3967
setup(name=DISTNAME,
4068
maintainer=MAINTAINER,
4169
include_package_data=True,
@@ -49,6 +77,7 @@
4977
zip_safe=False, # the package can run out of an .egg file
5078
classifiers=['Intended Audience :: Science/Research',
5179
'Intended Audience :: Developers',
80+
'Programming Language :: Python :: 2.7',
5281
'License :: OSI Approved',
5382
'Programming Language :: Python',
5483
'Topic :: Software Development',

0 commit comments

Comments
 (0)