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

Consider using zopfli for compression #90

Closed
chrisgorgo opened this issue Mar 17, 2017 · 2 comments
Closed

Consider using zopfli for compression #90

chrisgorgo opened this issue Mar 17, 2017 · 2 comments

Comments

@chrisgorgo
Copy link
Collaborator

https://github.com/google/zopfli

It's backward compatible with gzip when it comes to decompressing, but creates smaller files.

@neurolabusc
Copy link
Collaborator

I have updated the code to allow you to adjust the gz compression level using the command line parameters -1..-9. This works for both the external pigz parallel compressor as well as the built-in single-threaded compressor. You can even use the Spinal-Tap inspired "-11" function for pigz which provides a tiny bit more compression at the expense of a tremendous amount of processing time. For example, on my computer the default setting compressed an image to 47.8% of its original size while the extreme setting was able to reduce it to 44.6% of its original size, but the extreme version took 376 times longer. For my sample image, the extreme pigz actually outperformed zopfli, which compressed the file to 45.1% of its original size. Further, the single-threaded zopfli execution took 611 times longer than the default pigz setting (requiring over 3 minutes to compress a 1mm isotropic T1 scan).

Personally, I think these extreme compression options make sense if you are compressing a file once that will be downloaded with limited bandwidth thousands or millions of times. However, they do not seem practical for the typical use cases of dcm2niix. If you want, you are free to submit a pull-request to execute an external copy of zopfli - you can use the current code which executes an external copy of pigz as a template. Alternatively, you could write a simple script in a language of your choice (shell, python, etc) that would have dcm2niix generate uncompressed nii images and call zopfli to compress them.

@chrisgorgo
Copy link
Collaborator Author

chrisgorgo commented Mar 18, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants