How can I change voxel size in a volume?

47 views (last 30 days)
Hi everyone,
I have a 3D matrix with size 100x100x41, (obtained by uploading a DICOM file, but that's not the point). From the header, I know that voxels have size 0.723x0.723x1 mm; I'd like to get them 0.08x0.04x0.027 mm, how can I do? I was thinking about imresize and imresize3, using for each the respective scaling factor, but it does not convince me at all, since in no way Matlab has a pixel/voxel size reference, it reads them only as elements of a matrix. Moreover, memory "explodes" using imresize3, because it increases the number of slices a lot.
DCM=rand(100,100,41); % here I create a similar volume, but it can be any
DCM_resize=imresize(DCM,'Scale',[9.0375 18.0832],'method','bicubic');
Last think, I'd like the image not to be stretched, keeping its aspect ratio. Thanks for your help.
  1 Comment
Bjorn Gustavsson
Bjorn Gustavsson on 25 May 2022
What do you intend to reveal with this rather large up-sampling? Almost a factor of 40 in the third dimension?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 25 May 2022
In order to keep the aspect ratio, all dimensions must be interpolated by the same factor, which would be max() of the requested factors.
You want your Z to be about 39 times finer (1/0.027) so that is the factor you would have to use for each dimension to avoid changing the aspect ratio.
This refers to keeping the aspect ratio within the matrix. If you are just concerned with keeping the aspect ratio for display purposes, rather than for computation, then there may be additional options.
  13 Comments
Walter Roberson
Walter Roberson on 26 May 2022
Edited: Walter Roberson on 26 May 2022
imshow3d does not know anything about reference objects.
See also volumeviewer()

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!