fix(precomputed): sort scales by resolution - #1086
Draft
AKnassa wants to merge 1 commit into
Draft
Conversation
The format requires the x, y and z `"resolution"` values not to decrease as the index into `"scales"` increases, but files that list the scales in another order do occur in practice. `parseMultiscaleVolumeInfo` took `scales[0]` as the base scale and `getSources` returned the scales in file order, so such a file made the coarsest scale define the model coordinate space: the volume was reported at the coarsest resolution and with its bounds, and every relative scale came out below one, leaving the higher-resolution scales unrendered. Sort the scales by voxel volume before the base scale is taken. This is a no-op for conforming files: `Array.prototype.sort` is stable, and the voxel volume cannot decrease while no individual resolution does. Graphene reuses `parseMultiscaleVolumeInfo` and is fixed with it. Adds a `reversed_scales` test fixture holding the same volume as `one_channel` with the scales listed coarsest first; its metadata snapshot is now identical to `one_channel`'s apart from the URL. Fixes google#237
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #237
What this does
Neuroglancer now sorts the resolution levels of a precomputed volume instead of trusting the order they appear in the file.
Why
The format says the levels must be listed finest-first, but files that list them the other way round do turn up in practice. When that happened, Neuroglancer treated the lowest resolution level as the reference: the volume was reported at the wrong size and with the wrong bounds, and the sharper levels never rendered. This matches what was suggested in the issue thread.
What changed
How to see it
There is a new
reversed_scalestest fixture holding the same volume as the existingone_channelfixture, but with the levels listed coarsest-first. Its metadata snapshot is now identical toone_channel's apart from the URL. Before this change the two differed by 112 lines.