how to sum all the frames in each dicom image and all the dicom images to form the volume

5 次查看(过去 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),[]);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 DICOM Format 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by