Sources at mouse position
Closed this issue · 5 comments
I was sure we have it as a function, but I cannot find it right now, could you point me to it?
A helper method to get all sources at the current mouse position (below is a copy of my own code).
final RealPoint globalMouseCoordinates = BdvUtils.getGlobalMouseCoordinates( bdvHandle );
List< SourceAndConverter< ? > > sources = bdvHandle.getViewerPanel().state().getSources();
final int timepoint = bdvHandle.getViewerPanel().state().getCurrentTimepoint();
Set< SourceAndConverter< ? > > sourcesAtMousePosition = sources.stream()
.filter( source -> SourceAndConverterHelper.isPositionWithinSourceInterval( source, globalMouseCoordinates, timepoint, is2D ) )
.collect( Collectors.toSet() );
I think we just have this:
and this :
I replaced the right click to get sources by the editor mode and bigdataviewer-selector
. Maybe somethign disappeared at this moment ?
Could be... I can add it (back).
Maybe BdvHandleHelper
is a good place for this?
@NicoKiaru
And which function do you use in the selector?
In the selector I check whether the restangle selected by the user intersects the bounding boxes of all the SourceAndConverter(s). That 's done here : https://github.com/NicoKiaru/bigdataviewer-selector/blob/42b84ca79bd4083dc1389328fa18f9a73946a696/src/main/java/ch/epfl/biop/bdv/select/SourceSelectorOverlay.java#L141-L169
But I don't remember the details. Also this won't work with WarpedSources. For Warped sources we had a workaround using the transparency property, but I think you were not super satisfied about it relying on a transparency property of a converter