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

Use zstd compression in NRRD and MetaIO #348

dzenanz opened this Issue Dec 22, 2018 · 2 comments


None yet
3 participants
Copy link

dzenanz commented Dec 22, 2018

[Background discussion]

zstd's advanced API which supports multithreading has recently entered staging area with intention to be moved into stable API. Now is a great time to make use of it, before ITKv5.0 is released.


This comment has been minimized.

Copy link

neurolabusc commented Jan 15, 2019

This seems related to this discussion. It does seem like the NRRD format needs to be updated to specifically include this.
I do have a couple comments

  1. One option for faster compression in a manner that is fully compatible with existing NRRD data is to use PIGZ for your compression. The recent releases of pigz allow named pipes that allow direct compression, without having to save the uncompressed data to disk first. This offers much faster compression on parallel computers using an existing format. Because it uses the GZ deflate, it is not as fast to compress or decompress as zstd, but it works with all existing tools.
  2. Since this will break compatibility with previous NRRD tools, I would carefully evaluate whether zstd is the ideal choice for your application. zstd is an exceptional generate purpose compression method that is very fast to compress and decompress. However, in my experience its primary weakness is precisely with the data we store in NRRD files: long streams of 16-bit or 32-bit values with strong correlation of the most significant bits across values. In my experience, combining a simple byte-shuffling pre-filter (e.g. blosc) dramatically improves the performance (both in terms of size and speed) of zstd. The zstd developers are aware of this, and I think their next tools will fill this niche. My sense is that such a future tool (or blosc) would be better suited for NRRD than a pure zstd compression.

This comment has been minimized.

Copy link

hjmjohnson commented Jan 15, 2019

@dzenanz FYI: I have been assisting zstd with updating their CMake implementation. The community has been fairly receptive to changes that increase it's use.

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