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

조회 수: 27(최근 30일)
Majid Al-Sirafi 2018년 12월 30일
편집: Walter Roberson 2019년 1월 1일
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