3D volume dimension resize

6 views (last 30 days)
Ubu
Ubu on 6 Feb 2013
Answered: Evolution on 20 Jul 2016
Dear experts,
I have been reading extensively through the web, but I haven't clarified my doubts yet. I have a 3D image with a mask within, which I need to overlap over a 3D MRI volume. The mask image has the following values [91 109 91, 2X2X2 voxel size], while the 3D MRI volume has [53 63 46, 3X3X3 voxel size]. As I need to perform different operations (i.e. multiplications) between the two images, I mandatorily need the mask image to be the same size as the other volume.
old_image = [91 109 91, 2X2X2 voxel size]
new_image = [53 63 46, 3X3X3 voxel size]
So far, this is the script I used:
old_image = (old.img); % input image
% desired output dimensions (note, I had to invert x and y values, because
the output image would have inverted the two values, don't know why)
nx=63;
ny=53;
nz=46;
[x y z]=
ndgrid(linspace(1,size(old_image,1),nx),...
linspace(1,size(old_image,2),ny),...
linspace(1,size(old_image,3),nz));
new_image=interp3(old_image,x,y,z);
Now, the output image has definitely the expected dimensions and the mask has a very similar shape to the one in the input image - although different resolution - but I am not entirely sure that the mask position within the resized image is the same as before. Do you think the script above is the right approach to the problem anyways?
Moreover, I don't know how to save the new_image as nii or img/hdr file, to visualize it on other tools.
I thank you very much in advance for you attention and possible help.
Sincerely,
Ubu

Answers (1)

Evolution
Evolution on 20 Jul 2016
Just want to know that were you supposed to take care of the resolution only and not voxel size? In your case the voxel size also needs to increase from 2 to 3.What did you think about this problem?

Community Treasure Hunt

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

Start Hunting!