# Adding parallel compression to MetaIO

**URL:** <https://discourse.itk.org/t/adding-parallel-compression-to-metaio/1835>\
**Category:** Engineering\
**Created:** [May 3, 2019, 9:49pm UTC](https://discourse.itk.org/t/adding-parallel-compression-to-metaio/1835 "2019-05-03T21:49:35Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [May 8, 2019, 8:55pm UTC](https://discourse.itk.org/t/adding-parallel-compression-to-metaio/1835/15 "2019-05-08T20:55:34Z")

</div>

> [@dzenanz](#):
>
> I am currently leaning towards using `blosc+zstd` on compression level 2 as the default. Also, I think we should expose `SetCompressionLevel` in `itk::ImageIOBase` , which is currently implemented only by a few IOs (e.g. [PNG](https://itk.org/Doxygen/html/classitk_1_1PNGImageIO.html#a038f5abe2380eb346f57a89176db224d), [MINC](https://itk.org/Doxygen/html/classitk_1_1MINCImageIO.html#a9dba56f8a918a0caa580c2c50812dc43)). @blowekamp suggested also exposing `SetCompressor` , which would allow programatically preserving backwards compatibility if so desired. A configure-time option for backwards compatible compression is already planned.

Here is the PR for this improvement:

> <https://github.com/InsightSoftwareConsortium/ITK/pull/847>
>
> There are two primary characterizations of compression level. 1) the
> 0-100 vers…ion for JPEG-like lossy compression which ranges 0-100 and
> 2) the loss-less with quality 0-9.
> 
> This implementation has the ImageIO set the expected range and enforce
> the range by clamping when setting the value.

The `CompressionLevel` is mostly straight forward. With the caveat: some compression algos have the range 0-100, while others have 0-9 (deflate/zlib based). In this implementation I choose to have each ImageIO define a max. This preserves compatibility, at the expense of not having a consistent range.

---

_[View the full topic](https://discourse.itk.org/t/adding-parallel-compression-to-metaio/1835)._
