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

Decoding J2K RGB files - invalid value for 'PhotometricInterpretation' (YBR_RCT) #8

Open
Michael-Preibisch opened this issue Mar 22, 2019 · 1 comment

Comments

@Michael-Preibisch
Copy link

Michael-Preibisch commented Mar 22, 2019

Hello,

I'm having an issue when trying to decode RGB JPEG2000 files by using this codec. DCMTK console log is as follows:

E: invalid value for 'PhotometricInterpretation' (YBR_ICT)

or

E: invalid value for 'PhotometricInterpretation' (YBR_RCT)

The problem is with many files, but to this post I attach two of them (YBR_RCT anf YBR_ICT).
All of failing files share the same image-related attributes:
"BitsStored" -> 8,
"BitsAllocated" -> 8,
"HighBit" -> 7,
"SamplesPerPixel" -> 3

"PhotometricInterpretation" -> YBR_ICT or YBR_RCT

I am able to read MONOCHROME2 JPEG2000 files with your codec.

Example files:
https://drive.google.com/open?id=10JsJpsp3zNc2vUBdEkn8QK3UmL0Tq9HT

I'd be really grateful if you could help me.
Cheers,
M

@stiftovich
Copy link

stiftovich commented Sep 30, 2020

Hello,

i had the same problem like you with some dicom files i got from an institution.
I looked into the DICOM standard and found out, that the photometric interpretation must be changed to RGB after decompression. Found here http://dicom.nema.org/medical/dicom/2017e/output/chtml/part05/sect_8.2.4.html in Note 5)

So, to successfully decode the dataset i have done the following:
DcmFileFormat format;
format.loadFile(fileName, EXS_Unknown, EGL_noChange, DCM_MaxReadLength, ERM_autoDetect);
DcmDataset* ds = format.getAndRemoveDataset();
ds->putAndInsertString(DCM_PhotometricInterpretation, "RGB");

I create a DicomImage then and process it further. This works for the test files you provided.
Hope that helps you!

Cheers
Chris

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

2 participants