# convert 16 bits medical image (.dcm) into 8 bits

29 ビュー (過去 30 日間)
Majid Al-Sirafi 2018 年 12 月 30 日

I’m working in the project related to medical image processing. I need medical image (.dcm) of 8 bits. Unfortunately, I couldn’t find this type. I have just image (.dcm) of 16 bits. How can convert 16 bits medical image into 8 bits
Regards
Majid
##### 2 件のコメント表示非表示 1 件の古いコメント
Majid Al-Sirafi 2018 年 12 月 31 日
I want to store the values in 8 bits

サインインしてコメントする。

### 採用された回答

Walter Roberson 2018 年 12 月 31 日
im2uint8() to do the conversion.
Note: 16 bit DICOM data is often int16 with a range of about -3000 to +10000 or so, or else uint16 with a range of about 3000 to 16000 or so for the interesting data. These are full ranges recorded by the instruments, but you would typically only be interested in a subset of that range for conversion to uint8. Sometimes you can do useful automatic conversion with mat2gray(), but more often you end up having to play with the data to figure out what range you want. If you have a new enough MATLAB, then volumeViewer() can be useful for figuring out what range you want.

サインインしてコメントする。

### その他の回答 (1 件)

Image Analyst 2018 年 12 月 31 日
Why do you want to store the images in 8 bits?
You could just convert to 8 bit with gray2mat():
im8 = uint8(255 * mat2gray(im16)); % Scale min=0, max = 255
dicomwrite(im8, filename);
##### 2 件のコメント表示非表示 1 件の古いコメント
Image Analyst 2019 年 1 月 1 日
True. Often some cameras give 14 bits of data and they store it in a 16 bit image in two ways, within the lower 14 bits (which can lead to dark looking images in some software) or within the upper 16 bits, which makes the image brighter, but no longer radiometrically linear of course, if it even was in the first place since some devices add a gamma.
mat2gray() will scale regardless if the max was 65535 or 12000, so all images get their full gray level range scaled to the gray level range of the display regardless of what their original range was. Of course if you have one spec of noise that's abnormally bright then you could end up with an image too dark to see well since that bright speck will end up as 255 instead of the meaningful/interesting data. In that case, you might want to either
1. use imadjust() to normalize to a certain percentage of tails in the histogram, or
2. apply a gamma.
That's why I asked what the intent/need for storing these in 8 bits was. Simply saying "I want to store the values in 8 bits" when there is no reason that the image data cannot be stored in its original 16 bits is not really all that helpful.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by