Plot transformed surface and MRI-face for check fitting h = vb_plot_trans_fit(trans_mat, Fface, Vface, F, V, Vpos, para) vb_plot_trans_fit(trans_mat, Fface, Vface, F, V, Vpos, para, h) --- Input trans_mat = initial transform matrix Fface = Face surface Vface = Face vertex F = Scanned face surface V = Scanned face vertex Vpos = Head points para : [ dX ; th ] rigid body transformation parameter (6x1 vector) dX : Translation parameter of 3 directions [m] (3x1 vector) th : Rotation angle around x, y, z axis [radian] (3x1 vector) Example para = [0; 0.001; 0.005; 0; 0; pi/6]; Effective transform matrix = trans_mat * vb_rigid_trans_matrix(para) --- Optional input h : figure handle Ver 1.0 by M. Sato 2006-6-4 Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function h = vb_plot_trans_fit(trans_mat, Fface, Vface, F, V, Vpos, para, h) 0002 % Plot transformed surface and MRI-face for check fitting 0003 % h = vb_plot_trans_fit(trans_mat, Fface, Vface, F, V, Vpos, para) 0004 % vb_plot_trans_fit(trans_mat, Fface, Vface, F, V, Vpos, para, h) 0005 % --- Input 0006 % trans_mat = initial transform matrix 0007 % Fface = Face surface 0008 % Vface = Face vertex 0009 % F = Scanned face surface 0010 % V = Scanned face vertex 0011 % Vpos = Head points 0012 % para : [ dX ; th ] rigid body transformation parameter (6x1 vector) 0013 % dX : Translation parameter of 3 directions [m] (3x1 vector) 0014 % th : Rotation angle around x, y, z axis [radian] (3x1 vector) 0015 % Example 0016 % para = [0; 0.001; 0.005; 0; 0; pi/6]; 0017 % Effective transform matrix 0018 % = trans_mat * vb_rigid_trans_matrix(para) 0019 % --- Optional input 0020 % h : figure handle 0021 % 0022 % Ver 1.0 by M. Sato 2006-6-4 0023 % 0024 % Copyright (C) 2011, ATR All Rights Reserved. 0025 % License : New BSD License(see VBMEG_LICENSE.txt) 0026 0027 alpha_val = 0.7; 0028 fwgcolor = [0.8 0.7 0.6]; 0029 edgecolor = 'r'; 0030 msize = 10; 0031 mtype = '.r'; 0032 NX = 2; 0033 NY = 2; 0034 0035 view_angle = [90 0; 180 0;0 90; 120 30]; 0036 %view([180, 0]); % Front view (from +Y axis) 0037 %view([ 90, 0]); % Right view (from +X axis) 0038 %view([-90, 0]); % Left view (from -X axis) 0039 %view([ 0, 90]); % Top view (from +Z axis) 0040 0041 % Make rigid body transform matrix from 6 parameters 0042 if exist('para','var'), 0043 trans_mat = trans_mat * vb_rigid_trans_matrix(para); 0044 end 0045 0046 V = vb_affine_trans(V, trans_mat); 0047 VP = vb_affine_trans(Vpos, trans_mat); 0048 0049 Nfig = size(view_angle,1); 0050 0051 if ~exist('h','var'), 0052 h = figure; 0053 else 0054 figure(h); 0055 end 0056 0057 for n=1:Nfig 0058 subplot(NY,NX,n) 0059 vb_plot_surf(Vface,Fface,fwgcolor,'none',1); 0060 alpha(0.7) 0061 hold on 0062 vb_plot_surf(V, F, 'none',edgecolor); 0063 plot3(VP(:,1),VP(:,2),VP(:,3),mtype,'MarkerSize',msize) 0064 view(view_angle(n,:)); 0065 axis tight; 0066 end