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?

 Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange

Produits

Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by