mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-20 12:40:31 +08:00
Change import to silence import errors in docs.
`import skimage` in submodules seems to cause issues with Sphinx autodocs. (Maybe some sort of circular import issue.) Note the `ImportErrors` fixed by this commit don't actually cause sphinx build errors; Sphinx seems to capture the errors, but it's annoyingly noisy, nonetheless.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import numpy as np
|
||||
|
||||
import skimage
|
||||
from skimage import img_as_float
|
||||
from skimage.util.dtype import dtype_range
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ def equalize(image, nbins=256):
|
||||
.. [2] http://en.wikipedia.org/wiki/Histogram_equalization
|
||||
|
||||
"""
|
||||
image = skimage.img_as_float(image)
|
||||
image = img_as_float(image)
|
||||
cdf, bin_centers = cumulative_distribution(image, nbins)
|
||||
out = np.interp(image.flat, bin_centers, cdf)
|
||||
return out.reshape(image.shape)
|
||||
|
||||
@@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import warnings
|
||||
import numpy as np
|
||||
import skimage
|
||||
from skimage import img_as_ubyte
|
||||
|
||||
from . import cmorph
|
||||
|
||||
@@ -63,8 +63,8 @@ def erosion(image, selem, out=None, shift_x=False, shift_y=False):
|
||||
|
||||
if image is out:
|
||||
raise NotImplementedError("In-place erosion not supported!")
|
||||
image = skimage.img_as_ubyte(image)
|
||||
selem = skimage.img_as_ubyte(selem)
|
||||
image = img_as_ubyte(image)
|
||||
selem = img_as_ubyte(selem)
|
||||
return cmorph.erode(image, selem, out=out,
|
||||
shift_x=shift_x, shift_y=shift_y)
|
||||
|
||||
@@ -115,8 +115,8 @@ def dilation(image, selem, out=None, shift_x=False, shift_y=False):
|
||||
|
||||
if image is out:
|
||||
raise NotImplementedError("In-place dilation not supported!")
|
||||
image = skimage.img_as_ubyte(image)
|
||||
selem = skimage.img_as_ubyte(selem)
|
||||
image = img_as_ubyte(image)
|
||||
selem = img_as_ubyte(selem)
|
||||
return cmorph.dilate(image, selem, out=out,
|
||||
shift_x=shift_x, shift_y=shift_y)
|
||||
|
||||
@@ -262,7 +262,7 @@ def white_tophat(image, selem, out=None):
|
||||
"""
|
||||
if image is out:
|
||||
raise NotImplementedError("Cannot perform white top hat in place.")
|
||||
image = skimage.img_as_ubyte(image)
|
||||
image = img_as_ubyte(image)
|
||||
|
||||
out = opening(image, selem, out=out)
|
||||
out = image - out
|
||||
@@ -312,7 +312,7 @@ def black_tophat(image, selem, out=None):
|
||||
|
||||
if image is out:
|
||||
raise NotImplementedError("Cannot perform white top hat in place.")
|
||||
image = skimage.img_as_ubyte(image)
|
||||
image = img_as_ubyte(image)
|
||||
|
||||
out = closing(image, selem, out=out)
|
||||
out = out - image
|
||||
|
||||
Reference in New Issue
Block a user