Image processing in Python
lagru and stefanv Fix morphology.local_maxima for input with any dimension < 3 (#3447)
* Fix local_maxima for input with dimensions < 3

local_maxima (and local_minima) failed with an ValueError for images
with at least 1 dimension with fewer than 3 elements. This was due to
the implementation which applies a structuring element with exactly 3
elements in each dimension to the image in question. This behavior was
only visible if `allow_borders` was false, otherwise the image was
padded internally.
This fix makes these functions work for the mentioned edge cases by
testing the image shape at the appropriate time.

* Fix output of local_maxima for empty arrays

The old output for empty arrays if `indices` was true didn't correspond
to the output for non-empty arrays and the description in the docstring.
This ensures that the output will always be a tuple of empty arrays.

If `indices` is false, the returned empty array now machtes the shape of
`image` as well.

* Show warning if no maxima are possible

which is the case for dimensions with fewer than 3 samples. Because
`local_minima` wraps `local_maxima` the warning can only set the correct
stacklevel for one of these functions. The latter was chosen because it
stands to reason that it is / will be used more frequently.

If may be possible to suppress and re-raise the warning with the context
manager from the warnings module but that would introduce non-thread-
safe code and introduce perhaps unnecessary complexity.

* Point user to allow_borders in warning message
Latest commit 29a22e1 Nov 13, 2018
Permalink
Failed to load latest commit information.
.github MNT: Convert all scikit-image.com links to https Sep 30, 2018
benchmarks Merge pull request #3536 from constantinpape/skeletonize_lift_gil Nov 6, 2018
doc Fix morphology.local_maxima for input with any dimension < 3 (#3447) Nov 13, 2018
requirements Merge pull request #3542 from robroooh/tempfix-matplotlib-readme Nov 11, 2018
skimage Fix morphology.local_maxima for input with any dimension < 3 (#3447) Nov 13, 2018
tools pep8 Nov 6, 2018
viewer_examples Fixed outdated call in watershed viewer demo Jun 18, 2018
.appveyor.yml Added a pre-build to the matrix Nov 3, 2018
.codecov.yml Buid tools: coverage succeed even with a 0.1% coverage drop Oct 8, 2018
.gitignore Merge remote-tracking branch 'origin/master' into is/detector Jul 26, 2018
.gitmodules PKG: Change gitwash submodule git remote so that ShiningPanda can pul… Mar 2, 2012
.mailmap Add my second email address Jun 1, 2016
.meeseeksdev.yml Allow Mark Harfouche to mention MeeseeksDev to backport. Aug 16, 2018
.pep8speaks.yml TSTENH: Add W503 to pep8speaks ignore. (#2816) Sep 30, 2017
.travis.yml Travis: show that ccache at the right time Oct 11, 2018
CONTRIBUTING.txt Change to make html Nov 7, 2018
CONTRIBUTORS.txt DOC: added to contributors Oct 9, 2018
INSTALL.rst Cython -> Cython3 Oct 28, 2018
LICENSE.txt complete singularization of scikit-image Oct 8, 2012
MANIFEST.in Remove cython md5 hashing as it isn't needed anymore Oct 11, 2018
Makefile Update instructions et al for releases after 0.14.1 (#3442) Oct 4, 2018
README.md MNT: Convert all scikit-image.com links to https Sep 30, 2018
RELEASE.txt Fix typos Oct 17, 2018
TODO.txt Remove restriction on simpleitk for python 3.7 Nov 3, 2018
asv.conf.json MNT: convert all github links to https Sep 30, 2018
conftest.py TST: filter away novice deprecation warnings. Oct 10, 2018
pyproject.toml BUILD: Add pyproject.toml to ensure cython is present (#3295) Jul 29, 2018
requirements.txt Reorganizing requirements Sep 12, 2017
setup.cfg Add license file to the wheel (binary) distribution Aug 5, 2018
setup.py MNT: convert all github links to https Sep 30, 2018

README.md

scikit-image: Image processing in Python

Stackoverflow Gitter codecov.io

Installation from binaries

  • Debian/Ubuntu: sudo apt-get install python-skimage
  • OSX: pip install scikit-image
  • Anaconda: conda install -c conda-forge scikit-image
  • Windows: Download Windows binaries

Also see installing scikit-image.

Installation from source

Install dependencies using:

pip install -r requirements.txt

Then, install scikit-image using:

$ pip install .

If you plan to develop the package, you may run it directly from source:

$ pip install -e .  # Do this once to add package to Python path

Every time you modify Cython files, also run:

$ python setup.py build_ext -i  # Build binary extensions

License (Modified BSD)

Copyright (C) 2011, the scikit-image team All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of skimage nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Citation

If you find this project useful, please cite:

Stéfan van der Walt, Johannes L. Schönberger, Juan Nunez-Iglesias, François Boulogne, Joshua D. Warner, Neil Yager, Emmanuelle Gouillart, Tony Yu, and the scikit-image contributors. scikit-image: Image processing in Python. PeerJ 2:e453 (2014) http://dx.doi.org/10.7717/peerj.453