dicom, subplot, code rectify
显示 更早的评论
I have 381 dicom images and trying to subplot each image as original and after masking but my code is plotting the last read image only. can somebody help with the code to plot all image.
Folder = '';
file = fullfile(Folder, '*.dcm');
image = dir(file);
for k = 1:length(image)
FileName = image(k).name;
fullFileName = fullfile(Folder, FileName);
I= dicomread(fullFileName);
mask = a > I & I> b; %a=2000, b=1500
R = I; R(mask) = 0;
G = I; G(mask) = intmax(class(I));
B = I; B(mask) = intmax(class(I));
RGB = cat(3, R, G, B); %final masked image
subplot(1,2,1),imshow(RGB) % masked image
subplot(1,2,2),imshow(I,[ ]) %original image
end
3 个评论
Walter Roberson
2020-1-10
Perhaps montage()
Unless your images are quite small you would have a lot of difficulty displaying 381*2 at the same time.
You could put a
figure()
call before the subplot, but that would create 381 figures which is not workable.
Deepa S
2020-1-10
Walter Roberson
2020-1-10
Put in a call to
figure()
right before the first call to subplot()
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 DICOM Format 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!