From 1ad8ae83c11277e06765cb90248d685e5532f43f Mon Sep 17 00:00:00 2001 From: Valentino Lugli Date: Tue, 5 Apr 2022 17:06:29 +0200 Subject: [PATCH] [Fix] Raw encoded NRRDs parse correctly Changes: - When a raw encoded NRRD is parsed now it correctly uses only the voxel data to render the volume, as previously it was using the whole buffer data to try and render it. --- io/parserNRRD.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/io/parserNRRD.js b/io/parserNRRD.js index 773a95b9e..0c17a918b 100644 --- a/io/parserNRRD.js +++ b/io/parserNRRD.js @@ -93,9 +93,15 @@ X.parserNRRD.prototype.parse = function(container, object, data, flag) { // here we start the unzipping and get a typed Uint8Array back var inflate = new Zlib.Gunzip(new Uint8Array(_data)); _data = inflate.decompress(); + // .. let's use the underlying array buffer + _data = _data.buffer; } - // .. let's use the underlying array buffer - _data = _data.buffer; + else + { + // If the data is raw, get the array buffer of only the data. + _data = _data.buffer.slice(_data_start); + } + var MRI = { data : null, min : Infinity,