MATLAB: Making volume from multiple slices

digital image processingimage processing

hi everyone. i have 429 slices of ct and i want to make a volume(called pic_3D in the code) from them. each image is 625*696. i have written the code bellow, but it still has the error wich is attached. and also i dont know why the im(number of images in the folder) in the workspace is 269, it should be 429
surf_read_dir='C:\Users\asus\Desktop\more crop\';
files=dir('C:\Users\asus\Desktop\more crop\*.jpg');
for im=1:size(files)
fdir = strcat(surf_read_dir , files(im).name);
slice_im = load(fdir);
pic = imread(fdir);
for i=1:600
frt_data(im,:,i)=pic(i,:,1);
end
pic_3D(:,:,im) = pic(:,:,1);
end

Best Answer

result=cat(Depth_size,slice1,slice2,slice3....);
Depth_size must be same as number of slices to be add
Say 3 slices then
result_3d=cat(3,slice1,slice2,slice3);
Look at multidimentional array, you may get more idea.
Related Question