# Adding read AND write for HTJ2K TransferSyntax to GDCM

**URL:** https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329
**Category:** Uncategorized
**Created:** [November 27, 2024, 1:18pm UTC](https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329 "2024-11-27T13:18:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dazzag](https://discourse.itk.org/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@dazzag](https://discourse.itk.org/u/dazzag)
#### Post date: [November 27, 2024, 1:18pm UTC](https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329/1 "2024-11-27T13:18:19Z")

</div>

Hi,

Are there any plans to add support for reading and writing of DICOM files pixels encoded with the suite of HTJ2k based transfer syntaxes.

It looks like GDCMImageIO currently only supports JPEG, JPEG2000, JPEGLS and RLE.

ITK already has support for encoding and decoding this via the OpenJPHImageIO that can be installed for Python via “pip install itk-ioopenjph”. See [GitHub - InsightSoftwareConsortium/ITKIOOpenJPH: An ITK module to read and write High-throughput JPEG2000 (HTJ2K) images.](https://github.com/InsightSoftwareConsortium/ITKIOOpenJPH)

Thanks

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [November 27, 2024, 2:58pm UTC](https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329/2 "2024-11-27T14:58:47Z")

</div>

@jadh4v might have some information.

---

<div class="post-metadata">

### Author: ![jadh4v](https://discourse.itk.org/user_avatar/discourse.itk.org/jadh4v/32/2710_2.png) [@jadh4v](https://discourse.itk.org/u/jadh4v)
#### Post date: [November 27, 2024, 7:08pm UTC](https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329/3 "2024-11-27T19:08:29Z")

</div>

As far as I know, there aren’t any plans on horizon for this. @matt.mccormick or @jcfr might have more to add.

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [November 27, 2024, 7:17pm UTC](https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329/4 "2024-11-27T19:17:22Z")

</div>

I now see there is an open issue to track this:

> <https://github.com/InsightSoftwareConsortium/ITK/issues/3983>
>
> This is a new, lossy and lossless, multiscale, tiled, high performance codec. It… was recently added to the DICOM standard:
> 
> https://www.dicomstandard.org/News-dir/ftsup/docs/sups/sup235.pdf
> 
> \### Description
> 
> Add support for .jph files and HTJPK-encoded DICOM files
> 
> \### Additional Information
> 
> Rough plan for steps to be taken:
> 
> \- \[\] Update our vendored OpenJPEG to 2.5.0+
> \- \[\] Update OpenJPEG in GDCM: https://github.com/malaterre/GDCM/blob/master/Utilities/gdcmopenjpeg/README.GDCM.txt
> \- \[\] Update GDCM in ITK
> \- \[\] Add tests to the GDCM ImageIO for the next encoding
> \- \[\] Add functionality, tests to the JPEG2000 ImageIO for .jph files with an ITKIOOpenJPH module based on \[OpenJPH\](https://openjph.org/). This provides SIMD accelerated read and write support.
> 
> CC @malaterre @issakomi @aylward @PaulHax

---

<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: [December 12, 2024, 2:05pm UTC](https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329/5 "2024-12-12T14:05:23Z")

</div>

The OpenJPEG library has been updated in ITK to 2.5.2.

There is a PR prototype for support here:

> <https://github.com/InsightSoftwareConsortium/ITK/pull/5020>
>
> Relates to #3983
> \<!-- The text within this markup is a comment, and is intended… to provide
> guidelines to open a Pull Request for the ITK repository. This text will not
> be part of the Pull Request. --\>
> 
> 
> \<!-- See the CONTRIBUTING (CONTRIBUTING.md) guide. Specifically:
> 
> Start ITK commit messages with a standard prefix (and a space):
> 
> \* BUG: fix for runtime crash or incorrect result
> \* COMP: compiler error or warning fix
> \* DOC: documentation change
> \* ENH: new functionality
> \* PERF: performance improvement
> \* STYLE: no logic impact (indentation, comments)
> \* WIP: Work In Progress not ready for merge
> 
> Provide a short, meaningful message that describes the change you made.
> 
> When the PR is based on a single commit, the commit message is usually left as
> the PR message.
> 
> A reference to a related issue or pull request (https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests)
> in your repository. You can automatically
> close a related issues using keywords (https://help.github.com/articles/closing-issues-using-keywords/)
> 
> @mentions (https://help.github.com/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)
> of the person or team responsible for reviewing proposed changes. --\>
> 
> \## PR Checklist
> \- \[\] No \[API changes\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md#breaking-changes) were made (or the changes have been approved)
> \- \[\] No \[major design changes\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md#design-changes) were made (or the changes have been approved)
> \- \[\] Added test (or behavior not changed)
> \- \[\] Updated API documentation (or API not changed)
> \- \[\] Added \[license\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/KWStyle/ITKHeader.h) to new files (if any)
> \- \[\] Added Python wrapping to new files (if any) as described in \[ITK Software Guide\](https://itk.org/ItkSoftwareGuide.pdf) Section 9.5
> \- \[\] Added \[ITK examples\](https://github.com/InsightSoftwareConsortium/ITKSphinxExamples) for all new major features (if any)
> 
> Refer to the \[ITK Software Guide\](https://itk.org/ItkSoftwareGuide.pdf) for
> further development details if necessary.

Changes need to make it into GDCM for official support, but this change worked for a few images I tested.

@mathieu.malaterre

---

<div class="post-metadata">

### Author: ![dazzag](https://discourse.itk.org/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@dazzag](https://discourse.itk.org/u/dazzag)
#### Post date: [December 13, 2024, 10:31am UTC](https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329/6 "2024-12-13T10:31:49Z")

</div>

Amazing. Thanks.

How simple is the process of attempting to build this branch myself?

Alternatively, any idea how long before this makes an official release?

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [January 20, 2025, 4:15am UTC](https://discourse.itk.org/t/adding-read-and-write-for-htj2k-transfersyntax-to-gdcm/7329/7 "2025-01-20T04:15:56Z")

</div>

Hi @dazzag ,

If you check out the Git branch, we have simplified build instructions in our new documentation:

[Build and test ITK - ITK's documentation](https://docs.itk.org/en/latest/contributing/build_test_itk.html)

This patches are being merged into upstream GDCM. They will like be available in upcoming ITK 6 pre-releases.
