Code Monkey home page Code Monkey logo

Comments (14)

darcymason avatar darcymason commented on September 23, 2024

Do you know which plugin is doing the decompression?
Related, please also post the contents of running

python -m pydicom.env_info

from a command line.

from pydicom.

scaramallion avatar scaramallion commented on September 23, 2024

Can you post the results from below as well?

print(" ".join(f"{b:02X}" for b in ds.PixelData[:100]))

from pydicom.

scaramallion avatar scaramallion commented on September 23, 2024

@zeakey did you resolve your issue?

from pydicom.

zeakey avatar zeakey commented on September 23, 2024

@scaramallion Thanks for your response and the results are below:

print(" ".join(f"{b:02X}" for b in ds.PixelData[:100]))
FE FF 00 E0 04 00 00 00 00 00 00 00 FE FF 00 E0 54 16 01 00 FF 4F FF 51 00 29 00 00 00 00 01 40 00 00 01 40 00 00 00 00 00 00 00 00 00 00 01 40 00 00 01 40 00 00 00 00 00 00 00 00 00 01 08 01 01 FF 52 00 0C 00 00 00 01 00 05 04 04 00 01 FF 5C 00 13 20 50 58 58 60 58 58 60 58 58 60 58 58 58 50 50 58

from pydicom.

scaramallion avatar scaramallion commented on September 23, 2024

J2K codestream has 320x320, 1 component and 9-bit precision. What's the output from python -m pydicom.env_info?

from pydicom.

scaramallion avatar scaramallion commented on September 23, 2024

Ah, 9-bit. You're using Pillow, aren't you? There's an issue with their decoding of 9-bit JPEG 2000 codestreams that should be fixed in the next Pillow release. In the meantime you can switch to using GDCM or pylibjpeg (with the pylibjpeg-openjpeg plugin)

from pydicom.

zeakey avatar zeakey commented on September 23, 2024

@darcymason Oh I missed your reply.

The output of python -m pydicom.env_info is:

module       | version
------       | -------
platform     | Linux-6.5.0-28-generic-x86_64-with-glibc2.35
Python       | 3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0]
pydicom      | 2.3.1
gdcm         | _module not found_
jpeg_ls      | _module not found_
numpy        | 1.26.4
PIL          | 9.5.0
pylibjpeg    | _module not found_
openjpeg     | _module not found_
libjpeg      | _module not found_

from pydicom.

zeakey avatar zeakey commented on September 23, 2024

In the meantime you can switch to using GDCM or pylibjpeg

Ah, 9-bit. You're using Pillow, aren't you? There's an issue with their decoding of 9-bit JPEG 2000 codestreams that should be fixed in the next Pillow release. In the meantime you can switch to using GDCM or pylibjpeg (with the pylibjpeg-openjpeg plugin)

How can I "switch" to pylibjpeg? I installed pylibjpeg by python -m pip install -U pylibjpeg-openjpeg but the error is still there.

How can I tell pydicom to use another library?

from pydicom.

scaramallion avatar scaramallion commented on September 23, 2024

With v2.4 you can do:

ds = dcmread(...)
ds.convert_pixel_array("pylibjpeg")
arr = ds.pixel_array

Also, I think I closed this by mistake, this is a separate issue to #2006

from pydicom.

zeakey avatar zeakey commented on September 23, 2024

I got AttributeError: 'FileDataset' object has no attribute 'convert_pixel_array' with pydicom==2.4.3 and pydicom==2.4.0.

I'm using a 3rd party package to read the dicom files whose default behavior is ds.pixel_array after dread.

Is there any way I can fix this globally without editing the source code of that package?

from pydicom.

scaramallion avatar scaramallion commented on September 23, 2024

Ah, sorry, its convert_pixel_data()

from pydicom.

zeakey avatar zeakey commented on September 23, 2024

I got this error:

RuntimeError: The pixel data handler 'pylibjpeg' is not available on your system. Please refer to the pydicom documentation for information on installing needed packages.

With those two dependencies installed

pip install "pylibjpeg[all]"
pip install pylibjpeg-libjpeg

from pydicom.

scaramallion avatar scaramallion commented on September 23, 2024

Can you post the output from python -m pydicom.env_info again?

from pydicom.

scaramallion avatar scaramallion commented on September 23, 2024

@zeakey did you resolve your issue?

from pydicom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.