Fix edge-detection review findings (thresholding, physical gradients, UI)#13
Merged
Conversation
Addresses review findings on the merged Advanced Edge Detection feature: - High: Sobel/Scharr mask thresholding no longer marks the whole image as an edge. A zero percentile cutoff used `magnitude >= cut`, so zero-gradient background became True on flat/sparse-step images. Now requires a strictly positive gradient: `(magnitude >= cut) & (magnitude > 0)`. - High: gradient magnitude/orientation are now physical-space. gradient_filter accepts pixel_size_x_nm/pixel_size_y_nm and scales gx/=dx, gy/=dy before hypot/arctan2; the viewer passes both spacings (was x-only), so anisotropic pixels yield correct values. - Medium: edge->ROI conversion adds a "Fill enclosed regions first" option (default on) so thin boundary masks become solid area ROIs. - Medium: created masks record source_path/source_channel/data_basis so a processed-channel mask is not mistaken for raw-derived later (serialized). - Medium-low: the in-panel "Edge:" dropdown now offers Sobel/Scharr, wiring the history-replayable path end to end (GUI -> ProcessingState -> replay). - UI: edge-detection dialog combos no longer truncate (AdjustToContents + min width on field and popup) and spin-box arrows are enlarged. Adds regression tests for the thresholding fix, physical-gradient scaling, and the replayable Sobel/Scharr chain. Full suite green, ruff clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Follow-up to #12 addressing review findings.
Fixes
magnitude >= cut; a zero percentile cutoff on flat/sparse-step images marked the zero-gradient background as edge. Now(magnitude >= cut) & (magnitude > 0).gradient_filternow takespixel_size_x_nm/pixel_size_y_nmand scalesgx/=dx,gy/=dybeforehypot/arctan2; the viewer passes both spacings (was x-only), so anisotropic pixels give correct magnitude/orientation.source_path/source_channel/data_basis(serialized to the sidecar).Verification
ruff checkclean.🤖 Generated with Claude Code