cannot change the size of dicom image
2 views (last 30 days)
Show older comments
Hi there,
I am trying some algorithms on jpeg image compression. I started from basic structures. For instance I take a jpeg image (uint8), apply dct transform, then quantization and idct to reconstruct the image. I obtained good results that I reduced 7MB to kilobytes. As you know i call "imread" and "imwrite" while reading and writing.
Then I wanted to apply this basic algorithm to a dicom image which has 29MB size. When I "imshow" the results I see the difference when compared to original image. Well, then I call "dicomwrite" the image. I see that the compressed image is still 29MB. Why is that?
I thought maybe this happens because the dicom image is in "uint16" form, on the other hand the quantization table is for 8bit images. However, I multiplied all the pixels of the original dicom by zero. So I have just a black image with the sizes of original image, then I write it. But the new image is still 29MB. So i think it is not about the compression algorithm.
Please help, I have to figure it out Thanks in advance
2 Comments
Walter Roberson
on 25 Aug 2016
Which compression are you commanding DICOM to use? http://www.dclunie.com/papers/MIIT_2009_DicomCompression_Clunie.pdf
If I recall correctly the default is "none".
Accepted Answer
Huseyin
on 26 Aug 2016
1 Comment
Walter Roberson
on 26 Aug 2016
There are several distinct questions here:
1) Does the DICOM file format have the possibility of encoding data with private compression algorithms?
The answer to that appears to be YES, but you need to register with the appropriate entity to obtain a private tag to mark the compression as being in your format.
2) Does the MATLAB dicom interface have a provision for writing data using custom compression algorithms?
I am not sure of the answer to that. I suspect that answer is "NO", but it might be the case that there is an available DICOM library that you could call upon.
3) Will MATLAB (or anyone else) be able to automatically decompress data stored in your compression format.
The answer to this is almost certainly NO: the programs would encounter the private tag and would not know what to do with it. However, it might be the case that there is an available DICOM library that you could configure to call back to your code when it detected your private tag.
DICOM is completely lacking in any kind of extension programming language that might allow you to add a blob of code to a DICOM image with instructions to call into the code when it encounters your private tag. You cannot tack on a "handler" code block of any sort with a DICOM image. You can just program the DICOM reading code for your application to be able to handle your tag, all the intelligence in the code rather than embedding some of the intelligence in the dicom image file.
More Answers (1)
Walter Roberson
on 25 Aug 2016
You need to add the 'CompressionMode' option to the dicomwrite() call.
The data you pass to dicomwrite() needs to be the full array, not data that is already fully compressed. The data you pass might have been pre-filtered to make it easier to compress, but it still needs to be full precision and an array. The 'CompressionMode' option tells dicomwrite which compression algorithm to apply to the data to find the byte stream to write to the file.
0 Comments
See Also
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!