how to read all and form a single composite image

1 view (last 30 days)
i want to read a dicom file which is 4D having 63 frames out of which i need to get a composite image leaving the first 61,62 frames can any one tell me how to read the dicom image and get only composite image like that there are 63dcm files in a folder
if true
projectdir = 'E:\SHIVA BACKUP\THYROID\P1\AJAY BAIRAGY1';
X = zeros(128, 128, 1,63,'uint16');
% Read the series of images.
% for p=1
p=40;
thisfile = sprintf('IM_%d.dcm', p);
filename = fullfile( projectdir, thisfile );
imdata = dicomread(filename);
imsize = size(imdata);
if ~isequal( imsize, [128 128 1 63] )
fprintf('file is unexpected size %s instead of [128 128 1 72], skipping "%s"\n', mat2str(imsize), filename);
else
X(:, :,1,p) = imdata;
end
figure();
s= montage(X(:,:,1,p), [0 65000 ]);
end

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!