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?

 Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 26 Sep. 2018
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

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by