Closed ksugar closed 3 years ago
Hello.
I have some comments.
I see you are trying to get what spots are visible in a BDV view right? So you must go directly via the view object itself, not through the window manager. Can you try to remake this PR using this?
Hello, thank you for your review! I will work on it.
I have updated the method to make it possible to call getInsideVertices( timepoint )
from MamutViewBdv
.
final MamutViewBdv bdv = pluginAppModel.getWindowManager().getBdvWindows().get(0);
final Iterable< Spot > vertices = bdv.getInsideVertices( timepoint );
So you must go directly via the view object itself, not through the window manager.
I still need to get the view object through the window manager. How can I get it in a way that is not via the window manager?
I tried to walk around the code but could not find a shorter way to get what spots are displayed, respecting the current RenderSettings
. The context ultimately defer to the renderer to know what spots are painted, so that is probably a correct way to do so.
@tpietzsch What do you think of this? The goal is to make a public method that gives what spots are currently painted in a specified view.
Hello @ksugar
I am thinking more on your request, and how to make it more Mastodonic.
Basically you have one 'thing' that needs to know what spots are displayed in a view. What about this 'thing' would directly subscribe as a listener to context changed? This is how we do it in TrackScheme and Tables, and this is how it is done in Mastodon.
Would that work for your application? Which is?
@tinevez
Thank you for your feedback. What I want to do is to get the visible spots in the selected BDV window. Any way is fine, as long as it achieves this goal.
I understood that this should be done via a listener for context changes. In the PR#129, I implemented a listener class for getting notifications when a new BDV window is created. Using it, I will be able to subscribe my plugin instance as a context listener. If everything works, what I need will be only the PR#129.
pluginAppModel.getWindowManager().addBdvViewCreatedListner( new BdvViewCreatedListener()
{
@Override
public void bdvViewCreated( MamutViewBdv bdv )
{
bdv.getContextProvider().listeners().add( MyPluginClass.this );
}
} );
@tinevez Following your suggestion, I could manage to get the vertices in a specific BDV window. https://github.com/elephant-track/elephant-client/blob/dev/src/main/java/org/elephant/actions/BdvContextService.java I will close this PR as I no longer need it. Thank you for your feedback and suggestion.
This PR exposes
overlayContextWrapper
inBdvContextProvider
.I made this change to get visible vertices in a BDV.
Example of usage: https://github.com/elephant-track/elephant-client/blob/main/src/main/java/org/elephant/actions/mixins/WindowManagerMixin.java#L63-L74