Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Rectangular ROIs #114

Merged
merged 37 commits into from
Feb 14, 2025
Merged

feat: Rectangular ROIs #114

merged 37 commits into from
Feb 14, 2025

Conversation

gselzer
Copy link
Collaborator

@gselzer gselzer commented Jan 21, 2025

This PR brings support for (rectangular) ROIs to the new array viewer. This work was updated from the original viewer, and needs to be cleaned up, but does pass current automated tests and works well in my limited manual testing.

TODO:

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 82.40418% with 101 lines in your changes missing coverage. Please review.

Project coverage is 79.02%. Comparing base (c3cf013) to head (b3cfbf2).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/ndv/views/_jupyter/_app.py 14.28% 24 Missing ⚠️
src/ndv/v1/_old_viewer.py 52.77% 17 Missing ⚠️
src/ndv/views/_qt/_app.py 32.00% 17 Missing ⚠️
src/ndv/views/_pygfx/_array_canvas.py 89.33% 16 Missing ⚠️
src/ndv/views/_wx/_app.py 58.82% 7 Missing ⚠️
src/ndv/controllers/_array_viewer.py 90.56% 5 Missing ⚠️
src/ndv/views/_vispy/_array_canvas.py 96.81% 5 Missing ⚠️
src/ndv/views/_pygfx/_histogram.py 33.33% 2 Missing ⚠️
src/ndv/views/_vispy/_histogram.py 33.33% 2 Missing ⚠️
src/ndv/views/_wx/_array_view.py 86.66% 2 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
+ Coverage   76.81%   79.02%   +2.21%     
==========================================
  Files          49       51       +2     
  Lines        4930     5107     +177     
==========================================
+ Hits         3787     4036     +249     
+ Misses       1143     1071      -72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Necessary for the "click roi button then click and drag" functionality.
Still not happy with this pattern, though...
@gselzer gselzer marked this pull request as ready for review February 4, 2025 16:07
@gselzer
Copy link
Collaborator Author

gselzer commented Feb 5, 2025

Still need to clean up the tests, but I think this is ready for your eyes @tlambert03. Points for discussion:

  • This PR introduces the ArrayViewerModel to maintain gui state - right now, the only field is InteractionMode, but this could house other things (maybe camera state?) in future PRs. I don't really like that name, could rename UIModel...
  • This PR doesn't really account for future needs (i.e. multiple rois, different shapes, etc. as well as a ROI controller to wrangle them) - my thinking was that this could be future PRs. In addition, I was planning on adding in the integrations I want (such as using the ROI to narrow the histogram down to a region) in future PRs.

Copy link
Member

@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

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

i think this is looking very nice, and the runtime behavior is great! I looked most closely at everything outside of the actual vispy and pygx implementations (the general model and hookup of it all). If there was anything about the specific graphics implementations that you want me to take a close look at, go ahead and comment inline.

otherwise, do whatever final cleanup/testing you want to add and then let's get this in!

@gselzer gselzer force-pushed the roi-model branch 3 times, most recently from e3236b7 to 42ed8b3 Compare February 12, 2025 17:45
@gselzer gselzer force-pushed the roi-model branch 2 times, most recently from 1f81888 to 7d3ac57 Compare February 12, 2025 19:51
@gselzer
Copy link
Collaborator Author

gselzer commented Feb 12, 2025

@tlambert03 this morning I got the build working (as best as I could, as you've also noticed tests still segfault sometimes), and added some tests. Let me know what you think of the tests - if you like it, I think this is ready for merge!

@tlambert03 tlambert03 enabled auto-merge (squash) February 14, 2025 17:55
Copy link
Member

@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

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

LGMT! 🚀 automerge is on

@tlambert03 tlambert03 merged commit 24bec3e into pyapp-kit:main Feb 14, 2025
45 of 47 checks passed
@gselzer gselzer mentioned this pull request Feb 20, 2025
@tlambert03 tlambert03 added the enhancement New feature or request label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants