Question about the image resampling

10 views (last 30 days)
SHERRY
SHERRY on 30 Jul 2015
Commented: SHERRY on 31 Jul 2015
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
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')

Accepted Answer

David Young
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.
  2 Comments
SHERRY
SHERRY on 30 Jul 2015
Thanks a lot! i guess you're right :)
SHERRY
SHERRY on 31 Jul 2015
Hi David,
could you help me understand these bold values( 68.5 , 35 , 0.5 and -14 )?
At step 3:
adds a shift of 68.5 to keep the array coordinates positive
T1 = maketform('affine',[-2.5 0; 0 1; 68.5 0]);
At step 4:
As in the previous step, we permute the input array using TDIMS_A = [4 1 2], again flipping and rescaling/resampling the vertical dimension. Our affine transformation is the same as the T1 above, except that we add a third dimension with a (3,3) element of 0.5 and (4,3) element of -14 chosen to map 30, 32, ... 98 to 1, 2, ..., 35. This centers our 35 frames on the mid-sagittal slice.
T3 = maketform('affine',[-2.5 0 0; 0 1 0; 0 0 0.5; 68.5 0 -14]);
Many thanks!
Sherri

Sign in to comment.

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!