0001 function show_slices_move( img, move, move_scale )
0002
0003
0004
0005
0006
0007
0008
0009 num_levs = 3;
0010
0011 mdl = img.fwd_model;
0012 elecs = length(mdl.electrode);
0013 pos = zeros(elecs,3);
0014 if exist('move') && size(move,1) == size(mdl.nodes,1)
0015 move_nodes = move;
0016 move= zeros(elecs,3);
0017 end
0018 for e = 1:elecs;
0019 elec_nodes = mdl.electrode(e).nodes;
0020 pos(e,:) = mean(mdl.nodes(elec_nodes,:),1);
0021 if exist('move_nodes');
0022 move(e,:) = mean( move_nodes(elec_nodes,:), 1);
0023 end
0024 end
0025
0026 elec_zmax = max(pos(:,3));
0027 elec_zmin = min(pos(:,3));
0028
0029 levels = inf*ones(num_levs,3);
0030 levels(:,3) = [elec_zmax; elec_zmax-(elec_zmax - elec_zmin)/2; elec_zmin];
0031 levels(:,4) = ones(num_levs,1);
0032 levels(:,5) = (1:num_levs)';
0033
0034 show_slices( img, levels );
0035
0036 isize = calc_colours('npoints');
0037 toplayer = pos(:,3) < levels(2,3);
0038 xofs = .5 + isize*(.5);
0039 xscale = (100/104)*isize/2;
0040 yofs = .5 + isize*(.5 + (num_levs-1)*toplayer);
0041 yscale = -(100/104)*isize/2;
0042 vx = pos(:,1) * xscale + xofs;
0043 vy = pos(:,2) * yscale + yofs;
0044 ecolour = [0,.3,0];
0045 hh= line(vx, vy);
0046 set(hh, 'LineStyle','none','Marker','.', ...
0047 'MarkerSize',10,'MarkerEdgeColor',ecolour);
0048
0049 pp = aa_fwd_parameters( mdl );
0050 if nargin == 1;
0051 move = [];
0052 end
0053 if length(img.elem_data) > pp.n_elem
0054 move = reshape( ...
0055 img.elem_data( pp.n_elem+(1:pp.n_elec*pp.n_dims) ), ...
0056 pp.n_elec, pp.n_dims);
0057 end
0058
0059 if ~isempty( move )
0060 nodes = img.fwd_model.nodes;
0061
0062
0063 idx = 1:16;
0064 move(idx,:) = move(idx,:)- ones(16,1)*mean(move(idx,:));
0065 if length(img.fwd_model.electrode) == 32
0066 idx = 17:32;
0067 move(idx,:) = move(idx,:)- ones(16,1)*mean(move(idx,:));
0068 end
0069 hold on;
0070 if nargin < 3
0071 move_scale = 20*isize;
0072 end
0073 hh = working_quiver( vx, vy, move_scale*move(:,1), ...
0074 - move_scale*move(:,2), 0 );
0075 set(hh,'Color', [0,.3,0], 'LineWidth', 2, 'Clipping', 'off');
0076 hold off;
0077 end
0078
0079 function hh= working_quiver( varargin )
0080
0081
0082
0083
0084 v = version;
0085 octave = exist('OCTAVE_VERSION') | str2num(v(1)) < 7;
0086 if octave
0087 hh = quiver( varargin{:} );
0088 else
0089 hh = quiver('v6', varargin{:} );
0090 end