Skip to content

feat: stage explorer part 3 #422

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

Merged
merged 22 commits into from
May 4, 2025
Merged

Conversation

fdrgsp
Copy link
Collaborator

@fdrgsp fdrgsp commented May 3, 2025

Third part of the stage explore widget (#400 ) after #420.

Here we add a stage marker to track the position of the microscope stage.

TODO:

  • add tests

Copy link

codecov bot commented May 3, 2025

Codecov Report

Attention: Patch coverage is 87.93103% with 21 lines in your changes missing coverage. Please review.

Project coverage is 90.52%. Comparing base (9a7248f) to head (923b0eb).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
...widgets/control/_stage_explorer/_stage_explorer.py 86.27% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #422      +/-   ##
==========================================
- Coverage   90.59%   90.52%   -0.08%     
==========================================
  Files          88       89       +1     
  Lines        9644     9791     +147     
==========================================
+ Hits         8737     8863     +126     
- Misses        907      928      +21     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tlambert03
Copy link
Member

tlambert03 commented May 4, 2025

just keeps getting better!

the position outline is awesome. I tried to make it "hard" by decreasing the velocity of the demo cam and it works great. But found a small inconsistency: when you double click on a position, it does not poll as it moves, but when you click the stage widget it does. This probably indicates something deeper about how we deal with threading in the two scenarios (and may harken back to #410 ... and indicate that we need more conveniences around slow stage moves), but see what happens here:

Untitled.mov

also, definitely related to #410: if you have snap-on-click selected you no longer see the stage move

@tlambert03
Copy link
Member

another feature request that might as well go in here: I can imagine wanting the position indicator to have 4 possible states:

  1. no outline/indicator at all
  2. outline corresponding to field of view (as done here)
  3. crosshair only marking the stage position (but no outline)
  4. a combination of 2 and 3: crosshairs as well as outline

@tlambert03
Copy link
Member

I'm thinking that this widget might eventually gain so many configurations, that might be worth having a whole ExplorerConfig class:

class ExplorerConfig:
    auto_zoom_to_fit: bool = False
    snap_on_double_click: bool = False
    show_position: Literal[None, 'outline', 'crosshairs', 'crosshairs-with-outline']
    clims: tuple | None
    colormap

(but just thinking out loud... not entirely sure yet)

@fdrgsp
Copy link
Collaborator Author

fdrgsp commented May 4, 2025

This probably indicates something deeper about how we deal with threading...

Yes, exactly...is related to #410 and is because we need to call self._mmc.waitForDevice(self._mmc.getXYStageDevice()) here before taking an image. Otherwise, the image will be snapped as soon as we double-click, not at the position we double-click on.

Screen.Recording.2025-05-03.at.8.52.50.PM.mov

@fdrgsp
Copy link
Collaborator Author

fdrgsp commented May 4, 2025

another feature request that might as well go in here: I can imagine wanting the position indicator to have 4 possible states...

That’s a great idea! I attempted to implement something along those lines:

Screen.Recording.2025-05-04.at.12.52.47.AM.mov

And I agree, it would be good to have an ExplorerConfig once we understand all the options that the widget can have!

@tlambert03
Copy link
Member

this is just lovely. :) i pushed a few small organizational updates in dc07ae3. will keep looking

@tlambert03
Copy link
Member

ok, i just merged it in. we can undo 58ebde9 (or parts of it) if you find issues with it.

@tlambert03
Copy link
Member

i also got rid of _is_stage_marker_out_of_view ... I'm not sure it's necessary? same goes for _is_visual_within_view ... are you attempting to avoid costly performance stuff?

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.

...and, if you're happy with it, go ahead and merge (not worried about the last little bit of test coverage)

@fdrgsp fdrgsp merged commit d14c26c into pymmcore-plus:main May 4, 2025
17 of 18 checks passed
@tlambert03 tlambert03 added the enhancement New feature or request label Jun 10, 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