Use max_size in remove_small_(holes|objects)#7739
Merged
mkcor merged 12 commits intoscikit-image:mainfrom Mar 17, 2025
Merged
Conversation
In 0.16, in remove_small_holes, min_size has been replaced definitely by area_threshold. But for remove_small_objects, it is still min_size. This attempts to solve that inconsistency. Having dug through the past issues and discussions on this, it seems to me that each discussed option will be a trade-off between consistency and matching the context of each function. Since remove_small_objects and remove_small_holes are so similar, I definitely give consistency more weight. Ignoring past deprecations, min_size seems to be the least controversial option. The main argument against it was that we'd have to revert a previous deprecation. That's not ideal, but addressing previous mistakes is precisely what skimage2 is about. So, I propose to deprecate area_threshold in remove_small_holes back to min_size and only finalize the deprecation in 2.0.0. I think we can keep using area_threshold in area_opening and area_closing, since area is a prominent term and I anticipate less user confusion.
stefanv
reviewed
Mar 7, 2025
> From remove_small_holes(a, min_size=...), I don't think a user can > figure out what min_size means, whereas > remove_small_holes(a, max_size=...) reads pretty clearly as > "remove small holes, but don't go beyond max_size". – Stéfan
area_threshold in remove_small_holesmax_size in remove_small_(holes|objects)
Co-authored-by: Stefan van der Walt <github@mentat.za.net>
mkcor
reviewed
Mar 11, 2025
Member
mkcor
left a comment
There was a problem hiding this comment.
I'll submit this for now, seeing that I'm supposed to refresh the page of changed files.
as a side effect, the existing argument "connectivity" can be made keyword-only as well.
2997be7 to
332e86c
Compare
mkcor
reviewed
Mar 11, 2025
Member
mkcor
left a comment
There was a problem hiding this comment.
Thanks, @lagru!
I noticed there was a strange sentence under Notes for function remove_small_holes ("It is suggested that labeling is completed after using this function.") but this is probably being the scope of this PR. I'm happy to create an issue for this, so it doesn't fall in the cracks.
Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org>
Co-authored-by: Stefan van der Walt <github@mentat.za.net>
Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org>
stefanv
reviewed
Mar 12, 2025
stefanv
approved these changes
Mar 12, 2025
Co-authored-by: Stefan van der Walt <stefanv@berkeley.edu>
lagru
commented
Mar 16, 2025
lagru
commented
Mar 16, 2025
lagru
commented
Mar 16, 2025
Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org>
Member
Author
|
Thanks for catching the places were I forgot to decrement the |
Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org>
1f616da to
41fd0d9
Compare
lagru
added a commit
that referenced
this pull request
Jan 14, 2026
…s deprecation (#8003) Fixes #8001 The renaming of `min_size`/`area_threshold` to `max_size` in #7739 was actually accompanied by a change in behaviour for the same value, due to using `>` in the old nomenclature and `>=` in the new one. Unfortunately our deprecation machinery was until now not smart enough to know whether a renamed parameter was provided under its old name or its new name. To address this, this PR: - Updates the deprecation machinery to detect when a parameter was given with the old name/position, and - Uses this updated machinery to modify `min_size`/`area_threshold` by 1 to ensure that the new behaviour matches the old one. Co-authored-by: Jeremy Muhlich <jmuhlich@bitflood.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #4003.
In 0.16, in
skimage.morphology.remove_small_holes,min_sizehas been replaced definitely byarea_threshold. But forskimage.morphology.remove_small_objects, it is stillmin_size. This attempts to solve that inconsistency by using a more sensiblemax_sizeparameter for both. At the same time, this threshold is now inclusive, meaning objects equal to it will be removed as well.— #4003 (comment)
This comment got two thumbs up so I'm going with that suggestion.
Checklist
./doc/examplesfor new featuresRelease note
For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.