Resizing x and y values of a DICOM/3D logical matrix, slice-by-slice, using for-loop.
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I am a new Matlab user. I would like your help with a for-loop code please.
I'll be using a software which will forward a DICOM file to Matlab, and convert the image into a logical matrix. For example 1536x1536x90, but the x,y,z values will vary depending on the input DICOM file.
I would like to adjust the images to 512x512 for every 90 slices.
Here's what I'm picturing:
For slices thru s = 1 to s = #slices in a dicom file
specify the x and y dimensions of the slice s
set the x and y dimensions of s to 512*512
repeat until s reaches #slices in the dicom file
End
Right now I have:
for s = 1:size(img,3)
xy = img(:,:,s)
use imresize on xy?
end
And I don't know where I'm going with this. Being a newbie I don't think I fully understand how to deal with various types of matrices, so any help is appreciated.
Thanks in advance!
0 件のコメント
回答 (1 件)
Walter Roberson
2016 年 10 月 5 日
out = imresize(img, [512, 512]);
It happens that imresize() handles the case of multiple planes, without needing a loop.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!