Merge pull request #541 from emmanuelle/doc

Another minor doc-related PR
This commit is contained in:
Tony S Yu
2013-05-26 14:14:02 -07:00
3 changed files with 22 additions and 0 deletions
+6
View File
@@ -10,6 +10,12 @@ Distribution (EPD) <http://enthought.com/products/epd.php>`__, `Python(x,y)
<http://code.google.com/p/pythonxy/wiki/Welcome>`__ and
`Anaconda <https://store.continuum.io/cshop/anaconda/>`__.
On Debian and Ubuntu, a Debian package ``python-skimage`` can be found in
`the Neurodebian repository <http://neuro.debian.net>`__. Follow `the
instructions <http://neuro.debian.net/#how-to-use-this-repository>`__ to
add Neurodebian to your system package manager, then look for
``python-skimage`` in the package manager.
On systems that support setuptools, the package can be installed from the
`Python packaging index <http://pypi.python.org/pypi/scikit-image>`__ using
+10
View File
@@ -1,3 +1,4 @@
import warnings
import numpy as np
from skimage import img_as_float
@@ -19,6 +20,10 @@ def histogram(image, nbins=256):
does not rebin integer arrays. For integer arrays, each integer value has
its own bin, which improves speed and intensity-resolution.
The histogram is computed on the flattened image: for color images, the
function should be used separately on each channel to obtain a histogram
for each color channel.
Parameters
----------
image : array
@@ -42,6 +47,11 @@ def histogram(image, nbins=256):
>>> plt.plot(hist[1], hist[0]) # doctest: +ELLIPSIS
[...]
"""
sh = image.shape
if len(sh) == 3 and sh[-1] < 4:
warnings.warn("This might be a color image. The histogram will be "
"computed on the flattened image. You can instead "
"apply this function to each color channel.")
# For integer types, histogramming with bincount is more efficient.
if np.issubdtype(image.dtype, np.integer):
+6
View File
@@ -1,3 +1,5 @@
import warnings
import numpy as np
from numpy.testing import assert_array_almost_equal as assert_close
import skimage
@@ -112,6 +114,10 @@ def test_adapthist_color():
'''Test an RGB color uint16 image
'''
img = skimage.img_as_uint(data.lena())
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
hist, bin_centers = exposure.histogram(img)
assert len(w) > 0
adapted = exposure.equalize_adapthist(img, clip_limit=0.01)
assert_almost_equal = np.testing.assert_almost_equal
assert adapted.min() == 0