mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-11 12:43:04 +08:00
Rename and deprecate filter module to prevent shadowing of built-in keyword
This commit is contained in:
@@ -109,7 +109,7 @@ find an elevation map using the Sobel gradient of the image.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter import sobel
|
||||
from skimage.filters import sobel
|
||||
|
||||
elevation_map = sobel(coins)
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ randomly set to 0. The **median** filter is applied to remove the noise.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import median
|
||||
from skimage.filters.rank import median
|
||||
from skimage.morphology import disk
|
||||
|
||||
noise = np.random.random(noisy_image.shape)
|
||||
@@ -107,7 +107,7 @@ image.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import mean
|
||||
from skimage.filters.rank import mean
|
||||
|
||||
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[10, 7])
|
||||
|
||||
@@ -133,11 +133,11 @@ the central one.
|
||||
.. note::
|
||||
|
||||
A different implementation is available for color images in
|
||||
`skimage.filter.denoise_bilateral`.
|
||||
`skimage.filters.denoise_bilateral`.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import mean_bilateral
|
||||
from skimage.filters.rank import mean_bilateral
|
||||
|
||||
noisy_image = img_as_ubyte(data.camera())
|
||||
|
||||
@@ -183,7 +183,7 @@ equalization emphasizes every local gray-level variations.
|
||||
"""
|
||||
|
||||
from skimage import exposure
|
||||
from skimage.filter import rank
|
||||
from skimage.filters import rank
|
||||
|
||||
noisy_image = img_as_ubyte(data.camera())
|
||||
|
||||
@@ -230,7 +230,7 @@ picture.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import autolevel
|
||||
from skimage.filters.rank import autolevel
|
||||
|
||||
noisy_image = img_as_ubyte(data.camera())
|
||||
|
||||
@@ -260,7 +260,7 @@ result.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import autolevel_percentile
|
||||
from skimage.filters.rank import autolevel_percentile
|
||||
|
||||
image = data.camera()
|
||||
|
||||
@@ -298,7 +298,7 @@ otherwise by the minimum local.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import enhance_contrast
|
||||
from skimage.filters.rank import enhance_contrast
|
||||
|
||||
noisy_image = img_as_ubyte(data.camera())
|
||||
|
||||
@@ -330,7 +330,7 @@ percentile *p0* and *p1* instead of the local minimum and maximum.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import enhance_contrast_percentile
|
||||
from skimage.filters.rank import enhance_contrast_percentile
|
||||
|
||||
noisy_image = img_as_ubyte(data.camera())
|
||||
|
||||
@@ -366,19 +366,19 @@ threshold is determined by maximizing the variance between two classes of
|
||||
pixels of the local neighborhood defined by a structuring element.
|
||||
|
||||
The example compares the local threshold with the global threshold
|
||||
`skimage.filter.threshold_otsu`.
|
||||
`skimage.filters.threshold_otsu`.
|
||||
|
||||
.. note::
|
||||
|
||||
Local is much slower than global thresholding. A function for global Otsu
|
||||
thresholding can be found in : `skimage.filter.threshold_otsu`.
|
||||
thresholding can be found in : `skimage.filters.threshold_otsu`.
|
||||
|
||||
.. [4] http://en.wikipedia.org/wiki/Otsu's_method
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import otsu
|
||||
from skimage.filter import threshold_otsu
|
||||
from skimage.filters.rank import otsu
|
||||
from skimage.filters import threshold_otsu
|
||||
|
||||
p8 = data.page()
|
||||
|
||||
@@ -459,7 +459,7 @@ closing and morphological gradient.
|
||||
|
||||
"""
|
||||
|
||||
from skimage.filter.rank import maximum, minimum, gradient
|
||||
from skimage.filters.rank import maximum, minimum, gradient
|
||||
|
||||
noisy_image = img_as_ubyte(data.camera())
|
||||
|
||||
@@ -511,7 +511,7 @@ images.
|
||||
"""
|
||||
|
||||
from skimage import data
|
||||
from skimage.filter.rank import entropy
|
||||
from skimage.filters.rank import entropy
|
||||
from skimage.morphology import disk
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
@@ -549,7 +549,7 @@ from time import time
|
||||
|
||||
from scipy.ndimage.filters import percentile_filter
|
||||
from skimage.morphology import dilation
|
||||
from skimage.filter.rank import median, maximum
|
||||
from skimage.filters.rank import median, maximum
|
||||
|
||||
|
||||
def exec_and_timeit(func):
|
||||
|
||||
@@ -11,7 +11,7 @@ gradient of the image intensity function.
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage.data import camera
|
||||
from skimage.filter import roberts, sobel
|
||||
from skimage.filters import roberts, sobel
|
||||
|
||||
|
||||
image = camera()
|
||||
|
||||
@@ -10,7 +10,7 @@ coded in an image.
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data
|
||||
from skimage.filter.rank import entropy
|
||||
from skimage.filters.rank import entropy
|
||||
from skimage.morphology import disk
|
||||
from skimage.util import img_as_ubyte
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from scipy import ndimage as nd
|
||||
|
||||
from skimage import data
|
||||
from skimage.util import img_as_float
|
||||
from skimage.filter import gabor_kernel
|
||||
from skimage.filters import gabor_kernel
|
||||
|
||||
|
||||
def compute_feats(image, kernels):
|
||||
|
||||
@@ -14,7 +14,7 @@ import numpy as np
|
||||
from scipy import ndimage as nd
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage.filter import sobel
|
||||
from skimage.filters import sobel
|
||||
from skimage.segmentation import slic, join_segmentations
|
||||
from skimage.morphology import watershed
|
||||
from skimage.color import label2rgb
|
||||
|
||||
@@ -17,7 +17,7 @@ import matplotlib.pyplot as plt
|
||||
import matplotlib.patches as mpatches
|
||||
|
||||
from skimage import data
|
||||
from skimage.filter import threshold_otsu
|
||||
from skimage.filters import threshold_otsu
|
||||
from skimage.segmentation import clear_border
|
||||
from skimage.morphology import label, closing, square
|
||||
from skimage.measure import regionprops
|
||||
|
||||
@@ -28,7 +28,7 @@ from skimage.util.dtype import dtype_range
|
||||
from skimage.util import img_as_ubyte
|
||||
from skimage import exposure
|
||||
from skimage.morphology import disk
|
||||
from skimage.filter import rank
|
||||
from skimage.filters import rank
|
||||
|
||||
|
||||
matplotlib.rcParams['font.size'] = 9
|
||||
|
||||
@@ -20,7 +20,7 @@ import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data
|
||||
from skimage.morphology import disk
|
||||
from skimage.filter import threshold_otsu, rank
|
||||
from skimage.filters import threshold_otsu, rank
|
||||
from skimage.util import img_as_ubyte
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import matplotlib.pyplot as plt
|
||||
|
||||
from skimage.morphology import watershed, disk
|
||||
from skimage import data
|
||||
from skimage.filter import rank
|
||||
from skimage.filters import rank
|
||||
from skimage.util import img_as_ubyte
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage.data import camera
|
||||
from skimage.filter import threshold_otsu
|
||||
from skimage.filters import threshold_otsu
|
||||
|
||||
|
||||
matplotlib.rcParams['font.size'] = 9
|
||||
|
||||
@@ -23,7 +23,7 @@ import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data
|
||||
from skimage.morphology import disk
|
||||
from skimage.filter import rank
|
||||
from skimage.filters import rank
|
||||
|
||||
|
||||
image = (data.coins()).astype(np.uint16) * 16
|
||||
|
||||
@@ -18,7 +18,7 @@ local neighborhood minus an offset value.
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data
|
||||
from skimage.filter import threshold_otsu, threshold_adaptive
|
||||
from skimage.filters import threshold_otsu, threshold_adaptive
|
||||
|
||||
|
||||
image = data.page()
|
||||
|
||||
@@ -116,7 +116,7 @@ thresholding. In practice, you might want to define a region for tinting based
|
||||
on segmentation results or blob detection methods.
|
||||
"""
|
||||
|
||||
from skimage.filter import rank
|
||||
from skimage.filters import rank
|
||||
|
||||
# Square regions defined as slices over the first two dimensions.
|
||||
top_left = (slice(100),) * 2
|
||||
|
||||
@@ -13,7 +13,7 @@ extracted and a histogram of its greyscale values is computed.
|
||||
|
||||
Next, for each pixel in the test image, a histogram of the greyscale values in
|
||||
a region of the image surrounding the pixel is computed.
|
||||
`skimage.filter.rank.windowed_histogram` is used for this task, as it employs
|
||||
`skimage.filters.rank.windowed_histogram` is used for this task, as it employs
|
||||
an efficient sliding window based algorithm that is able to compute these
|
||||
histograms quickly [2]_. The local histogram for the region surrounding each
|
||||
pixel in the image is compared to that of the single coin, with a similarity
|
||||
@@ -42,7 +42,7 @@ import matplotlib.pyplot as plt
|
||||
from skimage import data, transform
|
||||
from skimage.util import img_as_ubyte
|
||||
from skimage.morphology import disk
|
||||
from skimage.filter import rank
|
||||
from skimage.filters import rank
|
||||
|
||||
|
||||
matplotlib.rcParams['font.size'] = 9
|
||||
|
||||
Reference in New Issue
Block a user