Add rescaling API to skimage2#8075
Merged
lagru merged 13 commits intoscikit-image:mainfrom Mar 19, 2026
Merged
Conversation
stefanv
reviewed
Mar 13, 2026
Member
stefanv
left a comment
There was a problem hiding this comment.
LGTM; we just need to fix the names. Left some minor docstring comments too.
If we ever change this, we don't risk forgetting both places.
This is fine according to our recently proposed import hierarchy.
Co-authored-by: Stefan van der Walt <github@mentat.za.net>
Co-authored-by: Stefan van der Walt <github@mentat.za.net>
lagru
commented
Mar 17, 2026
| import numpy as np | ||
|
|
||
|
|
||
| def rescale_minmax(image): |
Member
Author
There was a problem hiding this comment.
Should we try upstreaming this function to NumPy (or SciPy)? Might be to "trivial" but the handling of overflow errors might make it worth it? And convenience functions still have their place...
Contributor
There was a problem hiding this comment.
Might be worth it, but I suspect the (0, 1) range is too specific. My guess is that it might be attractive if we had a range parameter with desired min and max.
stefanv
reviewed
Mar 19, 2026
stefanv
approved these changes
Mar 19, 2026
matthew-brett
added a commit
that referenced
this pull request
Apr 10, 2026
* origin/main: (27 commits) Move `_shared` to `_skimage2` (#8102) Port `pad_footprint` & `mirror_footprint` to `skimage2` (#8094) Add rescaling API to skimage2 (#8075) Move `skimage2` implementation into `_skimage2` (#8093) Undo (double) mirroring in `ski2.morphology.dilation` (#8060) Grammar (#8091) Move `ensure_spacing` into `skimage2` (#8067) Ensure that `skimage2` does not eagerly import `skimage` (#8087) Use lazy-loader 0.5 (#8080) MAINT: make ellipse fitting forward compatible (#8054) Avoid deprecated assign to ndarray.shape (#8020) Avoid circular import in `feature/corner.py` (#8077) Turn off coderabbit auto-labeling & label checks (#8070) Fix GIL being re-enabled by C++ extensions (#8059) Fix conventions following docstub and misc. (#8055) Port grayscale morphology operators to skimage2 (#8046) Add revised `peak_local_max` to `skimage2` (#8039) Allow read-only arrays as input to remap (#7535) Add `prescale` parameter to "blob functions" (#7858) Try to make coderabbit respect exisiting type labels (#8042) ...
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
This PR ports the current implementation of
_rescale_value_rangeand_minmax_scale_value_rangetoskimage2. We want this functionality early so that we can craft nice migration advice for function that usepreserve_rangeor the newprescaleAPI.Currently this is a draft. I kept
_rescale_value_rangeinternal, and exposed both modes as the new functionsminmax_rescaleandlegacy_rescale. Somehow I feel that this is is simpler in multiple ways than keeping them in the same do-everything function. Especially, if we decide to add more rescaling modes that might need additional parameters, I think keeping separate function is clearly the better call – remember the discussion around enabling batched scaling with something likeprescale=("minmax", 10, 100).But I'm totally happy to hear and open to other suggestions.
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.