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

Restore timepoints and source group when using the editor mode #272

Open
NicoKiaru opened this issue Mar 20, 2024 · 8 comments
Open

Restore timepoints and source group when using the editor mode #272

NicoKiaru opened this issue Mar 20, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@NicoKiaru
Copy link
Collaborator

No description provided.

@NicoKiaru
Copy link
Collaborator Author

This is in fact fixed in BIOP/bigdataviewer-selector@4432147

@NicoKiaru
Copy link
Collaborator Author

NicoKiaru commented May 12, 2024

@tpietzsch just FYI, when BdvOverlay#removeFromBdv is called in a bdv window, there's a lot of things from the bdv state which are changed: the number of timepoints is reset to one, the sources within the groups are reset, and probably some other things.

To go around this issue, I have to save the state snapshot and restore "manually" parts of the state. This is okayish, but it would be better if I could avoid that (see https://github.com/BIOP/bigdataviewer-selector/blob/44321479fc44c35348937b6dae849dfd0bca593b/src/main/java/ch/epfl/biop/bdv/select/SourceSelectorBehaviour.java#L196-L205)

Not that important, but I wanted to mention it to you since it impairs the user experience.

@NicoKiaru
Copy link
Collaborator Author

TODO: do a clean issue in bigdataviewer-vistools

@NicoKiaru
Copy link
Collaborator Author

Todo fix the SourceGroup workaround in bigdataviewer-selector once bigdataviewer/bigdataviewer-core#177 is fixed

@tpietzsch
Copy link
Member

@NicoKiaru I merged your fix for bigdataviewer/bigdataviewer-core#177

Can you explain how you use timepoints?

When BdvOverlay#removeFromBdv is called, vistools recomputes the numTimepoints as the max getNumTimepoints() over all sources (that are left) https://github.com/bigdataviewer/bigdataviewer-core/blob/783b7aee870348f231fdf8c7b214a5fa8a31e9df/src/main/java/bdv/util/BdvHandle.java#L291-L298

So it looks like, either, your overlay had more timepoints than the other sources, or you set the numTimepoints directly in the viewerstate (bypassing vistools BdvSources)?

@NicoKiaru
Copy link
Collaborator Author

Most of the time, I build directly the SourceAndConverter object, which, I think, has no convenient way to return a number of timepoints ?

And then each source is added via:

So yes, I'm adding the SourceAndConverter object to the state directly.

Thanks for linking the logic. I'll dig a bit more. ( and thanks for merging the PR )

@tpietzsch
Copy link
Member

Yes, right, neither SourceAndConverter nor Source specify number of timepoints.

This only happens on the vistools layer (BdvSource has getNumTimepoints()).
The "problem" here is that you mix vistools and core sources. (BdvOverlaySource is vistools, SourceAndConverter is core).
Maybe an easy way around is to add the SourceAndConverter via vistools BdvFunctions.show(yourSourceAndConverter, numTimepoints, Bdv.options().addTo(bdvh)) https://github.com/bigdataviewer/bigdataviewer-core/blob/783b7aee870348f231fdf8c7b214a5fa8a31e9df/src/main/java/bdv/util/BdvFunctions.java#L251-L255

Of course it would be better to make it more seamless to mix vistools and core. But I don't have a perfect solution at the moment.

@NicoKiaru
Copy link
Collaborator Author

Ah yes, thanks, I can try that. I think a minor inconvenience is that I will need to call this for each source in order to specify the timepoints instead of a single call with a List of sources. But maybe that's not a real problem.

@NicoKiaru NicoKiaru added the enhancement New feature or request label Jun 7, 2024
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

No branches or pull requests

2 participants