mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-12 12:50:49 +08:00
Merge pull request #1356 from blink1073/travis-build-docs
Verify doc building with Travis
This commit is contained in:
+3
-5
@@ -123,9 +123,7 @@ Guidelines
|
|||||||
|
|
||||||
* All code should have tests (see `test coverage`_ below for more details).
|
* All code should have tests (see `test coverage`_ below for more details).
|
||||||
* All code should be documented, to the same
|
* All code should be documented, to the same
|
||||||
`standard
|
`standard <://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#docstring-standard>`_ as NumPy and SciPy.
|
||||||
<://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#docstring-standard>`_
|
|
||||||
as NumPy and SciPy.
|
|
||||||
* For new functionality, always add an example to the
|
* For new functionality, always add an example to the
|
||||||
gallery.
|
gallery.
|
||||||
* No changes are ever committed without review. Ask on the
|
* No changes are ever committed without review. Ask on the
|
||||||
@@ -195,8 +193,8 @@ successfully passes all tests. To do so,
|
|||||||
|
|
||||||
* Go to `Travis-CI <http://travis-ci.org/>`__ and follow the Sign In link at the top
|
* Go to `Travis-CI <http://travis-ci.org/>`__ and follow the Sign In link at the top
|
||||||
|
|
||||||
* Go to your `profile page <https://travis-ci.org/profile>`__ and switch on your
|
* Go to your `profile page <https://travis-ci.org/profile>`__ and switch
|
||||||
scikit-image fork
|
on your scikit-image fork
|
||||||
|
|
||||||
It corresponds to steps one and two in
|
It corresponds to steps one and two in
|
||||||
`Travis-CI documentation <http://about.travis-ci.org/docs/user/getting-started/>`__
|
`Travis-CI documentation <http://about.travis-ci.org/docs/user/getting-started/>`__
|
||||||
|
|||||||
+5
-5
@@ -45,12 +45,12 @@ functionality is only available with the following installed:
|
|||||||
|
|
||||||
* `Astropy <http://www.astropy.org>`__ provides FITS io capability.
|
* `Astropy <http://www.astropy.org>`__ provides FITS io capability.
|
||||||
|
|
||||||
*`SimpleITK <http://www.simpleitk.org/>`
|
* `SimpleITK <http://www.simpleitk.org/>`
|
||||||
Optional io plugin providing a wide variety of `formats <http://www.itk.org/Wiki/ITK_File_Formats>`__.
|
Optional io plugin providing a wide variety of `formats <http://www.itk.org/Wiki/ITK_File_Formats>`__.
|
||||||
including specialized formats using in medical imaging.
|
including specialized formats using in medical imaging.
|
||||||
|
|
||||||
*`imread <http://pythonhosted.org/imread/>`
|
* `imread <http://pythonhosted.org/imread/>`
|
||||||
Optional io plugin providing most standard `formats <http://pythonhosted.org//imread/formats.html>`__.
|
Optional io plugin providing most standard `formats <http://pythonhosted.org//imread/formats.html>`__.
|
||||||
|
|
||||||
|
|
||||||
Testing requirements
|
Testing requirements
|
||||||
|
|||||||
@@ -14,3 +14,7 @@ doctest:
|
|||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
nosetests skimage --with-coverage --cover-package=skimage
|
nosetests skimage --with-coverage --cover-package=skimage
|
||||||
|
|
||||||
|
html:
|
||||||
|
pip install -q sphinx
|
||||||
|
export SPHINXOPTS=-W; make -C doc html
|
||||||
|
|||||||
@@ -3,3 +3,16 @@ To build docs, run `make` in this directory. `make help` lists all targets.
|
|||||||
|
|
||||||
## Requirements ##
|
## Requirements ##
|
||||||
Sphinx is needed to build doc. Install with `pip install sphinx`.
|
Sphinx is needed to build doc. Install with `pip install sphinx`.
|
||||||
|
|
||||||
|
## Fixing Warnings ##
|
||||||
|
|
||||||
|
- "citation not found: R###"
|
||||||
|
$ cd doc/build; grep -rin R### .
|
||||||
|
There is probably an underscore after the reference (e.g. [1]_)
|
||||||
|
|
||||||
|
- "Duplicate citation R###, other instance in...""
|
||||||
|
There is probably a [2] without a [1] in one of
|
||||||
|
the docstrings
|
||||||
|
|
||||||
|
- Make sure to use pre-sphinxification paths to images
|
||||||
|
(not the _images directory)
|
||||||
|
|||||||
+2
-1
@@ -258,7 +258,8 @@ def write_gallery(gallery_index, src_dir, rst_dir, cfg, depth=0):
|
|||||||
else:
|
else:
|
||||||
sub_dir_list = src_dir.psplit()[-depth:]
|
sub_dir_list = src_dir.psplit()[-depth:]
|
||||||
sub_dir = Path('/'.join(sub_dir_list) + '/')
|
sub_dir = Path('/'.join(sub_dir_list) + '/')
|
||||||
gallery_index.write(TOCTREE_TEMPLATE % (sub_dir + '\n '.join(ex_names)))
|
joiner = '\n %s' % sub_dir
|
||||||
|
gallery_index.write(TOCTREE_TEMPLATE % (sub_dir + joiner.join(ex_names)))
|
||||||
|
|
||||||
for src_name in examples:
|
for src_name in examples:
|
||||||
|
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ latex_use_modindex = False
|
|||||||
# Numpy extensions
|
# Numpy extensions
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
numpydoc_show_class_members = False
|
numpydoc_show_class_members = False
|
||||||
|
numpydoc_class_members_toctree = False
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Plots
|
# Plots
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
Table of Contents
|
|
||||||
=================
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
|
|
||||||
/api/api
|
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ Sections
|
|||||||
:hidden:
|
:hidden:
|
||||||
|
|
||||||
overview
|
overview
|
||||||
api
|
api/api
|
||||||
api_changes
|
api_changes
|
||||||
install
|
install
|
||||||
user_guide
|
user_guide
|
||||||
|
|||||||
@@ -12,3 +12,5 @@ User Guide
|
|||||||
user_guide/tutorials
|
user_guide/tutorials
|
||||||
user_guide/getting_help
|
user_guide/getting_help
|
||||||
user_guide/viewer
|
user_guide/viewer
|
||||||
|
user_guide/tutorial_parallelization
|
||||||
|
user_guide/tutorial_segmentation
|
||||||
@@ -81,7 +81,7 @@ disk: ::
|
|||||||
... (nrows / 2)**2)
|
... (nrows / 2)**2)
|
||||||
>>> camera[outer_disk_mask] = 0
|
>>> camera[outer_disk_mask] = 0
|
||||||
|
|
||||||
.. image:: ../../_images/plot_camera_numpy_1.png
|
.. image:: ../auto_examples/images/plot_camera_numpy_1.png
|
||||||
:width: 45%
|
:width: 45%
|
||||||
:target: ../auto_examples/plot_camera_numpy.html
|
:target: ../auto_examples/plot_camera_numpy.html
|
||||||
|
|
||||||
@@ -123,6 +123,8 @@ the grayscale image above:
|
|||||||
|
|
||||||
Using a 2D mask on a 2D color image
|
Using a 2D mask on a 2D color image
|
||||||
|
|
||||||
|
>>> from skimage import data
|
||||||
|
>>> cat = data.chelsea()
|
||||||
>>> reddish = cat[:, :, 0] > 160
|
>>> reddish = cat[:, :, 0] > 160
|
||||||
>>> cat[reddish] = [0, 255, 0]
|
>>> cat[reddish] = [0, 255, 0]
|
||||||
>>> plt.imshow(cat)
|
>>> plt.imshow(cat)
|
||||||
@@ -153,14 +155,14 @@ These conventions are summarized below:
|
|||||||
|
|
||||||
.. table:: Dimension name and order conventions in scikit-image
|
.. table:: Dimension name and order conventions in scikit-image
|
||||||
|
|
||||||
======================== ========================================
|
========================= ========================================
|
||||||
Image type coordinates
|
Image type coordinates
|
||||||
======================== ========================================
|
========================= ========================================
|
||||||
2D grayscale (row, col)
|
2D grayscale (row, col)
|
||||||
2D multichannel (eg. RGB) (row, col, ch)
|
2D multichannel (eg. RGB) (row, col, ch)
|
||||||
3D grayscale (pln, row, col)
|
3D grayscale (pln, row, col)
|
||||||
3D multichannel (pln, row, col, ch)
|
3D multichannel (pln, row, col, ch)
|
||||||
======================== ========================================
|
========================= ========================================
|
||||||
|
|
||||||
|
|
||||||
Many functions in scikit-image operate on 3D images directly:
|
Many functions in scikit-image operate on 3D images directly:
|
||||||
@@ -248,9 +250,9 @@ We can then supplement the above table as follows:
|
|||||||
|
|
||||||
.. table:: Addendum to dimension names and orders in scikit-image
|
.. table:: Addendum to dimension names and orders in scikit-image
|
||||||
|
|
||||||
======================== ========================================
|
======================== ========================================
|
||||||
Image type coordinates
|
Image type coordinates
|
||||||
======================== ========================================
|
======================== ========================================
|
||||||
2D color video (t, row, col, ch)
|
2D color video (t, row, col, ch)
|
||||||
3D multichannel video (t, pln, row, col, ch)
|
3D multichannel video (t, pln, row, col, ch)
|
||||||
======================== ========================================
|
======================== ========================================
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ from RGB to grayscale::
|
|||||||
array([[ 0.7154]])
|
array([[ 0.7154]])
|
||||||
|
|
||||||
|
|
||||||
Converting a grayscale image to RGB with :func:`gray2rgb``simply
|
Converting a grayscale image to RGB with :func:`gray2rgb` simply
|
||||||
duplicates the gray values over the three color channels.
|
duplicates the gray values over the three color channels.
|
||||||
|
|
||||||
Painting images with labels
|
Painting images with labels
|
||||||
@@ -78,7 +78,7 @@ using an array of labels to encode the regions to be represented with the
|
|||||||
same color.
|
same color.
|
||||||
|
|
||||||
|
|
||||||
.. image:: ../../_images/plot_join_segmentations_1.png
|
.. image: ../auto_examples/images/plot_join_segmentations_1.png
|
||||||
:target: ../auto_examples/plot_join_segmentations.html
|
:target: ../auto_examples/plot_join_segmentations.html
|
||||||
:align: center
|
:align: center
|
||||||
:width: 80%
|
:width: 80%
|
||||||
@@ -159,7 +159,7 @@ image with :func:`equalize_adapthist`, in order to correct for exposure
|
|||||||
gradients across the image. See the example
|
gradients across the image. See the example
|
||||||
:ref:`example_plot_equalize.py`.
|
:ref:`example_plot_equalize.py`.
|
||||||
|
|
||||||
.. image:: ../../_images/plot_equalize_1.png
|
.. image:: ../auto_examples/images/plot_equalize_1.png
|
||||||
:target: ../auto_examples/plot_equalize.html
|
:target: ../auto_examples/plot_equalize.html
|
||||||
:align: center
|
:align: center
|
||||||
:width: 90%
|
:width: 90%
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ the coins cannot be done directly from the histogram of grey values,
|
|||||||
because the background shares enough grey levels with the coins that a
|
because the background shares enough grey levels with the coins that a
|
||||||
thresholding segmentation is not sufficient.
|
thresholding segmentation is not sufficient.
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_1.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_1.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ Simply thresholding the image leads either to missing significant parts
|
|||||||
of the coins, or to merging parts of the background with the
|
of the coins, or to merging parts of the background with the
|
||||||
coins. This is due to the inhomogeneous lighting of the image.
|
coins. This is due to the inhomogeneous lighting of the image.
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_2.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_2.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ boundary of the coins, or inside the coins.
|
|||||||
>>> from scipy import ndimage
|
>>> from scipy import ndimage
|
||||||
>>> fill_coins = ndimage.binary_fill_holes(edges)
|
>>> fill_coins = ndimage.binary_fill_holes(edges)
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_3.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_3.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ we fill the inner part of the coins using the
|
|||||||
``ndimage.binary_fill_holes`` function, which uses mathematical morphology
|
``ndimage.binary_fill_holes`` function, which uses mathematical morphology
|
||||||
to fill the holes.
|
to fill the holes.
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_4.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_4.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ has not been segmented correctly at all. The reason is that the contour
|
|||||||
that we got from the Canny detector was not completely closed, therefore
|
that we got from the Canny detector was not completely closed, therefore
|
||||||
the filling function did not fill the inner part of the coin.
|
the filling function did not fill the inner part of the coin.
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_5.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_5.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ separate the coins from the background.
|
|||||||
|
|
||||||
and here is the corresponding 2-D plot:
|
and here is the corresponding 2-D plot:
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_6.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_6.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ extreme parts of the histogram of grey values::
|
|||||||
>>> markers[coins < 30] = 1
|
>>> markers[coins < 30] = 1
|
||||||
>>> markers[coins > 150] = 2
|
>>> markers[coins > 150] = 2
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_7.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_7.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ Let us now compute the watershed transform::
|
|||||||
>>> from skimage.morphology import watershed
|
>>> from skimage.morphology import watershed
|
||||||
>>> segmentation = watershed(elevation_map, markers)
|
>>> segmentation = watershed(elevation_map, markers)
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_8.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_8.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ We can now label all the coins one by one using ``ndimage.label``::
|
|||||||
|
|
||||||
>>> labeled_coins, _ = ndimage.label(segmentation)
|
>>> labeled_coins, _ = ndimage.label(segmentation)
|
||||||
|
|
||||||
.. image:: ../../_images/plot_coins_segmentation_9.png
|
.. image:: ../auto_examples/applications/images/plot_coins_segmentation_9.png
|
||||||
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
:target: ../auto_examples/applications/plot_coins_segmentation.html
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ def circle(cy, cx, radius, shape=None):
|
|||||||
Pixel coordinates of circle.
|
Pixel coordinates of circle.
|
||||||
May be used to directly index into an array, e.g.
|
May be used to directly index into an array, e.g.
|
||||||
``img[rr, cc] = 1``.
|
``img[rr, cc] = 1``.
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
-----
|
-----
|
||||||
This function is a wrapper for skimage.draw.ellipse()
|
This function is a wrapper for skimage.draw.ellipse()
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from .util import plot_matches
|
|||||||
from .blob import blob_dog, blob_log, blob_doh
|
from .blob import blob_dog, blob_log, blob_doh
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['canny'
|
__all__ = ['canny',
|
||||||
'daisy',
|
'daisy',
|
||||||
'hog',
|
'hog',
|
||||||
'greycomatrix',
|
'greycomatrix',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"""The local histogram is computed using a sliding window similar to the method
|
"""The local histogram is computed using a sliding window similar to the method
|
||||||
described in [1]_.
|
described in [1].
|
||||||
|
|
||||||
Input image can be 8-bit or 16-bit, for 16-bit input images, the number of
|
Input image can be 8-bit or 16-bit, for 16-bit input images, the number of
|
||||||
histogram bins is determined from the maximum value present in the image.
|
histogram bins is determined from the maximum value present in the image.
|
||||||
@@ -749,7 +749,7 @@ def tophat(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
|||||||
|
|
||||||
def noise_filter(image, selem, out=None, mask=None, shift_x=False,
|
def noise_filter(image, selem, out=None, mask=None, shift_x=False,
|
||||||
shift_y=False):
|
shift_y=False):
|
||||||
"""Noise feature as described in [Hashimoto12]_.
|
"""Noise feature as described in [1].
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
@@ -769,7 +769,7 @@ def noise_filter(image, selem, out=None, mask=None, shift_x=False,
|
|||||||
|
|
||||||
References
|
References
|
||||||
----------
|
----------
|
||||||
.. [Hashimoto12] N. Hashimoto et al. Referenceless image quality evaluation
|
.. [1] N. Hashimoto et al. Referenceless image quality evaluation
|
||||||
for whole slide imaging. J Pathol Inform 2012;3:9.
|
for whole slide imaging. J Pathol Inform 2012;3:9.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
@@ -800,7 +800,7 @@ def noise_filter(image, selem, out=None, mask=None, shift_x=False,
|
|||||||
|
|
||||||
|
|
||||||
def entropy(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
def entropy(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
||||||
"""Local entropy [1]_.
|
"""Local entropy [1].
|
||||||
|
|
||||||
The entropy is computed using base 2 logarithm i.e. the filter returns the
|
The entropy is computed using base 2 logarithm i.e. the filter returns the
|
||||||
minimum number of bits needed to encode the local greylevel distribution.
|
minimum number of bits needed to encode the local greylevel distribution.
|
||||||
@@ -872,7 +872,7 @@ def otsu(image, selem, out=None, mask=None, shift_x=False, shift_y=False):
|
|||||||
|
|
||||||
References
|
References
|
||||||
----------
|
----------
|
||||||
.. [otsu] http://en.wikipedia.org/wiki/Otsu's_method
|
.. [1] http://en.wikipedia.org/wiki/Otsu's_method
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -200,8 +200,10 @@ def threshold_isodata(image, nbins=256, return_all=False):
|
|||||||
|
|
||||||
Histogram-based threshold, known as Ridler-Calvard method or inter-means.
|
Histogram-based threshold, known as Ridler-Calvard method or inter-means.
|
||||||
Threshold values returned satisfy the following equality:
|
Threshold values returned satisfy the following equality:
|
||||||
threshold = (image[image <= threshold].mean() +
|
|
||||||
image[image > threshold].mean()) / 2.0
|
`threshold = (image[image <= threshold].mean() +`
|
||||||
|
`image[image > threshold].mean()) / 2.0`
|
||||||
|
|
||||||
That is, returned thresholds are intensities that separate the image into
|
That is, returned thresholds are intensities that separate the image into
|
||||||
two groups of pixels, where the threshold intensity is midway between the
|
two groups of pixels, where the threshold intensity is midway between the
|
||||||
mean intensities of these groups.
|
mean intensities of these groups.
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ def rag_mean_color(image, labels, connectivity=2, mode='distance',
|
|||||||
labels : ndarray, shape(M, N, [..., P,])
|
labels : ndarray, shape(M, N, [..., P,])
|
||||||
The labelled image. This should have one dimension less than
|
The labelled image. This should have one dimension less than
|
||||||
`image`. If `image` has dimensions `(M, N, 3)` `labels` should have
|
`image`. If `image` has dimensions `(M, N, 3)` `labels` should have
|
||||||
dimensions `(M, N)`.
|
dimensions `(M, N)`.
|
||||||
connectivity : int, optional
|
connectivity : int, optional
|
||||||
Pixels with a squared distance less than `connectivity` from each other
|
Pixels with a squared distance less than `connectivity` from each other
|
||||||
are considered adjacent. It can range from 1 to `labels.ndim`. Its
|
are considered adjacent. It can range from 1 to `labels.ndim`. Its
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
[pil]
|
[pil]
|
||||||
description = Image reading via the Python Imaging Library
|
description = Image reading via the Python Imaging Library
|
||||||
provides = imread, imsave, imshow, _app_show
|
provides = imread, imsave
|
||||||
|
|||||||
@@ -260,20 +260,3 @@ def imsave(fname, arr, format_str=None):
|
|||||||
|
|
||||||
img = ndarray_to_pil(arr, format_str=format_str)
|
img = ndarray_to_pil(arr, format_str=format_str)
|
||||||
img.save(fname, format=format_str)
|
img.save(fname, format=format_str)
|
||||||
|
|
||||||
|
|
||||||
def imshow(arr):
|
|
||||||
"""Display an image, using PIL's default display command.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
arr : ndarray
|
|
||||||
Image to display. Images of dtype float are assumed to be in
|
|
||||||
[0, 1]. Images of dtype uint8 are in [0, 255].
|
|
||||||
|
|
||||||
"""
|
|
||||||
Image.fromarray(img_as_ubyte(arr)).show()
|
|
||||||
|
|
||||||
|
|
||||||
def _app_show():
|
|
||||||
pass
|
|
||||||
|
|||||||
@@ -93,15 +93,18 @@ def test_available():
|
|||||||
|
|
||||||
|
|
||||||
def test_load_preferred_plugins_all():
|
def test_load_preferred_plugins_all():
|
||||||
from skimage.io._plugins import pil_plugin
|
from skimage.io._plugins import pil_plugin, matplotlib_plugin
|
||||||
|
|
||||||
with protect_preferred_plugins():
|
with protect_preferred_plugins():
|
||||||
manage_plugins.preferred_plugins = {'all': ['pil']}
|
manage_plugins.preferred_plugins = {'all': ['pil'],
|
||||||
|
'imshow': ['matplotlib']}
|
||||||
manage_plugins.reset_plugins()
|
manage_plugins.reset_plugins()
|
||||||
|
|
||||||
for plugin_type in ('imread', 'imsave', 'imshow'):
|
for plugin_type in ('imread', 'imsave'):
|
||||||
plug, func = manage_plugins.plugin_store[plugin_type][0]
|
plug, func = manage_plugins.plugin_store[plugin_type][0]
|
||||||
assert func == getattr(pil_plugin, plugin_type)
|
assert func == getattr(pil_plugin, plugin_type)
|
||||||
|
plug, func = manage_plugins.plugin_store['imshow'][0]
|
||||||
|
assert func == getattr(matplotlib_plugin, 'imshow')
|
||||||
|
|
||||||
|
|
||||||
def test_load_preferred_plugins_imread():
|
def test_load_preferred_plugins_imread():
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ def label(input, neighbors=None, background=None, return_num=False,
|
|||||||
Two pixels are connected when they are neighbors and have the same value.
|
Two pixels are connected when they are neighbors and have the same value.
|
||||||
In 2D, they can be neighbors either in a 1- or 2-connected sense.
|
In 2D, they can be neighbors either in a 1- or 2-connected sense.
|
||||||
The value refers to the maximum number of orthogonal hops to consider a
|
The value refers to the maximum number of orthogonal hops to consider a
|
||||||
pixel/voxel a neighbor.
|
pixel/voxel a neighbor::
|
||||||
|
|
||||||
1-connectivity 2-connectivity diagonal connection close-up
|
1-connectivity 2-connectivity diagonal connection close-up
|
||||||
|
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ def richardson_lucy(image, psf, iterations=50, clip=True):
|
|||||||
|
|
||||||
References
|
References
|
||||||
----------
|
----------
|
||||||
.. [2] http://en.wikipedia.org/wiki/Richardson%E2%80%93Lucy_deconvolution
|
.. [1] http://en.wikipedia.org/wiki/Richardson%E2%80%93Lucy_deconvolution
|
||||||
"""
|
"""
|
||||||
image = image.astype(np.float)
|
image = image.astype(np.float)
|
||||||
psf = psf.astype(np.float)
|
psf = psf.astype(np.float)
|
||||||
|
|||||||
@@ -65,15 +65,15 @@ def find_boundaries(label_img, connectivity=1, mode='thick', background=0):
|
|||||||
How to mark the boundaries:
|
How to mark the boundaries:
|
||||||
|
|
||||||
- thick: any pixel not completely surrounded by pixels of the
|
- thick: any pixel not completely surrounded by pixels of the
|
||||||
same label (defined by `connectivity`) is marked as a boundary.
|
same label (defined by `connectivity`) is marked as a boundary.
|
||||||
This results in boundaries that are 2 pixels thick.
|
This results in boundaries that are 2 pixels thick.
|
||||||
- inner: outline the pixels *just inside* of objects, leaving
|
- inner: outline the pixels *just inside* of objects, leaving
|
||||||
background pixels untouched.
|
background pixels untouched.
|
||||||
- outer: outline pixels in the background around object
|
- outer: outline pixels in the background around object
|
||||||
boundaries. When two objects touch, their boundary is also
|
boundaries. When two objects touch, their boundary is also
|
||||||
marked.
|
marked.
|
||||||
- subpixel: return a doubled image, with pixels *between* the
|
- subpixel: return a doubled image, with pixels *between* the
|
||||||
original pixels marked as boundary where appropriate.
|
original pixels marked as boundary where appropriate.
|
||||||
background: int, optional
|
background: int, optional
|
||||||
For modes 'inner' and 'outer', a definition of a background
|
For modes 'inner' and 'outer', a definition of a background
|
||||||
label is required. See `mode` for descriptions of these two.
|
label is required. See `mode` for descriptions of these two.
|
||||||
@@ -197,7 +197,7 @@ def mark_boundaries(image, label_img, color=(1, 1, 0),
|
|||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
``find_boundaries``.
|
find_boundaries
|
||||||
"""
|
"""
|
||||||
marked = img_as_float(image, force_copy=True)
|
marked = img_as_float(image, force_copy=True)
|
||||||
if marked.ndim == 2:
|
if marked.ndim == 2:
|
||||||
|
|||||||
@@ -332,7 +332,9 @@ class ProjectiveTransform(GeometricTransform):
|
|||||||
|
|
||||||
class AffineTransform(ProjectiveTransform):
|
class AffineTransform(ProjectiveTransform):
|
||||||
|
|
||||||
"""2D affine transformation of the form::
|
"""2D affine transformation of the form:
|
||||||
|
|
||||||
|
..:math:
|
||||||
|
|
||||||
X = a0*x + a1*y + a2 =
|
X = a0*x + a1*y + a2 =
|
||||||
= sx*x*cos(rotation) - sy*y*sin(rotation + shear) + a2
|
= sx*x*cos(rotation) - sy*y*sin(rotation + shear) + a2
|
||||||
@@ -551,7 +553,9 @@ class PiecewiseAffineTransform(GeometricTransform):
|
|||||||
|
|
||||||
|
|
||||||
class SimilarityTransform(ProjectiveTransform):
|
class SimilarityTransform(ProjectiveTransform):
|
||||||
"""2D similarity transformation of the form::
|
"""2D similarity transformation of the form:
|
||||||
|
|
||||||
|
..:math:
|
||||||
|
|
||||||
X = a0 * x - b0 * y + a1 =
|
X = a0 * x - b0 * y + a1 =
|
||||||
= m * x * cos(rotation) - m * y * sin(rotation) + a1
|
= m * x * cos(rotation) - m * y * sin(rotation) + a1
|
||||||
@@ -715,7 +719,9 @@ class SimilarityTransform(ProjectiveTransform):
|
|||||||
|
|
||||||
|
|
||||||
class PolynomialTransform(GeometricTransform):
|
class PolynomialTransform(GeometricTransform):
|
||||||
"""2D transformation of the form::
|
"""2D transformation of the form:
|
||||||
|
|
||||||
|
..:math:
|
||||||
|
|
||||||
X = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i ))
|
X = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i ))
|
||||||
Y = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i ))
|
Y = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i ))
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ def random_noise(image, mode='gaussian', seed=None, clip=True, **kwargs):
|
|||||||
mode : str
|
mode : str
|
||||||
One of the following strings, selecting the type of noise to add:
|
One of the following strings, selecting the type of noise to add:
|
||||||
|
|
||||||
'gaussian' Gaussian-distributed additive noise.
|
- 'gaussian' Gaussian-distributed additive noise.
|
||||||
'localvar' Gaussian-distributed additive noise, with specified
|
- 'localvar' Gaussian-distributed additive noise, with specified
|
||||||
local variance at each point of `image`
|
local variance at each point of `image`
|
||||||
'poisson' Poisson-distributed noise generated from the data.
|
- 'poisson' Poisson-distributed noise generated from the data.
|
||||||
'salt' Replaces random pixels with 1.
|
- 'salt' Replaces random pixels with 1.
|
||||||
'pepper' Replaces random pixels with 0.
|
- 'pepper' Replaces random pixels with 0.
|
||||||
's&p' Replaces random pixels with 0 or 1.
|
- 's&p' Replaces random pixels with 0 or 1.
|
||||||
'speckle' Multiplicative noise using out = image + n*image, where
|
- 'speckle' Multiplicative noise using out = image + n*image, where
|
||||||
n is uniform noise with specified mean & variance.
|
n is uniform noise with specified mean & variance.
|
||||||
seed : int
|
seed : int
|
||||||
If provided, this will set the random seed before generating noise,
|
If provided, this will set the random seed before generating noise,
|
||||||
for valid pseudo-random comparisons.
|
for valid pseudo-random comparisons.
|
||||||
|
|||||||
+17
-9
@@ -1,10 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
PY=$TRAVIS_PYTHON_VERSION
|
||||||
|
|
||||||
section "Test.with.min.requirements"
|
section "Test.with.min.requirements"
|
||||||
nosetests $TEST_ARGS skimage
|
nosetests $TEST_ARGS skimage
|
||||||
section_end "Test.with.min.requirements"
|
section_end "Test.with.min.requirements"
|
||||||
|
|
||||||
|
section "Build.docs"
|
||||||
|
if [[ ($PY != 2.6) && ($PY != 3.2) ]]; then
|
||||||
|
sudo apt-get install -qq texlive texlive-latex-extra dvipng
|
||||||
|
make html
|
||||||
|
fi
|
||||||
|
section_end "Build.docs"
|
||||||
|
|
||||||
section "Flake8.test"
|
section "Flake8.test"
|
||||||
flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples
|
flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples
|
||||||
@@ -14,13 +22,13 @@ section_end "Flake8.test"
|
|||||||
section "Install.optional.dependencies"
|
section "Install.optional.dependencies"
|
||||||
|
|
||||||
# Install Qt and then update the Matplotlib settings
|
# Install Qt and then update the Matplotlib settings
|
||||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
if [[ $PY == 2.7* ]]; then
|
||||||
sudo apt-get install -q python-qt4
|
sudo apt-get install -q python-qt4
|
||||||
|
|
||||||
# http://stackoverflow.com/a/9716100
|
# http://stackoverflow.com/a/9716100
|
||||||
LIBS=( PyQt4 sip.so )
|
LIBS=( PyQt4 sip.so )
|
||||||
|
|
||||||
VAR=( $(which -a python$TRAVIS_PYTHON_VERSION) )
|
VAR=( $(which -a python$PY) )
|
||||||
|
|
||||||
GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
|
GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
|
||||||
LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD")
|
LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD")
|
||||||
@@ -38,14 +46,14 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# imread does NOT support py3.2
|
# imread does NOT support py3.2
|
||||||
if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then
|
if [[ $PY != 3.2 ]]; then
|
||||||
sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools
|
sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools
|
||||||
retry pip install -q imread
|
retry pip install -q imread
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install SimpleITK from wheelhouse if available (not 3.2 or 3.4)
|
# Install SimpleITK from wheelhouse if available (not 3.2 or 3.4)
|
||||||
if [[ $TRAVIS_PYTHON_VERSION =~ 3\.[24] ]]; then
|
if [[ $PY =~ 3\.[24] ]]; then
|
||||||
echo "SimpleITK unavailable on $TRAVIS_PYTHON_VERSION"
|
echo "SimpleITK unavailable on $PY"
|
||||||
else
|
else
|
||||||
retry pip install -q SimpleITK $WHEELHOUSE
|
retry pip install -q SimpleITK $WHEELHOUSE
|
||||||
fi
|
fi
|
||||||
@@ -53,7 +61,7 @@ fi
|
|||||||
sudo apt-get install -q libfreeimage3
|
sudo apt-get install -q libfreeimage3
|
||||||
retry pip install -q astropy $WHEELHOUSE
|
retry pip install -q astropy $WHEELHOUSE
|
||||||
|
|
||||||
if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then
|
if [[ $PY == 2.* ]]; then
|
||||||
retry pip install -q pyamg
|
retry pip install -q pyamg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -65,7 +73,7 @@ section_end "Install.optional.dependencies"
|
|||||||
section "Run.doc.examples"
|
section "Run.doc.examples"
|
||||||
|
|
||||||
# Matplotlib settings - do not show figures during doc examples
|
# Matplotlib settings - do not show figures during doc examples
|
||||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
if [[ $PY == 2.7* ]]; then
|
||||||
MPL_DIR=$HOME/.matplotlib
|
MPL_DIR=$HOME/.matplotlib
|
||||||
else
|
else
|
||||||
MPL_DIR=$HOME/.config/matplotlib
|
MPL_DIR=$HOME/.config/matplotlib
|
||||||
@@ -96,7 +104,7 @@ for f in doc/examples/applications/*.py; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Now configure Matplotlib to use Qt4
|
# Now configure Matplotlib to use Qt4
|
||||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
if [[ $PY == 2.7* ]]; then
|
||||||
MPL_QT_API=PyQt4
|
MPL_QT_API=PyQt4
|
||||||
export QT_API=pyqt
|
export QT_API=pyqt
|
||||||
else
|
else
|
||||||
@@ -112,7 +120,7 @@ section_end "Run.doc.applications"
|
|||||||
section "Test.with.optional.dependencies"
|
section "Test.with.optional.dependencies"
|
||||||
|
|
||||||
# run tests again with optional dependencies to get more coverage
|
# run tests again with optional dependencies to get more coverage
|
||||||
if [[ $TRAVIS_PYTHON_VERSION == 3.3 ]]; then
|
if [[ $PY == 3.3 ]]; then
|
||||||
TEST_ARGS="$TEST_ARGS --with-cov --cover-package skimage"
|
TEST_ARGS="$TEST_ARGS --with-cov --cover-package skimage"
|
||||||
fi
|
fi
|
||||||
nosetests $TEST_ARGS
|
nosetests $TEST_ARGS
|
||||||
|
|||||||
Reference in New Issue
Block a user