mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-02 13:03:48 +08:00
Harmonize all ndimage usage across the library
Only two forms remain in use: - `from scipy import ndimage as ndi` - `from scipy.ndimage import function`
This commit is contained in:
@@ -10,7 +10,7 @@ size of the dilation. Locations where the original image is equal to the
|
||||
dilated image are returned as local maxima.
|
||||
|
||||
"""
|
||||
from scipy import ndimage
|
||||
from scipy import ndimage as ndi
|
||||
import matplotlib.pyplot as plt
|
||||
from skimage.feature import peak_local_max
|
||||
from skimage import data, img_as_float
|
||||
@@ -19,7 +19,7 @@ im = img_as_float(data.coins())
|
||||
|
||||
# image_max is the dilation of im with a 20*20 structuring element
|
||||
# It is used within peak_local_max function
|
||||
image_max = ndimage.maximum_filter(im, size=20, mode='constant')
|
||||
image_max = ndi.maximum_filter(im, size=20, mode='constant')
|
||||
|
||||
# Comparison between image_max and im to find the coordinates of local maxima
|
||||
coordinates = peak_local_max(im, min_distance=20)
|
||||
|
||||
Reference in New Issue
Block a user