cannot change the size of dicom image

3 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2016-8-25
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".
Huseyin
Huseyin 2016-8-25
I am trying to use lossy JPEG algorithm by just using DCT,Quantization Table and IDCT. No RLE and Huffman are used yet. I can share the code if neccessary.
By changing all the pixel values of the image by zero, I was expecting to reduce the size, but the size is still 29MB like the original one. What am I missing?
By the way, I call "dicomwrite(image,'newimage.dcm')" for writing. No more inputs

请先登录,再进行评论。

采纳的回答

Huseyin
Huseyin 2016-8-26
Thank you Walter for your answer. Yes, compressionmode works perfectly, but I dont want to compress the dicom automatically. I want to compress it manually by writing my own code.
However, making all the pixel value of the original image as "0" (so I reduce the number of bits a lot in image), that doesn't reduce the size of the dicom file by calling dicomwrite(image,'newimage.dcm'). Why this happens?
If I want to compress a dicom in Matlab, should I always use the 'CompressionMode' ? Isn't it possible to use my own compression algorithm and write it without 'CompressionMode'?
  1 个评论
Walter Roberson
Walter Roberson 2016-8-26
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.

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2016-8-25
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.

类别

Help CenterFile Exchange 中查找有关 DICOM Format 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by