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

Transcode DICOM to HTJ2K format #1376

Open
Saveriu opened this issue Nov 27, 2023 · 3 comments
Open

Transcode DICOM to HTJ2K format #1376

Saveriu opened this issue Nov 27, 2023 · 3 comments

Comments

@Saveriu
Copy link

Saveriu commented Nov 27, 2023

I see that dcm4che can now read htj2k format but it would be great to have the capability to transcode to that format (in dcm2dcm for example).

@gunterze
Copy link
Member

gunterze commented Nov 29, 2023

dcm4che relies on J2K codecs provided by OpenJPEG/OpenCV, which currently only supports HTJ2K decoding/decompression, but not HTJ2K encoding/compression. uclouvain/openjpeg#1381

@gunterze
Copy link
Member

@aous72 in uclouvain/openjpeg#1487 (comment)_ :

I think it is easiest for you guys if OpenJPEG had HTJ2K encoding support.

Let me describe the current status of HTJ2K in OpenJPH.
OpenJPH encodes quantized coefficient (for lossy) or transformed coefficients (lossless) using one cleanup pass that encodes all the bitplanes in these coefficients.
Rate-control is currently driven by the quantization step size; finer quantization step sizes produce larger files with better quality.

A proper rate-control, in which you specify the desired rate, is missing. To do this properly, I need two more passes, the significance propagation pass (SPP) and the magnitude refinement pass (MRP), together with error estimation, and some post-compression rate-distortion method. These are missing from OpenJPH.
Of course, an alternative is to use the Qfactor method, as described in an ISO document, which is also missing from OpenJPH.

It is easiest to add what exists in OpenJPH to OpenJPEG. It is also possible to hack some sub-optimal rate-control into the existing OpenJPEG rate control mechanism. It is sub-optimal because it lacks SPP and MRP.

I just need to find the time to do it. I would be happy if someone else did it.

Cheers,
Aous.

@jeremy-nocek-rp
Copy link

@gunterze I'm curious if you've heard any updates outside of the linked thread. In your post, you mentioned that you're considering integrating OpenJPH as a stop gap until OpenJPEG provides HT2JK encoding, but their response was left pretty open ended.

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

No branches or pull requests

3 participants