emphasize_electrode_text

PURPOSE ^

EMPHASIZE_ELECTRODE_TEXT: ephazise the electrode

SYNOPSIS ^

function emphasize_electrode_text(elecs);

DESCRIPTION ^

 EMPHASIZE_ELECTRODE_TEXT: ephazise the electrode
   text on a "show_fem" plot
 emphasize_electrode_text(elecs)
   elecs => which elecs to emphasize (default, all)

 (C) 2005-2018 Andy Adler. License: GPL version 2 or version 3
 $Id: emphasize_electrode_text.m 6801 2024-04-22 06:40:03Z aadler $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function emphasize_electrode_text(elecs);
0002 % EMPHASIZE_ELECTRODE_TEXT: ephazise the electrode
0003 %   text on a "show_fem" plot
0004 % emphasize_electrode_text(elecs)
0005 %   elecs => which elecs to emphasize (default, all)
0006 %
0007 % (C) 2005-2018 Andy Adler. License: GPL version 2 or version 3
0008 % $Id: emphasize_electrode_text.m 6801 2024-04-22 06:40:03Z aadler $
0009 
0010 % FIXME: the view matrix is not easy to interpret. Fix dirn
0011 
0012 if (nargin>=1) && ischar(elecs) && strcmp(elecs,'UNIT_TEST'); do_unit_test; return; end
0013 
0014 hh = get(gca,'Children'); axis vis3d
0015 
0016 bgcolour = [1,1,1];
0017 % Don't really understand the view matrix
0018 %tmp = inv(view);
0019 if exist('OCTAVE_VERSION')
0020    warning("view() doesn't give 4x4 in octave. Guessing");
0021    tmp = eye(4);
0022 else
0023    tmp = view;
0024 end
0025 dirn = [0,0,1,0]*tmp; % move into view's z dir
0026 dirn = dirn(1:3);
0027 dirn = -dirn(:)'/norm(dirn);
0028 
0029 if nargin==0;
0030   elecs= 1:length(hh)'; % all of them
0031 end
0032 
0033 k=0;for hi = hh(:)'; k=k+1;
0034   if ~strcmp(get(hi,'Type'),'text'); 
0035      continue;
0036   end
0037   if ~any(str2num(get(hi,'String'))==elecs);
0038       continue;
0039   end
0040   set(hi, 'BackgroundColor', bgcolour);
0041   set(hi, 'FontSize', 12);
0042   pn = get(hi, 'Position');
0043   set(hi, 'Position', pn + dirn*1 );
0044 end
0045 
0046 function do_unit_test
0047   fmdl = getfield(mk_common_model('n3r2',[16,2]),'fwd_model');
0048   subplot(221);
0049   show_fem(fmdl,[0,1]); view(0,0); drawnow
0050 
0051   emphasize_electrode_text();
0052   subplot(222);
0053   show_fem(fmdl,[0,1]); view(0,80); drawnow
0054 
0055   emphasize_electrode_text();
0056   subplot(223);
0057   show_fem(fmdl,[0,1]); view(50,80); drawnow
0058 
0059   emphasize_electrode_text();

Generated on Sun 29-Dec-2024 11:41:59 by m2html © 2005