making volume from multiple slices

8 ビュー (過去 30 日間)
talayeh ghodsi
talayeh ghodsi 2019 年 10 月 12 日
編集済み: KALYAN ACHARJYA 2019 年 10 月 15 日
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

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 10 月 12 日
編集済み: KALYAN ACHARJYA 2019 年 10 月 12 日
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.
  2 件のコメント
talayeh ghodsi
talayeh ghodsi 2019 年 10 月 13 日
thanks for your answer, but could you tell how can i put all 429 slices in your code instead of 'slice'?
result=cat(429,slice1,slice2,slice3....);
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 10 月 15 日
編集済み: KALYAN ACHARJYA 2019 年 10 月 15 日
%Read all slices and save in structure array , like array_data={1,429}
Next
for i=1:length(array_data);
result(:,:,i)=cat(i,array_data{i});
%.................^ here we have to think about
end
%Please note, I did not tried it, may it works with minor modifications
Or
see reshape function

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by