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

Position synchronization is broken #1

Open
ctrueden opened this issue Aug 16, 2012 · 0 comments
Open

Position synchronization is broken #1

ctrueden opened this issue Aug 16, 2012 · 0 comments
Labels

Comments

@ctrueden
Copy link
Member

If you add a MouseWheelListener to the Image5D UI elements, then call ImagePlus.getChannel(), ImagePlus.getSlice() and ImagePlus.getFrame(), you will get the most up-to-date values. However, if you add an AdjustmentListener to applicable UI elements (i.e., ScrollBars), position values queried with the above methods will be off. The reason is that Image5D employs a special polling thread that synchronizes the Image5D/ImagePlus position with that of the Image5DWindow/StackWindow. The AdjustmentListeners are notified of changes to the StackWindow immediately, before the polling thread has noticed the discrepancy and synchronized the Image5D's position to match the new one in the window.

For an example of this bug in action, see Main.java.

I started work on a fix on the position-sync branch, but the issue is extremely thorny and I do not have time to completely follow through. Patches welcome.

Ultimately, the best fix would be to eliminate the replicated data structures; keeping multiple data structures in sync is a suboptimal approach. Rather, we should simply store the current position in a single place (probably Image5D), which is immediately updated upon a UI change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant