Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRRDLoader: Improved gzip detection code #21213

Merged
merged 2 commits into from
Feb 6, 2021
Merged

NRRDLoader: Improved gzip detection code #21213

merged 2 commits into from
Feb 6, 2021

Conversation

IsseiMori
Copy link
Contributor

@IsseiMori IsseiMori commented Feb 5, 2021

Description

NRRD files exported using some of the NRRD libraries, such as pynrrd, uses gzi as an encoding name rather than gzip or gz, and these files could not be loaded previously.
Here, I added gzi encoding option to examples/jsm/loaders/NRRDLoaders.js so it recognizes gzi as gzip encoding.

@@ -318,7 +318,7 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
parseHeader( _header );

var _data = _bytes.subarray( _data_start ); // the data without header
if ( headerObject.encoding === 'gzip' || headerObject.encoding === 'gz' ) {
if ( headerObject.encoding === 'gzip' || headerObject.encoding === 'gz' || headerObject.encoding === 'gzi' ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my understanding: gzi is just a different name for gzip, right? It does not refer to a special compression/decompression algorithm.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, seems like we could just do this?

headerObject.encoding.substring( 0, 2 ) === 'gz'

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 6, 2021

Do you mind updating the examples/js/loaders/NRRDLoader.js instead and generate the module version via node utils/modularize.js?

@mrdoob mrdoob added this to the r126 milestone Feb 6, 2021
@mrdoob mrdoob merged commit e99f13c into mrdoob:dev Feb 6, 2021
@mrdoob
Copy link
Owner

mrdoob commented Feb 6, 2021

Thanks!

@mrdoob mrdoob changed the title Examples: Add gzi encoding option to NRRD Loader NRRDLoader: Improved gzip detection code Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants