Skip to content

Add morphological gradient, white top-hat, and black top-hat#1026

Merged
brendancol merged 4 commits into
masterfrom
issue-1025
Mar 18, 2026
Merged

Add morphological gradient, white top-hat, and black top-hat#1026
brendancol merged 4 commits into
masterfrom
issue-1025

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • Adds morph_gradient, morph_white_tophat, and morph_black_tophat to xrspatial.morphology
  • Each composes existing erode/dilate/opening/closing via DataArray subtraction, so all four backends work without new kernel code
  • 27 new tests (correctness, NaN propagation, edge cases, dataset support, all backends)

Closes #1025

Test plan

  • 27 new tests in test_morphology_derived.py pass
  • 32 existing morphology tests still pass (59 total)
  • Verify notebook 17 renders correctly with the new gradient/top-hat sections

Compose existing erode/dilate/opening/closing operations to implement
the three standard derived morphological operators. All four backends
are supported via DataArray-level arithmetic.
…1025)

27 tests covering correctness, NaN propagation, edge cases, dataset
support, and all four backends (numpy, dask, cupy, dask+cupy).
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Mar 18, 2026
@brendancol brendancol merged commit c6c4f97 into master Mar 18, 2026
11 checks passed
@brendancol brendancol deleted the issue-1025 branch May 4, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add morphological gradient, white top-hat, and black top-hat

1 participant