Includes option to synchronize reference index objects over a fixed s…#1024
Open
Includes option to synchronize reference index objects over a fixed s…#1024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Screen.Recording.2026-04-01.at.12.09.30.AM.mov
Goal of this PR is to provide "first-class" support for synchronizing reference index objects. If done right, this will allow visualization systems build with NDWidget to be easily "extended" and "chained together" in arbitrary ways.
Example problem: you have built/released some visualization code with NDWidget. All widgets so far as synchronized across one scrollable dimension: time. Let's say someone wants to extend this visualization and add a new NDWidget consisting of a single NDImage Graphic. This NDImage graphic has a time dimension (which should be synchronized with the existing NDWidget code). But is also has a "depth" dimension (which was not present in the existing visualization code). Right now, it is nontrivial to link together the old and new code into one coherent system.
It should be possible, without explicitly writing event handlers, to synchronize the time dimensions in this kind of scenario.
This PR adds functionality to ReferenceIndex to synchronize ReferenceIndex objects. Sample usage would look like:
This code synchronizes these two reference index objects across time. An update to the time index of these reference index objects guarantees an equivalent update to the other.
Here is code that can verify that the implementation does what we'd expect.
This implementation of ReferenceIndex includes a function, add_synchronized_index which performs symmetric synchronization between self and an input ref_index over a specified dimension.
The "set" implementation now carefully looks at what was implemented and calls "set" on the other synchronized reference index objects. Note this implementation has event handler style logic to prevent infinite recursion.