0001 function show_fem_move( img, move, scale, options )
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 if nargin == 1
0013 move = [];
0014 scale = 20;
0015 options = [0,0,[]];
0016 elseif nargin == 2
0017 scale = 20;
0018 options = [0,0,[]];
0019 elseif nargin == 3
0020 options = [0,0,[]];
0021 end
0022
0023
0024 fwdp = aa_fwd_parameters( img.fwd_model );
0025
0026
0027 if length(img.elem_data) > fwdp.n_elem
0028 move = reshape( ...
0029 img.elem_data( fwdp.n_elem+(1:fwdp.n_elec*fwdp.n_dims) ), ...
0030 fwdp.n_elec, fwdp.n_dims);
0031 img.elem_data = img.elem_data(1:fwdp.n_elem);
0032 end
0033
0034
0035 show_fem(img, options);
0036
0037
0038 if ~isempty(move)
0039
0040 e_nodes = cell2mat({img.fwd_model.electrode(:).nodes});
0041
0042
0043 if size(move,1) == fwdp.n_node;
0044 move = move(e_nodes,:);
0045 end
0046 move = move- ones(size(move,1),1)*mean(move);
0047
0048
0049 hold on;
0050 if nargin < 3
0051 scale = 20;
0052 end
0053 nodes = img.fwd_model.nodes;
0054 hh = working_quiver(nodes(e_nodes,1), nodes(e_nodes,2), ...
0055 scale*move(:,1), scale*move(:,2), 0 );
0056 set(hh,'Color', [0,.3,0], 'LineWidth', 2, 'Clipping', 'off');
0057 hold off;
0058 end
0059
0060 axis('off');
0061 axis('image');
0062 axis(1.3*[-1,1,-1,1]);
0063
0064 function hh= working_quiver( varargin )
0065
0066
0067
0068
0069 v = version;
0070 octave = exist('OCTAVE_VERSION') | str2num(v(1)) < 7 | str2num(v(1:3)) >= 7.8;
0071 if octave
0072 hh = quiver( varargin{:} );
0073 else
0074 hh = quiver('v6', varargin{:} );
0075 end