Skip to content

Commit df6c04a

Browse files
committed
Address code review
1 parent 4ce6a08 commit df6c04a

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

doc/source/user_guide/skimage2_migration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ The functions
130130
are deprecated in favor of counterparts in `skimage2.morphology` with new behavior:
131131

132132
- All functions now default to `mode='ignore'` (was `mode='reflect'`).
133-
- Additionally, `skimage.morphology.dilation`, `skimage.morphology.closing`, and `skimage.morphology.black_tophat` now also mirror the footprint (invert its order in each dimension).
133+
- Additionally, `skimage2.morphology.dilation`, `skimage2.morphology.closing`, and `skimage2.morphology.black_tophat` now also mirror the footprint (invert its order in each dimension).
134134
Note this only impacts behavior for asymmetric/eccentric footprints.
135135

136136
:::{admonition} Background for changes
137137
:class: note dropdown
138138

139139
The new behavior ensures that `closing` and `opening` (the composition of `erosion` and `dilation`) behave _extensive_ and _anti-extensive_ by default.
140-
It also aligns the behavior for asymmetric/eccentric footprints with SciPy's `scipy.ndimage.grey_*` functions.
140+
This change also aligns the behavior for asymmetric/eccentric footprints with SciPy's `scipy.ndimage.grey_*` functions.
141141

142142
Refer to [gh-6665](https://github.com/scikit-image/scikit-image/issues/6665), [gh-6676](https://github.com/scikit-image/scikit-image/issues/6676), [gh-8046](https://github.com/scikit-image/scikit-image/pull/8046), and [gh-8060](https://github.com/scikit-image/scikit-image/pull/8060) for more details.
143143
:::

src/skimage/morphology/gray.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
`skimage.morphology.{name}` is deprecated in favor of
4141
`skimage2.morphology.{name}` which changes the default value for parameter
4242
`mode` to 'ignore' (was 'reflect'). It also mirrors the `footprint`
43-
(inverts its order in each dimension) which aligns its behavior with
44-
`scipy.ndimage.grey_{name}`.
43+
(inverts its order in each dimension) which aligns its behavior with SciPy's
44+
conventions.
4545
4646
To keep the old (`skimage`, v1.x) behavior:
4747
- Set `mode='reflect'` explicitly. If you set it explicitly before,
@@ -73,7 +73,7 @@ def _patch_footprint_mirroring(footprint):
7373
-----
7474
Inside `scipy.ndimage.grey_dilation` the footprint is inverted/mirrored.
7575
This inversion is intentional so that the composition of erosion and
76-
dilation lead to a correct closing and opening.
76+
dilation leads to a correct closing and opening.
7777
7878
`skimage.morphology.dilation` accidentally undoes this by mirroring
7979
the footprint, before passing it to `scipy.ndimage.grey_dilation`.

src/skimage2/morphology/_grayscale_operators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def _apply_decomposed(*, operator, image, footprints, out, mode, cval):
2121
Parameters
2222
----------
2323
operator : Callable
24-
Morphological operator with the signature
25-
``f(image, *, footprint, output, mode, cval) -> image``.
24+
Morphological operator with signature
25+
``f(image, *, footprint, out, mode, cval) -> image``.
2626
image : ndarray
2727
The image to apply the operator to.
2828
footprints : tuple

tests/skimage2/morphology/test_grayscale_operators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ def test_dilate_erode_symmetry(self):
161161
eroded = gray.erosion(self.black_pixel, footprint=footprint)
162162

163163
# Dilation mirrors footprint internally so that closing is extensive
164-
# and opening anti-extensive. To receive a symmetric result, we need
165-
# to use an asymmetric footprint. Also pad to odd-size before
166-
# mirroring so that correct side is padded with 0.
164+
# and opening anti-extensive. To get a symmetric result, we need to
165+
# use an asymmetric footprint. Also pad to odd-size before mirroring
166+
# so that correct side is padded with 0.
167167
asym_footprint = mirror_footprint(pad_footprint(footprint, pad_end=False))
168168
dilated = gray.dilation(self.white_pixel, footprint=asym_footprint)
169169

0 commit comments

Comments
 (0)