Error when converting a Dicom image into JPEG2000

1 view (last 30 days)
Hello, I am trying to compress a Dicom image into JPEG2000. The following code I am using is :
X = dicomread('test.dcm');
imwrite(X,'Xcomp.jp2','jp2','Mode','lossy','CompressionRatio',50);
Xcomp = imread('Xcomp.jp2');
figure(1), imshow(Xcomp,[])
However, when I run it, the image in Figure 1 appears but when I open from my documents the image Xcomp.jp2, there is only a black image. I noticed that the bitdepth of the Dicom file (bitdepth =12) and the bitdepth from the JPEG2000 (bitdepth =16) were different. Could it come from this? Thanks in advance.

Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!