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

Reduce image adjustment triggers #474

Merged
merged 4 commits into from
Mar 28, 2023
Merged

Conversation

yoda-vid
Copy link
Collaborator

Toggling channels in the "Adjust Image" panel has retrieved a currently displayed image and using its values to populate the panel's controls. Changing each of these controls in turn triggered additional image updates, though typically without changing the image since it already had these settings. Toggling the auto-intensity has similarly triggered an "update" to the current value. While this design has simplified the callbacks, it also leads to many unnecessary triggers. This PR reduces many of those triggers by ignoring many of these redundant events.

This PR also provides a workaround for #473, where one intensity sliders may shift unexpectedly and trigger a change in the other intensity slider. The workaround is simply to turn off this synchronization during intensity slider adjustments so that the user only needs to counter the unexpected shift in one slider.

Toggling channels has set up the image adjustment panel for the selected channel by getting a currently displayed image and using its values to populate the panel's controls. Changing each of these controls in turn triggered additional image updates, though typically without changing the image since it already had these settings. To reduce these triggers:

- Add another flag to ignore general image adjust updates, toggled when setting image adjust channels
- Auto-intensity range updates only get values when ignoring image updates
- Refactor getting the currently selected viewers and a displayed image into separate functions
Ignore callback when turning off the auto value.
The `RangeEditor` slider controls may shift unexpectedly, such as suddenly decreasing to 0 when shifting only slightly downward, or shifting upward before shifting downward. Clicking on a new position may also bring the slider there, but releasing the mouse button will cause the slider to pop back to its original positions. A shift in one intensity control can cause a further unexpected shift in the other control since we attempt to synchronize them. For example, the max intensity slider cannot be below the min slider, so an unintentional shift in the max slider to 0 will also cause the min slider to shift to 0. As a workaround, turn off this synchronization during intensity slider shifts. Leave it on when changing the auto setting to allow it to respond to directly toggling the auto control, and toggling it by moving a slider appears to respond to the initial shift rather than an unexpected subsequent shift.
@yoda-vid yoda-vid added bug Something isn't working dependencies Issues/requests related to a dependency package performance Speeds and resource usage labels Mar 23, 2023
@yoda-vid yoda-vid added this to the v1.6.0 milestone Mar 23, 2023
@yoda-vid yoda-vid merged commit 0c8ba20 into master Mar 28, 2023
@yoda-vid yoda-vid deleted the reduce_img_adjust_triggers branch March 28, 2023 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Issues/requests related to a dependency package performance Speeds and resource usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant