Skip to content

ND, feature transform, tests, performance improvements#58

Open
kevinjohncutler wants to merge 118 commits intoseung-lab:masterfrom
kevinjohncutler:master
Open

ND, feature transform, tests, performance improvements#58
kevinjohncutler wants to merge 118 commits intoseung-lab:masterfrom
kevinjohncutler:master

Conversation

@kevinjohncutler
Copy link
Copy Markdown

Summary

  • Sync legacy sources to upstream commit 672a57c (legacy matches upstream exactly).
  • Add ND feature transform tests (brute-force correctness + distance consistency + dtype/edge cases).
  • Remove temporary upstream snapshot folder.

Testing

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -v

Notes

  • Legacy vs ND ratios remain < 1 in recent bench runs (see benchmarks/legacy_vs_nd_explicit_*.csv if needed).

@kevinjohncutler
Copy link
Copy Markdown
Author

Ok, I have completed my cleanup of the code and addressed all the above concerns and ideas. Ready for review! If everything else looks good, we can strip out the legacy comparisons as a final step.

@william-silversmith
Copy link
Copy Markdown
Contributor

Thank you! I'll dig into the core logic some more. Thank you for all the work you've put into this PR so far!

@kevinjohncutler
Copy link
Copy Markdown
Author

@william-silversmith I think I figured out a way to generalize to any L-norm. Interested in making that part of this PR? Might have to rebrand to "efficient distance transform" or "exact distance transform" haha

@william-silversmith
Copy link
Copy Markdown
Contributor

That's a very interesting idea (it's discussed in the Felzenszwald and Huttenlocher paper I believe), but let's limit the scope of this PR, it's very complex already containing at least 4 different ideas and a full rewrite. Once it goes through, it can be built off of. Appreciate your enthusiasm!

@kevinjohncutler
Copy link
Copy Markdown
Author

kevinjohncutler commented Mar 6, 2026

I happened to drum up an implementation of expand_labels with numba that beat the implementation we had in edt. However, I was able to learn from and surpass the numba implementation, which happened to give the main edt calls a speed boost as well (1.2x on average).

@william-silversmith
Copy link
Copy Markdown
Contributor

Sorry for the delay! Will get to reviewing the core very soon. Just been busy.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature map / return_indices Add N-dimensional Transform

2 participants