Display DICOM images with imshow

89 views (last 30 days)
walzer91
walzer91 on 11 Jul 2014
Edited: DGM on 1 Dec 2023
Hi everyone! I'm having some problems trying to show DICOM images. I read and show images using
image = 'img\IM-0001-0089-0001.dcm';
figure, imshow(image,'DisplayRange',[])
but the quality of the image still very poor, really different from the original! I know that the problem deals with the bit depth used, DICOM are 16 bit, but I don't know how to fix this problem! Please, somebody could help me? You can find here attached a screenshot of how the image really is and how I can display using matlab! Thanks!
  4 Comments
Ágúst Leó
Ágúst Leó on 1 Dec 2023
Hey Walter Roberson! I followed the coding in the link you provided and made sure to not limit my images to uint16(), but the resolution is still limited compared to the original. Any ideas? Thanks!
DGM
DGM on 1 Dec 2023
Edited: DGM on 1 Dec 2023
Nobody can guess what code you're using or what images you're using or the manner in which they appear.
The resolution is determined by your display and the size of the figure window. If the image is rendered smaller or larger than its native geometry, then it will be subject to nearest-neighbor interpolation.
The contrast is determined by the numeric class of the image and the range of the image content with respect to black and white. Most medical images that I see only occupy a small portion of the dynamic range available, and so they will be rendered with very little contrast.
inpict = dicomread('CT-MONO2-16-ankle.dcm'); % int16
imshow(inpict) % it's all gray
getrangefromclass(inpict) % the values associated with [black white]
ans = 1×2
-32768 32767
[min(inpict(:)) max(inpict(:))] % the actual extrema are both near 50% gray
ans = 1×2
32 4080
You can use the displayrange parameter of imshow() (either implicitly or otherwise) in order to change how the image data is rendered
% imshow(inpict,[0 5000]) % use some particular fixed values
imshow(inpict,[]) % use the data extrema
Otherwise, you can adjust the image contrast directly using tools like mat2gray(), imadjust(), etc.

Sign in to comment.

Answers (1)

Piyush Prajapati
Piyush Prajapati on 1 Jul 2019
You didn't read DICOM image in in proper format. This could be once possinle reason but this code below is working.
Try using this,
info = dicominfo('img\IM-0001-0089-0001.dcm');
image = dicomread(info);
figure
imshow(image,[]);

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!