Resizing x and y values of a DICOM/3D logical matrix, slice-by-slice, using for-loop.

3 views (last 30 days)
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!

Answers (1)

Walter Roberson
Walter Roberson on 5 Oct 2016
out = imresize(img, [512, 512]);
It happens that imresize() handles the case of multiple planes, without needing a loop.

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!