Find nearest vertex from the selected point on GUI --- Syntax function job_view_lf_selvertex(inst_id) --- History 2009-01-27 Taku Yoshioka Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function job_view_lf_selvertex(inst_id) 0002 % Find nearest vertex from the selected point on GUI 0003 % 0004 % --- Syntax 0005 % function job_view_lf_selvertex(inst_id) 0006 % 0007 % --- History 0008 % 2009-01-27 Taku Yoshioka 0009 % 0010 % Copyright (C) 2011, ATR All Rights Reserved. 0011 % License : New BSD License(see VBMEG_LICENSE.txt) 0012 0013 global vbmeg_inst; 0014 0015 % 0016 % Global variables 0017 % 0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0019 rb1 = vbmeg_inst.viewlf{inst_id}.rb1; 0020 ed1 = vbmeg_inst.viewlf{inst_id}.ed1; 0021 0022 % 0023 % Cortical surface model displayed 0024 % 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 if get(rb1,'Value') == get(rb1,'Max'), 0027 V = vbmeg_inst.viewlf{inst_id}.V; 0028 else 0029 V = vbmeg_inst.viewlf{inst_id}.Vinf; 0030 end 0031 0032 % 0033 % Vertex selection 0034 % 0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0036 k = waitforbuttonpress; 0037 if k~=0, return; end; 0038 p = (select3d)'; 0039 if length(p)==0, return; end; 0040 tmp = repmat(p,[size(V,1) 1]); 0041 [tmp ixp] = min(sum((tmp-V).^2,2)); 0042 vbmeg_inst.viewlf{inst_id}.ix_selected_vertex = ixp; 0043 set(ed1,'String',num2str(ixp)); 0044 0045 % 0046 % Update figure 0047 % 0048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0049 job_view_lf_update_sensorpattern(inst_id); 0050 job_view_lf_update_cortexpattern(inst_id);