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

The (0028,0101) 'Bits Stored' value (16-bit) doesn't match the JPEG 2000 data (14-bit) #2012

Closed
junxiant opened this issue Feb 15, 2024 · 3 comments

Comments

@junxiant
Copy link

Describe the bug
User warning:
../lib/python3.8/site-packages/pydicom/pixel_data_handlers/pillow_handler.py:238: UserWarning: The (0028,0101) 'Bits Stored' value (16-bit) doesn't match the JPEG 2000 data (14-bit). It's recommended that you change the 'Bits Stored' value

This is probably related to:
pydicom/pylibjpeg#51
#693

Setting my imports as:
import pydicom.pixel_data_handlers.gdcm_handler as gdcm_handler
pydicom.config.image_handlers = [None, gdcm_handler]

Still did not work as the warnings still showed up.

Is there a fix for this? Or should i just ignore the warnings?

Your environment
pydicom==2.4.3
gdcm==1.1
pylibjpeg==2.0.0
pylibjpeg-libjpeg==2.0.2
pylibjpeg-openjpeg==2.1.1
Pillow==10.2.0

@scaramallion
Copy link
Member

scaramallion commented Feb 15, 2024

If you're happy to ignore the warnings then it's fine. Basically the J2K data uses 14-bit precision, but the dataset has 16-bit. I've since reconsidered the need for them since it's (mostly) irrelevant for the end user so they'll be gone in v3.0.

pydicom.config.image_handlers isn't a valid attribute and so doesn't do anything. pydicom.config.pixel_data_handlers (ooof, that function signature) or Dataset.convert_pixel_data(handler_name="gdcm") then Dataset.pixel_array should work a bit better.

@junxiant
Copy link
Author

Will it affect the image? As in would the image be different when viewed?

@scaramallion
Copy link
Member

scaramallion commented Feb 15, 2024

It depends if you're turning off some of our corrections and which plugins you're using, but generally speaking it has no effect.

Where "corrections" means reversing some of the less than desirable behaviour of pillow, or J2K data encoded using incorrect parameters.

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

No branches or pull requests

2 participants