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

8 ビュー (過去 30 日間)
Majid Al-Sirafi
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 件のコメント
Rik
Rik 2018 年 12 月 30 日
Do you want to store the values in 8 bits, or do you want to process them in 8 bits?
Majid Al-Sirafi
Majid Al-Sirafi 2018 年 12 月 31 日
I want to store the values in 8 bits

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

採用された回答

Walter Roberson
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
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 件のコメント
Walter Roberson
Walter Roberson 2018 年 12 月 31 日
編集済み: Walter Roberson 2019 年 1 月 1 日
If it is uint16 then a lot of the time in practice mat2gray() without further parameters will not produce good results, as it will scale based upon the full range of data, but uint16 datasets often have an upper range of several thousand above what is of interest, due to the mix of bone with organs. The interesting data often tops out about 12000 or 14000.
Image Analyst
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.

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by