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?

 Accepted Answer

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

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Products

Release

R2017b

Community Treasure Hunt

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

Start Hunting!