MATLAB: Cannot change the size of dicom image

compressiondicomimagejpeg

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

Best Answer

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'?