question about maketform() & tformarray()
이전 댓글 표시
hi all,
i met a problem understanding this 3D to 2D transformation by using tformarray() function. My question is why the translation is 68.5 to keep the array coordinates positive(shown in bold)? Is here any equation to get this critical value?
Many thanks!
Sherri
---------------------------------------------------------------------------------------------------
Here are some relevant codes, and you can also get the full info by clicking this:
---------------------------------------------------------------------------------------------------
Step 3: Extract Sagittal Slice from the Horizontal Slices Using TFORMARRAY
tformarray() applies 3-D to 2-D transformations.
And we want to create an image with:
Dimension 1: Superior to inferior (original dimension 4, reversed)
Dimension 2: Caudal to rostral (original dimension 1)
and extract just a single sagittal plane via the original dimension 2, we specify tdims_a = [4 1 2]. We create a tform via composition starting with a 2-D affine transformation T1 that scales the (new) dimension 1 by a factor of -2.5 and adds a shift of 68.5 to keep the array coordinates positive . The second part of the composite is a custom transformation T2 that extracts the 64th sagittal plane using a very simple INVERSE_FCN.
T1 = maketform('affine',[-2.5 0; 0 1; *68.5* 0]);
inverseFcn = @(X,t) [X repmat(t.tdata,[size(X,1) 1])];
T2 = maketform('custom',3,2,[],inverseFcn,64);
Tc = maketform('composite',T1,T2);
R3 = makeresampler({'cubic','nearest','nearest'},'fill');
tformarray transforms the three spatial dimensions of D to a 2-D output in a single step. Our output image is 66-by-128, with the original 27 planes expanding to 66 in the vertical (inferior-superior) direction.
M4 = tformarray(D,Tc,R3,[4 1 2],[1 2],[66 128],[],0);
The result is identical to the previous output of imtransform.
figure, imshow(M4,map);
title('Sagittal - TFORMARRAY');

채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Generic Geometric Transformations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!