Decompress JPEG Baseline (Process 1)
opennog opened this issue · comments
Oscar Peña-Nogales commented
Describe the bug
The decompress() method seems not to be working with this data with image-00000.dcm included in the attached zip file. This is the original file that that I want to transform to Explicit VR Little Endian. If I use the pydicom.decompressed method the resulting image looks like:
while if I use dcmdjpeg
the image is like:
It seems like the decompression was not done correctly.
dicom_files.zip
5:59)
Your environment
$ python -m pydicom.env_info
module | version |
---|---|
platform | Linux-5.4.0-1087-gcp-x86_64-with-glibc2.31 |
Python | 3.9.12 |
[GCC 10.3.0] | |
pydicom | 2.3.0 |
gdcm | 3.0.22 |
jpeg_ls | cannot determine version |
numpy | 1.22.2 |
PIL | 9.1.1 |
pylibjpeg | 1.4.0 |
openjpeg | 1.3.2 |
libjpeg | 1.3.4 |
scaramallion commented
The following works fine for me with GDCM, which should be the first handler you're using:
from pydicom import dcmread
from pydicom.pixel_data_handlers import convert_color_space
import matplotlib.pyplot as plt
ds = dcmread("image-00000.dcm")
ds.decompress()
rgb = convert_color_space(ds.pixel_array, "YBR_FULL", "RGB")
plot = plt.imshow(rgb)
plt.show()
scaramallion commented
@opennog did you resolve your issue?