Closed igorpisarev closed 6 years ago
I see the problem but I don't like the solution. It breaks the initializing of the viewer transformation when the first source is added. I'll think of an alternative solution...
I worked around this problem by not using bdv-vistools and instantiating BigDataViewer
in my code instead (I needed to customize the viewer anyway).
While the original issue remains, I am closing this PR as the proposed fix indeed doesn't play well with the viewer transformation.
@hanslovsky and I identified a bug that causes inconsistent order of setup ids using
BdvFunctions.show()
methods. When the first source is added, the viewer is not created yet, andBdvHandleFrame.add()
creates it internally. ButBdvHandleFrame.getUnusedSetupId()
is called before that, and it usessetupAssignments
object (which isnull
in the described case) to look up the max used id. It will store the new mappingnull->1
. If we save a bdv-settings.xml file, it will contain a description of the source withid=1
.The problem occurs when we want to display a source in another BDV window. The logic will be the same as above, but this time it will assign
id=2
to the new source because of the existingnull
mapping. It will update the mapping withnull->2
. If we try to load the existing bdv-settings.xml file, it will throw an exception because the setup id is different. The expected behavior is that the setup ids are consistent across runs.We came up with a solution to force creating the viewer before adding any sources, so that
setupAssignments
is nevernull
.