Hi Mathieu, I've been looking at J2K compression with GDCM and I have a couple of questions/issues:
If using gdcmconv -K
on uncompressed RGB data should I expect it to result in J2K Lossless pixel data compressed with a Photometric Interpretation of YBR_RCT? Because with 3.0.9 it doesn't do any multi-component transformation (the parameter in SGcod is 0) and the Photometric Interpretation is still 'RGB', which is fine if that's the intention, it just seems a bit strange as a default (and leaves me wondering if I need to write my own codec to ensure MCT is applied).
I ask, because looking at the source code for gdcmImageChangeTransferSyntax.cxx
it seems like TryJPEG2000Codec
is performing a Photometric Interpretation change here. Only for it to be undone here (for input RGB, anyway). The comments seem to indicate it should only be changing it back to RGB when decompressing.
My testing/comparison files have been the uncompressed US1_UNCR.dcm and compressed US1_J2KR.dcm files from here and here as well as using this project to check the codestream.
Thanks!
https://github.com/malaterre/GDCM/pull/122
Commit is:
I believe there is still work to be done for MCT=1, are you planning on a future patch ?
I've been encoding using
JPEG2000Codec
directly. The only other issue is #523 (Python SWIG). If you're happy with that patch I can submit another PR just for that. Otherwise I'll leave it to you.is there anything still left to do here ?