[Fix] Raw encoded NRRDs parse correctly #229
Open
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.
The original code used an ArrayBuffer to get the voxel data, this worked fine for gzip/gz encoded files because when the voxel data was decompressed, it returned a new ArrayBuffer of just the voxel data, so just using
_data = _data.buffer;
worked fine.When a raw file was detected, it also grabbed the ArrayBuffer of the sliced data, but, it turns that this variable is a subarray of the whole file as seen in
var _data = _bytes.subarray(_data_start);
.Problem is, trying to get the buffer from a sliced subarray returns the whole original buffer, not a sliced one; so this was fixed by using the same offset to only get the buffer data of the voxels like so:
_data = _data.buffer.slice(_data_start);