how to sum all the frames in each dicom image and all the dicom images to form the volume
3 次查看(过去 30 天)
显示 更早的评论
an any one help me how to do this I has 72 dicom images in a folder each dicom image has 72 frames. I wanted to aggreagate all frames of all dicom images to form a volume c
projectdir = 'E:\SHIVA BACKUP\THYROID\P1\newcodes\data1\13002';
% y = length(projectdir);
y = 72;
Odd = zeros(128, 128, 1, 72, y, 'uint8');
Even = zeros(128, 128, 1, 72, y, 'uint8');
% Read the series of images.
for p=1:y
thisfile = sprintf('IM_%d.dcm', p);
filename = fullfile( projectdir, thisfile);
imdata = dicomread(filename);
imsize = size(imdata);
if ~isequal( imsize, [128 128 1 72] )
fprintf('file is unexpected size %s instead of [128 128 1 72], skipping "%s"\n', mat2str(imsize), filename);
else
Odd(:, :, :, :,p) = imdata;
% Even(:, :, :, :, :,p+1)=imdata;
end
% end
end
figure();
% Display the first image stack.
z=montage(Odd(:,:,:,:,1),[]);
1 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!