Add skimage2 version of binary_blobs with updated signature#7976
Add skimage2 version of binary_blobs with updated signature#7976lagru merged 41 commits intoscikit-image:mainfrom
Conversation
This replaces the old `length` and `n_dim` arguments with a single `shape` argument. This allows generating images with varying dimension lengths.
This avoids problems due to different stack depths between the skimage and skimage2 API. We'd have to set a different `stacklevel` depending for skimage2 and skimage.
Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com>
The previous regex would never match because the "__name__" might not be just "skimage" or "skimage2". The new regex also matches "skimage.something".
Might avoid a potentially endless loop if there's an error in the breaking logic of the loop
I think in practice this file is changed far to often for unrelated reasons. Thus resulting in a significant waste of resources (for example #7889 or #7976). We are periodically building and testing wheels for our nightlies. So we should still catch stuff early. And if necessary there's always the option to use a `maintenance/*` branch.
stefanv
left a comment
There was a problem hiding this comment.
I don't understand the blob_size_fraction argument; otherwise all seems well to me. Some minor tweaks required to LICENSE files.
— @jni Sounds useful. Probably not a priority right now but you should create an issue so we don't forget. 😊 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/skimage2/data/_synthetic.py`:
- Around line 108-109: Validate the volume_fraction argument before calling
np.quantile: check that volume_fraction is a numeric scalar and 0 <=
volume_fraction <= 1, and if not raise a ValueError with a clear message
referencing the parameter (e.g. "volume_fraction must be between 0 and 1, got
{value}"). Add this check immediately before the lines computing threshold =
np.quantile(mask, 1 - volume_fraction) / blobs = mask >= threshold so
out-of-range inputs produce a user-friendly error.
mkcor
left a comment
There was a problem hiding this comment.
Thanks for iterating with me, @lagru!
So ski2 it is, perfect!
Thanks for clarifying what the 'API boundary' meant; I get it now. I'm not familiar with the term 'frame' in this context though: Isn't it 'block' as in 'code block?' Or 'code unit?'
I left only minor (wording) suggestions, so I'll go ahead and commit them.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/skimage/_shared/_warnings.py (1)
160-166: Consider documentingcategoryas optional with its default value.The numpydoc format typically includes "optional" and the default value for keyword arguments with defaults.
✍️ Proposed docstring update
Parameters ---------- message : str Warning message. - category : type[Warning] + category : type[Warning], optional The class used in the warning. + Default is ``None``, which emits a ``UserWarning``. """As per coding guidelines, all code should be documented using the NumPy/SciPy docstring standard (numpydoc format).
Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org>
Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org>
Description
Closes #7945. This replaces the old
lengthandn_dimarguments with a singleshapeargument. This allows generating images with varying dimension lengths.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.