Why does imshow display different image when I try to show a CT image?

4 views (last 30 days)
I want to show an original abdominal CT (Computed Tomography) image (which is uint16 bit ) with these codes;
im = imread('Slice_87.png');
The original image and the figure shown by the above command are different.
For instance, the figure shown by the above command has a grayscale background. However, the background in the original image seems as black when I open it with ImageJ or paint.
Why are they different?.
How can I show the CT image as it is seen by ImageJ or paint?

Answers (1)

KALYAN ACHARJYA on 13 May 2023
Can you try this way-
[img,map] = imread('Slice_87.png');
DGM on 14 May 2023
Edited: DGM on 14 May 2023
Use mat2gray() to do the normalization instead of relying on figure capture and all the problems that causes.
mask = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1382664/MASK_87.png');
outpict3 = im2double(mask).*im2double(I); % multiply
[minValue,maxValue] = bounds(outpict3(outpict3~=0)); % get data range
outpict3 = mat2gray(outpict3,[minValue,maxValue]); % normalize to extrema
outpict3 = im2uint16(outpict3); % Your original image is uint16
imshow(outpict3); % now it's scaled as expected

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!