Skip to content

Port gaussian to skimage2.filters#8069

Open
lagru wants to merge 12 commits intoscikit-image:mainfrom
lagru:sk2-filters-gaussian
Open

Port gaussian to skimage2.filters#8069
lagru wants to merge 12 commits intoscikit-image:mainfrom
lagru:sk2-filters-gaussian

Conversation

@lagru
Copy link
Copy Markdown
Member

@lagru lagru commented Feb 26, 2026

Description

Previously, gaussian lived in skimage/_shared/ to avoid import circles. Now that lazy loading is established, I don't think that's a problem any more. So I've put it back in skimage2/filters/. If it becomes one, it's easy enough to move the function back to _shared.

In our discussion around preserve_range, we agreed to drop this keyword. We aim to use prescale where the algorithm needs to know about the value range, elsewhere we just explain users how to recover legacy behavior.

  • So we need to expose _rescale_value_range(..., mode="legacy") in skimage2 to enable users to recover the legacy behavior. I propose to do that in another PR and have marked this one as Draft for now. See Add rescaling API to skimage2 #8075

Checklist

Release note

For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.

...

@lagru lagru added this to skimage2 Feb 26, 2026
@lagru lagru added 🔧 type: Maintenance Refactoring and maintenance of internals 🥾 Path to skimage2 A step towards the new "API 2.0" labels Feb 26, 2026
@github-project-automation github-project-automation bot moved this to To Do in skimage2 Feb 26, 2026
@lagru lagru moved this to Stalled in Work pitches Mar 12, 2026
@lagru lagru self-assigned this Mar 12, 2026
@lagru lagru moved this from Stalled to Doing in Work pitches Mar 19, 2026
@lagru lagru marked this pull request as ready for review March 23, 2026 13:25
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 23, 2026

Reviews (1): Last reviewed commit: "Apply commit hooks" | Re-trigger Greptile

Comment on lines +10 to +13
# skimage2.filters.gaussian ------------------------------------------------------------


def test_gaussian_negative_sigma():
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why I like using classes to group test together.

Without doing that and if I want to be able to use something like pytest -k 'gaussian' effectively, I need to insert the common prefix in every test function name. And I need a comment to separate test groups at a quick glance.

Given all that I don't see what's so bad about having a test class. "We don't do classes anymore" doesn't really seem like a constructive argument that addresses these requirements. 😉

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use file-based grouping and it works fine? 🤷 ie if you make one file per test class, it becomes exactly equivalent. pytest -k GaussianClass becomes pytest src/skimage2/filters/_tests/test_gaussian.py. I can see that it's more of a pain to type once, but on the other hand, you get autocomplete, so 🤷

@lagru lagru moved this from Doing to Review in Work pitches Mar 23, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 23, 2026

Reviews (2): Last reviewed commit: "Address oversights" | Re-trigger Greptile

@lagru lagru moved this from Review to Doing in Work pitches Mar 23, 2026
which is now raised internally by `gaussian`.
Comment on lines 105 to 109
mask = gaussian(
mask,
sigma=0.25 * min_length * blob_size_fraction,
preserve_range=False,
mode=boundary_mode,
mask, sigma=0.25 * min_length * blob_size_fraction, mode=boundary_mode
)
threshold = np.quantile(mask, 1 - volume_fraction)
blobs = mask >= threshold
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just use gaussian from skimage2 here without having to worry about preserve range because the thresholding is insensitive to the value range of the smoothed mask.

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 23, 2026

Reviews (3): Last reviewed commit: "Fix tests that are sensitive to PendingS..." | Re-trigger Greptile

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 24, 2026

Reviews (4): Last reviewed commit: "Fix warning sensitive test_list_sigma" | Re-trigger Greptile

@lagru lagru moved this from Doing to Review in Work pitches Mar 24, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 10, 2026

Reviews (5): Last reviewed commit: "Fix references to moved skimage._shared" | Re-trigger Greptile

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 10, 2026

Tip:

Greploop — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.

Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🥾 Path to skimage2 A step towards the new "API 2.0" 🔧 type: Maintenance Refactoring and maintenance of internals

Projects

Status: Review
Status: To Do

Development

Successfully merging this pull request may close these issues.

2 participants