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

Extend blitting to speed up atlas label editing and image pan/zoom #335

Merged
merged 14 commits into from
Dec 14, 2022

Conversation

yoda-vid
Copy link
Collaborator

@yoda-vid yoda-vid commented Dec 8, 2022

PR #317 applied blitting to improve performance of displaying region labels so that hovering over labels is more responsive. This update broke atlas label editing, however, as the plot does not update. This PR fixes this label editing while also extending blitting to the paint controls and pan/zoom controls to improve their interactivity.

One side-effect is that the edited colors appear somewhat muted when first drawn but subsequently brighten to full intensity when initiating another edit or figure redraw.

This RP also bundles a few other changes:

  • The motion threshold setting no longer applies to pan and zoom to maintain their interactivity
  • Added a register.RegImgs data class to manage related images during image registration tasks
  • Many print statements on startup and loading an image are now debug logging statements to reduce output

@yoda-vid yoda-vid added bug Something isn't working enhancement New feature or request labels Dec 8, 2022
@yoda-vid yoda-vid added this to the v1.6.0 milestone Dec 8, 2022
Add a data class with fields for key images used during registration to allow iterating over them and to identify the interpolation required for certain image types.
…image to level

Require either an image path or prefix to specify the output file location.
Add `kwargs` argument to pass additional arguments from mixin figure save wrapper to the underlying module function.
Move many statements that are output during app startup. Move most statements to debugging and the rest to warning output.
We introduced the motion filter setting to reduce label display updates, which could overwhelm web backends. This filtering had the side-effect of making pan and zoom controls less responsive, however. Change the threshold setting to apply only to these label updates, whereas pan and zoom use a threshold of 0 to filter out only movements within the same pixel. The web backend does not appear to be overwhelmed with these events, perhaps because they use full idle redraws instead of blitting.
Use `np.inf` as motion threshold flag to ignore motion events for region label updates and respond to left-click instead. Any provided coordinate update function will take precedence for clicks.
Applying blitting for mouse motion caused a regression where label editing did not update the canvas. Fix by extending blitting to label editing.

- Add the circle paint indicator and labels axes image to the blitter as animated artists
- Continue to update motion events by the blitter rather than redraws if the blitter is present
Allow pan/zoom threshold to be titrated similarly to label motion.
Enable blitting for the axes images displayed in the Plot Editor, which improves performance of panning and zooming.
Employing blitting for axes image display improves display speed, but adding too many images slows down the entire blitting system. To reduce the number of artists managed by the blitter, dynamically add and remove images during the necessary action.

- Add the atlas labels image to the blitter during edit mode, removing the image once the mode is turned off
- Change the edit mode attribute to a property to manage the artist in a setter
- Add all axes images to the blitter at the start of navigation events and remove them afterward
Add a library function to flatten a list with arbitrary levels of nesting, including irregular nesting.
Add a parameter to specify the index of the artist added to the blitter so that artists can be positioned behind other blitted artists instead of always being added above existing artists.
@yoda-vid yoda-vid changed the title Extend blitting to speed up atlas label editing Extend blitting to speed up atlas label editing and image pan/zoom Dec 14, 2022
@yoda-vid yoda-vid merged commit a595ecd into master Dec 14, 2022
@yoda-vid yoda-vid deleted the reg_img_dataclass branch December 14, 2022 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant