mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-18 12:40:14 +08:00
Add examples to docstring
This commit is contained in:
@@ -21,6 +21,28 @@ def remove_small_connected_components(ar, min_size=64,
|
||||
-------
|
||||
out : ndarray, same shape and type as input `ar`
|
||||
The input array with small connected components removed.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> import numpy as np
|
||||
>>> from skimage import morphology
|
||||
>>> from scipy import ndimage as nd
|
||||
>>> a = np.array([[0, 0, 0, 1, 0],
|
||||
... [1, 1, 1, 0, 0],
|
||||
... [1, 1, 1, 0, 1]], bool)
|
||||
>>> b = morphology.remove_small_connected_components(a, 6)
|
||||
>>> b
|
||||
array([[False, False, False, False, False],
|
||||
[ True, True, True, False, False],
|
||||
[ True, True, True, False, False]], dtype=bool)
|
||||
>>> c = morphology.remove_small_connected_components(a, 7, connectivity=2)
|
||||
>>> c
|
||||
array([[False, False, False, True, False],
|
||||
[ True, True, True, False, False],
|
||||
[ True, True, True, False, False]], dtype=bool)
|
||||
>>> d = morphology.remove_small_connected_components(a, 6, in_place=True)
|
||||
>>> d is a
|
||||
True
|
||||
"""
|
||||
structuring_element = nd.generate_binary_structure(ar.ndim, connectivity)
|
||||
if in_place:
|
||||
|
||||
Reference in New Issue
Block a user