Skip to content

Commit

Permalink
Merge pull request janelia-flyem#32 from jni/tree-agglo
Browse files Browse the repository at this point in the history
Tree-based agglomeration
  • Loading branch information
jni committed Oct 15, 2014
2 parents 84a660a + 740bebb commit 790949c
Show file tree
Hide file tree
Showing 34 changed files with 1,064 additions and 254 deletions.
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
omit =
*test_package*
*test_*
*auto*
*segmentation_stitch*
*stack_np*
*stitch*
*valprob*
*setup*
*__init__*
66 changes: 24 additions & 42 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,38 @@
# Adopted from networkx travis.yml

language: python
python:
- "2.7"
virtualenv:
system_site_packages: true
before_install:
# Current TravisCI VM is Ubuntu 12.04 which has Python 2.7 and 3.2.
# So apt-get will only apply to those virtualenvs.
- sudo apt-get install -qq python-numpy python-scipy python-matplotlib python-pydot python-gdal
- sudo apt-get install -qq libhdf5-serial-dev
install:
# all installing is now handled by conda as it is faster and more robust
- sudo apt-get update
- pip install -U setuptools
- wget http://repo.continuum.io/miniconda/Miniconda-3.4.2-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a

# Additionally, the TravisCI VM has numpy preinstalled on 2.6, 2.7 and 3.2.
# So for 3.3 and pypy, numpy is not preinstalled and must be pip-installed.
# Matplotlib, pydot, and gdal are not available for 3.2 via apt-get.
# And they are also not available for 2.6, 3.3, and pypy except via pip.
# We could install via pip, but...
# skipping numpy (for 3.3 and pypy) since it takes too long.
# skipping scipy (for 2.6, 3.3, and pypy) since it takes too long.
# skipping matplotlib (for 2.6, 3.3, and pypy) since it takes too long.
# skipping pydot (for all) since it is not 3.x compatible.
# skipping gdal (for all) since it has errors while installing from pip.
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib networkx cython h5py PIL nose scikit-image scikit-learn setuptools pip
- source activate test-environment

- pip install pyyaml --use-mirrors
- pip install pyparsing --use-mirrors
#- pip install coveralls --use-mirrors
- pip install networkx --use-mirrors
- pip install cython
- pip install h5py
- pip install PIL
- pip install nose
- pip install scikit-learn
- pip install scikit-image
# custom package not available from conda
- pip install viridis

# install testing and coverage packages
- pip install pytest pytest-cov
- pip install coveralls

script:
# Install gala
- printenv PWD
- python setup.py install
# Build locally, pytest confuses local and global installs
- python setup.py develop

script:
# Run tests
- cd tests
- python -m nose test_agglo.py
- python -m nose test_features.py
- python -m nose test_watershed.py
- python -m nose test_gala.py
- py.test

after_success:
# We must run coveralls from the git repo.
# But we ran tests from the installed directory.
# The .coverage file looks like it contains absolute paths,
# but coveralls does not seem to care.

#- cp .coverage $TRAVIS_BUILD_DIR
#- cd $TRAVIS_BUILD_DIR
#- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then coveralls; fi
- coveralls
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ volumes...) and multiple channels per image.
* HDF5 and h5py 1.5+
* nose 1.3+
* cython 0.17+
* scikit-learn 0.10+, preferably 0.14+
* scikit-learn 0.15
* matplotlib 1.2+
* scikit-image 0.9+

Expand All @@ -29,15 +29,19 @@ volumes...) and multiple channels per image.
* progressbar 2.3-dev
* [vigra/vigranumpy](hci.iwr.uni-heidelberg.de/vigra/) (1.9.0)

For vigra, you are on your own. It is used for the random forest classifier,
but if you don't install it you can use any of the scikit-learn classifiers,
In its original incarnation, this project used Vigra for the random forest
classifier. Installation is less simple than scikit-learn, which has emerged
in the last year as a truly excellent implementation and is now recommended.
Tests in the test suite expect scikit-learn rather than Vigra.
You can also use any of the scikit-learn classifiers,
including their newly-excellent random forest.

## Installation

### Installing gala

Gala is a pure python library and can be installed in two ways:
Gala is a Python library with limited Cython extensions and can be
installed in two ways:
* Add the gala directory to your PYTHONPATH environment variable, or
* Use distutils to install it into your preferred python environment:

Expand All @@ -47,19 +51,16 @@ $ python setup.py install

### Installing requirements

You can install all the requirements yourself: most are available in
the Python Package Index (PyPI) and can be installed with simple commands:
Though you can install all the requirements yourself, as most are available in
the Python Package Index (PyPI) and can be installed with simple commands,
the easiest way to get up and running is to use the
[Continuum Anaconda](http://www.continuum.io/downloads) Python distribution.
An example of installing all dependencies for gala on linux is shown in
the `.travis.yml` test recipe.

```bash
$ pip install scikit-learn
```

Alternatively, a number of Python distributions include all the above
dependencies and a bunch more for good measure. Two examples are
[Continuum Anaconda](http://www.continuum.io/downloads) and
[Enthought Canopy](https://www.enthought.com/products/canopy/).
### Installing with Buildem

Finally, you can use Janelia's own
Alternatively, you can use Janelia's own
[buildem system](http://github.com/janelia-flyem/buildem#readme) to
automatically download, compile, test, and install requirements into a
specified buildem prefix directory. (You will need CMake.)
Expand All @@ -86,6 +87,7 @@ $ cd tests
$ python test_agglo.py
$ python test_features.py
$ python test_watershed.py
$ python test_optimized.py
$ python test_gala.py
```

Expand Down
Loading

0 comments on commit 790949c

Please sign in to comment.