dicomread() not handling negative values properly

I am using the "dicomread" function to read in a DICOM file. The function seems to be converting all my negative values to zero which then shows a black spot at those points when it is extracted to an image.
>> x = dicomread(filename)
How do I fix this?

 採用された回答

MathWorks Support Team
MathWorks Support Team 2018 年 9 月 26 日

1 投票

This is occurring because MATLAB is reading the DICOM as unsigned integers. This can be seen by looking at the output of the "dicominfo" function.
>> info = dicominfo(filename)
The 'PixelRepresentation' shows 0 when the DICOM is unsigned and 1 when the DICOM is signed.
In order to get the desired values back, simply use the following equation to do a linear rescaling.
>> y = int16(x) *info.RescaleSlope + info.RescaleIntercept

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

製品

リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by