Skip to content

Commit 8f11962

Browse files
committed
Fix merge conflicts
2 parents a73d7c2 + ecfaf22 commit 8f11962

File tree

21 files changed

+132
-134
lines changed

21 files changed

+132
-134
lines changed

.github/workflows/typing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
run: |
4848
echo -e "## docstub output\n\`\`\`" >> $GITHUB_STEP_SUMMARY
4949
(set -o pipefail && \
50-
docstub run --verbose --group-errors --allow-errors=989 \
51-
--out-dir ${MYPYPATH}/skimage src/skimage/ \
50+
docstub run --verbose --group-errors --allow-errors=947 \
51+
--workers -1 --out-dir ${MYPYPATH}/skimage src/skimage/ \
5252
2>&1 | tee -a $GITHUB_STEP_SUMMARY)
5353
echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY
5454

src/skimage/draw/_polygon2mask.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ def polygon2mask(image_shape, polygon):
1010
----------
1111
image_shape : tuple of size 2
1212
The shape of the mask.
13-
polygon : (N, 2) array_like
14-
The polygon coordinates of shape (N, 2) where N is
15-
the number of points. The coordinates are (row, column).
13+
polygon : array_like of shape (N, 2)
14+
The polygon coordinates, where N is the number of points.
15+
The coordinates are (row, column).
1616
1717
Returns
1818
-------

src/skimage/feature/_hog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _hog_channel_gradient(channel):
2626
2727
Parameters
2828
----------
29-
channel : (M, N) ndarray
29+
channel : ndarray of shape (M, N)
3030
Grayscale image or one of image channel.
3131
3232
Returns

src/skimage/feature/corner.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ def shape_index(image, sigma=1, mode='constant', cval=0):
548548
549549
Parameters
550550
----------
551-
image : (M, N) ndarray
551+
image : ndarray of shape (M, N)
552552
Input image.
553553
sigma : float, optional
554554
Standard deviation used for the Gaussian kernel, which is used for
@@ -613,7 +613,7 @@ def corner_kitchen_rosenfeld(image, mode='constant', cval=0):
613613
614614
Parameters
615615
----------
616-
image : (M, N) ndarray
616+
image : ndarray of shape (M, N)
617617
Input image.
618618
mode : {'constant', 'reflect', 'wrap', 'nearest', 'mirror'}, optional
619619
How to handle values outside the image borders.
@@ -670,7 +670,7 @@ def corner_harris(image, method='k', k=0.05, eps=1e-6, sigma=1):
670670
671671
Parameters
672672
----------
673-
image : (M, N) ndarray
673+
image : ndarray of shape (M, N)
674674
Input image.
675675
method : {'k', 'eps'}, optional
676676
Method to compute the response image from the auto-correlation matrix.
@@ -746,7 +746,7 @@ def corner_shi_tomasi(image, sigma=1):
746746
747747
Parameters
748748
----------
749-
image : (M, N) ndarray
749+
image : ndarray of shape (M, N)
750750
Input image.
751751
sigma : float, optional
752752
Standard deviation used for the Gaussian kernel, which is used as
@@ -809,7 +809,7 @@ def corner_foerstner(image, sigma=1):
809809
810810
Parameters
811811
----------
812-
image : (M, N) ndarray
812+
image : ndarray of shape (M, N)
813813
Input image.
814814
sigma : float, optional
815815
Standard deviation used for the Gaussian kernel, which is used as
@@ -882,7 +882,7 @@ def corner_fast(image, n=12, threshold=0.15):
882882
883883
Parameters
884884
----------
885-
image : (M, N) ndarray
885+
image : ndarray of shape (M, N)
886886
Input image.
887887
n : int, optional
888888
Minimum number of consecutive pixels out of 16 pixels on the circle
@@ -954,7 +954,7 @@ def corner_subpix(image, corners, window_size=11, alpha=0.99):
954954
955955
Parameters
956956
----------
957-
image : (M, N) ndarray
957+
image : ndarray of shape (M, N)
958958
Input image.
959959
corners : (K, 2) ndarray
960960
Corner coordinates `(row, col)`.
@@ -1144,7 +1144,7 @@ def corner_peaks(
11441144
11451145
Parameters
11461146
----------
1147-
image : (M, N) ndarray
1147+
image : ndarray of shape (M, N)
11481148
Input image.
11491149
min_distance : int, optional
11501150
The minimal allowed distance separating peaks.
@@ -1246,7 +1246,7 @@ def corner_moravec(image, window_size=1):
12461246
12471247
Parameters
12481248
----------
1249-
image : (M, N) ndarray
1249+
image : ndarray of shape (M, N)
12501250
Input image.
12511251
window_size : int, optional
12521252
Window size.

src/skimage/filters/_median.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,44 @@ def median(
1616
image : array-like
1717
Input image.
1818
footprint : ndarray, optional
19-
If ``behavior=='rank'``, ``footprint`` is a 2-D array of 1's and 0's.
20-
If ``behavior=='ndimage'``, ``footprint`` is a N-D array of 1's and 0's
21-
with the same number of dimension than ``image``.
22-
If None, ``footprint`` will be a N-D array with 3 elements for each
23-
dimension (e.g., vector, square, cube, etc.)
24-
out : ndarray, (same dtype as image), optional
25-
If None, a new array is allocated.
26-
mode : {'reflect', 'constant', 'nearest', 'mirror','‘wrap'}, optional
19+
If ``behavior='rank'``, `footprint` is a 2-D array of 1's and 0's.
20+
If ``behavior='ndimage'``, `footprint` is a N-D array of 1's and 0's
21+
with the same number of dimensions as `image`.
22+
If None, `footprint` will be a N-D array with 3 elements for each
23+
dimension (e.g., vector, square, cube, etc.).
24+
out : ndarray, optional
25+
If None, a new array is allocated. For ``behavior='ndimage'``,
26+
dtype matches input. For ``behavior='rank'``, dtype follows
27+
:func:`skimage.filters.rank.median`.
28+
mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional
2729
The mode parameter determines how the array borders are handled, where
28-
``cval`` is the value when mode is equal to 'constant'.
30+
`cval` is the value when `mode` is equal to 'constant'.
2931
Default is 'nearest'.
3032
3133
.. versionadded:: 0.15
32-
``mode`` is used when ``behavior='ndimage'``.
34+
`mode` is used when ``behavior='ndimage'``.
3335
cval : scalar, optional
34-
Value to fill past edges of input if mode is 'constant'. Default is 0.0
36+
Value to fill past edges of input `image` if `mode` is 'constant'.
37+
Default is 0.0.
3538
3639
.. versionadded:: 0.15
37-
``cval`` was added in 0.15 is used when ``behavior='ndimage'``.
40+
`cval` was added in 0.15 and is used when ``behavior='ndimage'``.
3841
behavior : {'ndimage', 'rank'}, optional
39-
Either to use the old behavior (i.e., < 0.15) or the new behavior.
40-
The old behavior will call the :func:`skimage.filters.rank.median`.
41-
The new behavior will call the :func:`scipy.ndimage.median_filter`.
42+
Whether to use the old (i.e., scikit-image < 0.15) or the new behavior.
43+
The old behavior will call :func:`skimage.filters.rank.median`.
44+
The new behavior will call :func:`scipy.ndimage.median_filter`.
4245
Default is 'ndimage'.
4346
4447
.. versionadded:: 0.15
45-
``behavior`` is introduced in 0.15
48+
`behavior` is introduced in v0.15.
4649
.. versionchanged:: 0.16
47-
Default ``behavior`` has been changed from 'rank' to 'ndimage'
50+
Default `behavior` has been changed from 'rank' to 'ndimage'.
4851
4952
Returns
5053
-------
51-
out : 2-D array, same dtype as input `image`
52-
Output image.
54+
out : ndarray
55+
Output image. For ``behavior='ndimage'``, dtype matches input. For
56+
``behavior='rank'``, dtype follows :func:`skimage.filters.rank.median`.
5357
5458
See also
5559
--------
@@ -59,11 +63,9 @@ def median(
5963
6064
Examples
6165
--------
62-
>>> from skimage import data
63-
>>> from skimage.morphology import disk
64-
>>> from skimage.filters import median
65-
>>> img = data.camera()
66-
>>> med = median(img, disk(5))
66+
>>> import skimage as ski
67+
>>> img = ski.data.camera()
68+
>>> med = ski.filters.median(img, ski.morphology.disk(5))
6769
6870
"""
6971
if behavior == 'rank':

src/skimage/filters/lpi_filter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __call__(self, data):
120120
121121
Parameters
122122
----------
123-
data : (M, N) ndarray
123+
data : ndarray of shape (M, N)
124124
125125
"""
126126
check_nD(data, 2, 'data')
@@ -137,7 +137,7 @@ def filter_forward(
137137
138138
Parameters
139139
----------
140-
data : (M, N) ndarray
140+
data : ndarray of shape (M, N)
141141
Input data.
142142
impulse_response : callable `f(r, c, **filter_params)`
143143
Impulse response of the filter. See LPIFilter2D.__init__.
@@ -177,7 +177,7 @@ def filter_inverse(
177177
178178
Parameters
179179
----------
180-
data : (M, N) ndarray
180+
data : ndarray of shape (M, N)
181181
Input data.
182182
impulse_response : callable `f(r, c, **filter_params)`
183183
Impulse response of the filter. See :class:`~.LPIFilter2D`. This is a required
@@ -222,7 +222,7 @@ def wiener(
222222
223223
Parameters
224224
----------
225-
data : (M, N) ndarray
225+
data : ndarray of shape (M, N)
226226
Input data.
227227
K : float or (M, N) ndarray
228228
Ratio between power spectrum of noise and undegraded

src/skimage/filters/rank/_percentile.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ def autolevel_percentile(
116116
def gradient_percentile(
117117
image, footprint, out=None, mask=None, shift_x=0, shift_y=0, p0=0, p1=1
118118
):
119-
"""Return local gradient of an image (i.e. local maximum - local minimum).
119+
"""Return local gradient of an image (i.e., local maximum - local minimum).
120120
121121
Only grayvalues between percentiles [p0, p1] are considered in the filter.
122122
123123
Parameters
124124
----------
125-
image : 2-D array (uint8, uint16)
125+
image : ndarray of shape (M, N) and dtype (uint8 or uint16)
126126
Input image.
127127
footprint : ndarray
128128
The neighborhood expressed as a 2-D array of 1's and 0's.
129-
out : 2-D array, same dtype as input `image`
129+
out : ndarray of shape (M, N) and dtype int
130130
If None, a new array is allocated.
131131
mask : ndarray
132132
Mask array that defines (>0) area of the image included in the local
@@ -140,7 +140,7 @@ def gradient_percentile(
140140
141141
Returns
142142
-------
143-
out : 2-D array, same dtype as input `image`
143+
out : ndarray of shape (M, N) and dtype int
144144
Output image.
145145
146146
"""
@@ -167,11 +167,11 @@ def mean_percentile(
167167
168168
Parameters
169169
----------
170-
image : 2-D array (uint8, uint16)
170+
image : ndarray of shape (M, N) and dtype (uint8 or uint16)
171171
Input image.
172172
footprint : ndarray
173173
The neighborhood expressed as a 2-D array of 1's and 0's.
174-
out : 2-D array, same dtype as input `image`
174+
out : ndarray of shape (M, N) and dtype int
175175
If None, a new array is allocated.
176176
mask : ndarray
177177
Mask array that defines (>0) area of the image included in the local
@@ -185,7 +185,7 @@ def mean_percentile(
185185
186186
Returns
187187
-------
188-
out : 2-D array, same dtype as input `image`
188+
out : ndarray of shape (M, N) and dtype int
189189
Output image.
190190
191191
"""

src/skimage/filters/rank/generic.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,11 +1694,11 @@ def majority(
16941694
16951695
Parameters
16961696
----------
1697-
image : ndarray of dtype (uint8 or uint16)
1697+
image : ndarray of dtype (int or float)
16981698
Image array.
16991699
footprint : 2-D array (integer or float)
17001700
The neighborhood expressed as a 2-D array of 1's and 0's.
1701-
out : ndarray, same dtype as input `image`, optional
1701+
out : ndarray of dtype int, optional
17021702
If None, a new array will be allocated.
17031703
mask : ndarray of dtype (int or float), optional
17041704
Mask array that defines (>0) area of the image included in the local
@@ -1709,20 +1709,18 @@ def majority(
17091709
17101710
Returns
17111711
-------
1712-
out : ndarray, same dtype as input `image`
1712+
out : ndarray of dtype int, optional
17131713
Output image.
17141714
17151715
Examples
17161716
--------
1717-
>>> from skimage import data
1718-
>>> from skimage.filters.rank import majority
1719-
>>> from skimage.morphology import disk, ball
17201717
>>> import numpy as np
1721-
>>> img = data.camera()
1718+
>>> import skimage as ski
1719+
>>> img = ski.data.camera()
17221720
>>> rng = np.random.default_rng()
1723-
>>> volume = rng.integers(0, 255, size=(10,10,10), dtype=np.uint8)
1724-
>>> maj_img = majority(img, disk(5))
1725-
>>> maj_img_vol = majority(volume, ball(5))
1721+
>>> volume = rng.integers(0, 255, size=(10, 10, 10), dtype=np.uint8)
1722+
>>> maj_img = ski.filters.rank.majority(img, ski.morphology.disk(5))
1723+
>>> maj_img_vol = ski.filters.rank.majority(volume, ski.morphology.ball(5))
17261724
17271725
"""
17281726

src/skimage/filters/thresholding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _try_all(image, methods=None, figsize=None, num_cols=2, verbose=True):
4444
4545
Parameters
4646
----------
47-
image : (M, N) ndarray
47+
image : ndarray of shape (M, N)
4848
Input image.
4949
methods : dict, optional
5050
Names and associated functions.
@@ -114,7 +114,7 @@ def try_all_threshold(image, figsize=(8, 5), verbose=True):
114114
115115
Parameters
116116
----------
117-
image : (M, N) ndarray
117+
image : ndarray of shape (M, N)
118118
Input image.
119119
figsize : tuple, optional
120120
Figure size (in inches).

src/skimage/measure/_colocalization.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def pearson_corr_coeff(image0, image1, mask=None):
1717
1818
Parameters
1919
----------
20-
image0 : (M, N) ndarray
20+
image0 : ndarray of shape (M, N)
2121
Image of channel A.
22-
image1 : (M, N) ndarray
22+
image1 : ndarray of shape (M, N)
2323
Image of channel 2 to be correlated with channel B.
2424
Must have same dimensions as `image0`.
2525
mask : (M, N) ndarray of dtype bool, optional
@@ -102,7 +102,7 @@ def manders_coloc_coeff(image0, image1_mask, mask=None):
102102
103103
Parameters
104104
----------
105-
image0 : (M, N) ndarray
105+
image0 : ndarray of shape (M, N)
106106
Input image (first channel). All pixel values should be non-negative.
107107
image1_mask : (M, N) ndarray of dtype bool
108108
Binary image giving the regions of interest in the second channel.
@@ -185,15 +185,13 @@ def manders_overlap_coeff(image0, image1, mask=None):
185185
186186
Parameters
187187
----------
188-
image0 : (M, N) ndarray
188+
image0 : ndarray of shape (M, N)
189189
Image of channel A. All pixel values should be non-negative.
190-
image1 : (M, N) ndarray
190+
image1 : ndarray of shape (M, N)
191191
Image of channel B. All pixel values should be non-negative.
192-
Must have same dimensions as `image0`
193-
mask : (M, N) ndarray of dtype bool, optional
192+
mask : ndarray of shape (M, N) and dtype bool, optional
194193
Only `image0` and `image1` pixel values within this region of interest
195194
mask are included in the calculation.
196-
Must have ♣same dimensions as `image0`.
197195
198196
Returns
199197
-------

0 commit comments

Comments
 (0)