Question about the image resampling
6 views (last 30 days)
Show older comments
Hi all,
when i read this great article( http://www.mathworks.com/help/images/examples/exploring-slices-from-a-3-dimensional-mri-data-set.html?s_tid=srchtitle ), i met a problem at step 2 : T0=maketform('affine',[0 -2.5 ;1 0;0 0]) . Could anyone help me understand why the resampling factor is 2.5 ?
Thanks in advance!
Sherri
----------------------------------------------------------------------------------------------
here are some main codes:
M2 = reshape(M1,[128 27]); size(M2)
figure, imshow(M2,map);
title('Sagittal - Raw Data');
ans =
128 27
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/147586/image.png)
We can obtain a much more satisfying view by transforming M2 to change its orientation and increase the sampling along the vertical (inferior-superior) dimension by a factor of 2.5 -- making the sampling interval equal in all three spatial dimensions. We could do this in steps starting with a transpose, but the following affine transformation enables a single-step transformation and more economical use of memory.
T0 = maketform('affine',[0 -2.5; 1 0; 0 0]);
The upper 2-by-2 block of the matrix passed to maketform, [0 -2.5;1 0], combines the rotation and scaling.
R2 = makeresampler({'cubic','nearest'},'fill');
M3 = imtransform(M2,T0,R2);
figure, imshow(M3,map);
title('Sagittal - IMTRANSFORM')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/147587/image.png)
0 Comments
Accepted Answer
David Young
on 30 Jul 2015
It's just, I think, because we are told near the start of the article:
An important factor is that the sampling intervals are not the same along the three dimensions: samples along the vertical dimension (4) are spaced 2.5 times more widely than along the horizontal dimensions.
Presumably this is known from the setting on the machine that created the images. The 2.5 in the transform compensates for this by resampling the vertical dimension to make the spacing match the other dimension.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!