I am trying to display CT Dicom slices in a montage and used the code below but I get only some parts of the image read and not all of it. The Images are attached below. I need the actual image to be read using the program. Can anyone help me fix this.
The original images are attached as a zip file "images.zip".
clear %no variables
close all %no figures
clc %empty command window
ff = fullfile(pwd, '2.16.840.114421.80674.9357820679.9389356679');
files = dir(fullfile(ff, '*.dcm'));
fname = {files.name};
info = dicominfo(fullfile(ff, fname{1}));
voxel_size = [info.PixelSpacing; info.SliceThickness];
rd = dicomread(fullfile(ff,fname{1}));
sz = size(rd);
num_image = length(fname);
ct = zeros(info.Rows, info.Columns, num_image, class(rd));
for i=length(fname):-1:1
fname1 = fullfile(ff, fname{i});
ct(:,:,i) = uint16(dicomread(fname1));
end
montage(reshape(uint16(ct), [size(ct,1), size(ct,2), 1, size(ct, 3)]), 'DisplayRange', []);
set (gca, 'clim', [0,100]);
im = ct(:, :, 200);
maxl = double(max(im(:)));
imt = imtool(im, [0, maxl]);
Original Image:
Read Image:

5 件のコメント

Image Analyst
Image Analyst 2016 年 6 月 28 日
The images you inserted are PNG images. You need to attach the dicom images with the paper clip icon.
anusha reddy
anusha reddy 2016 年 6 月 28 日
I tried to attach the .dcm but couldn't as it gives an error as follows:
File format is unsupported. Use any of these formats: .bmp, .csv, .fig, .gif, .jpg, .jpeg, .m, .mat, .mdl, .pdf, .png, .txt, .xls, .zip
anusha reddy
anusha reddy 2016 年 6 月 29 日
This is the first and crucial step for me. Any help appreciated. Thanks !
Walter Roberson
Walter Roberson 2016 年 6 月 29 日
You can zip the image and attach that.
anusha reddy
anusha reddy 2016 年 6 月 29 日
That worked. I've attached the images. Thank you.

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2016 年 6 月 29 日

0 投票

CT scans contain negative values, but you are using uint16() which will set all negative values to 0.

5 件のコメント

anusha reddy
anusha reddy 2016 年 6 月 29 日
I've removed the uint16 and executed the program. I still get the same output.
Walter Roberson
Walter Roberson 2016 年 6 月 29 日
Did you remove the uint16 in the montage() call as well?
anusha reddy
anusha reddy 2016 年 6 月 29 日
編集済み: anusha reddy 2016 年 6 月 29 日
yes I did.
The program I'm presently using
clear %no variables
close all %no figures
clc %empty command window
ff = fullfile(pwd, '2.16.840.114421.80674.9357820679.9389356679');
files = dir(fullfile(ff, '*.dcm'));
fname = {files.name};
info = dicominfo(fullfile(ff, fname{1}));
voxel_size = [info.PixelSpacing; info.SliceThickness];
rd = dicomread(fullfile(ff,fname{1}));
sz = size(rd);
num_image = length(fname);
ct = zeros(info.Rows, info.Columns, num_image, class(rd));
for i=length(fname):-1:1
fname1 = fullfile(ff, fname{i});
ct(:,:,i) = dicomread(fname1);
end
montage(reshape((ct), [size(ct,1), size(ct,2), 1, size(ct, 3)]), 'DisplayRange', []);
% minct = min(ct(:));
% maxct = max(ct(:));
set (gca, 'clim', [0, 100]);
drawnow;
shg;
im = (ct(:, :, 200));
maxl = double(max(im(:)));
imt = imtool(im, [0, maxl]);
imtool close all;
Walter Roberson
Walter Roberson 2016 年 6 月 29 日
Get rid of the
set (gca, 'clim', [0, 100]);
That tells it to show only values between 0 and 100, but you have values from -1000 to +1132 (over the 4 images that you included in the .zip)
anusha reddy
anusha reddy 2016 年 6 月 29 日
That worked. Thank you. And I appreciate the effort :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMedical Physics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by