DOC: Add imports to doctests to fix errors

This commit is contained in:
Tony S Yu
2012-10-08 20:30:33 -04:00
parent 88d1b85bcf
commit ab2411cd19
+6
View File
@@ -45,6 +45,7 @@ def erosion(image, selem, out=None, shift_x=False, shift_y=False):
Examples
--------
>>> # Erosion shrinks bright regions
>>> import numpy as np
>>> from skimage.morphology import square
>>> bright_square = np.array([[0, 0, 0, 0, 0],
... [0, 1, 1, 1, 0],
@@ -97,6 +98,7 @@ def dilation(image, selem, out=None, shift_x=False, shift_y=False):
Examples
--------
>>> # Dilation enlarges bright regions
>>> import numpy as np
>>> from skimage.morphology import square
>>> bright_pixel = np.array([[0, 0, 0, 0, 0],
... [0, 0, 0, 0, 0],
@@ -146,6 +148,7 @@ def opening(image, selem, out=None):
Examples
--------
>>> # Open up gap between two bright regions (but also shrink regions)
>>> import numpy as np
>>> from skimage.morphology import square
>>> bad_connection = np.array([[1, 0, 0, 0, 1],
... [1, 1, 0, 1, 1],
@@ -196,6 +199,7 @@ def closing(image, selem, out=None):
Examples
--------
>>> # Close a gap between two bright lines
>>> import numpy as np
>>> from skimage.morphology import square
>>> broken_line = np.array([[0, 0, 0, 0, 0],
... [0, 0, 0, 0, 0],
@@ -245,6 +249,7 @@ def white_tophat(image, selem, out=None):
Examples
--------
>>> # Subtract grey background from bright peak
>>> import numpy as np
>>> from skimage.morphology import square
>>> bright_on_grey = np.array([[2, 3, 3, 3, 2],
... [3, 4, 5, 4, 3],
@@ -294,6 +299,7 @@ def black_tophat(image, selem, out=None):
Examples
--------
>>> # Change dark peak to bright peak and subtract background
>>> import numpy as np
>>> from skimage.morphology import square
>>> dark_on_grey = np.array([[7, 6, 6, 6, 7],
... [6, 5, 4, 5, 6],