[[Background discussion](https://discourse.itk.org/t/add-a-parallel-compression-method-to-nrrd-and-or-metaimage/696)]
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 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
@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.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Just adding updated information:
zstd v1.4.0 was released April 16th, 2019.
https://github.com/facebook/zstd/releases/tag/v1.4.0
Advanced API
The main focus of the v1.4.0 release is the stabilization of the advanced API.
Current release is now v1.4.3
https://github.com/facebook/zstd/releases/tag/v1.4.3
Two recent experiments I did may be relevant to this thread. These both focus on making Gzip compression faster, which would retain compatibility with the current NRRD format. One could use this acceleration to use a better compression level, getting a little closer to zstd.
1.) Since pigz is based on zlib, it can be recompiled with the accelerated CloudFlare zlib. Here is a simple CMake script that builds pigz with the CloudFlare zlib:
git clone https://github.com/neurolabusc/pigz.git
cd pigz
mkdir build && cd build
2.) ITK uses znzlib to read/write NIfTI images. My accelerated znzlib demonstrates two methods to accelerate writing gzip images. First, the NIfTI IO can be built using the CloudFlare zlib which is faster than the system zlib. Second, the user can provide an environment variable to request that data is piped to pigz. Only a few lines of code are modified, yielding a dramatic performance increase. I do think the same strategy could be used for the NRRD writing. As my project demonstrates, file writing for uncompressed data and piped pigz are the same, so one can generally use the same existing well tested routines.
The low hanging fruit is zlib-ng, as pointed out in a VTK forum discussion.
Also #416
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.
Most helpful comment
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