⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 set_electrodes.m

📁 用来实现三维阻抗及光学断层成像重建的matlab程序
💻 M
字号:
function [ele_face,sels,cnts,VV] = set_electrodes(vtx,srf,ele_face,sels,cnts,VV);
%function [ele_face,sels,cnts,VV] = set_electrodes(vtx,srf,ele_face,sels,cnts,VV);
%
%You need to call this function recursively to sellect boundary faces building up 
%the ele_face. You will need to reshape this matrix appropriately to get the elec 
%matrix, depending on how many faces there are in each electrode.
%
%
%
%vtx      = The vertices matrix
%srf      = The boundary surfaces
%ele_face = A 3 column matrix holding the boundary faces to be used for constructing 
%           the electrodes
%sels     = The indices in srf matrix of the sellected surfaces
%cnts     = The coordinates of the center of each triangular boundary surface.
%VV       = The last viewing angle.
%
%Call this function as follows
%
%[ele_face,sels,cnts,VV] = set_electrodes(vtx,srf,[],[],[],[30 60]);
%Only for the first time , for the first row of ele_face.
%and then ...
%[ele_face,sels,cnts,VV] = set_electrodes(vtx,srf,ele_face,sels,cnts,VV);




if size(cnts,1) == 0


cnts = []; % Vector containing the geometric center of each triangular 
			  % surface in x,y,z coordinates.
 
for i=1:size(srf,1)
   
   a = srf(i,1);
   b = srf(i,2);
   c = srf(i,3);
   
   ccnx = (vtx(a,1) + vtx(b,1) + vtx(c,1))/3;
   ccny = (vtx(a,2) + vtx(b,2) + vtx(c,2))/3;
   ccnz = (vtx(a,3) + vtx(b,3) + vtx(c,3))/3;
   
   ccn = [ccnx,ccny,ccnz];
   
   cnts = [cnts; ccn];
end


end

%Plot the surface

trimesh(srf,vtx(:,1),vtx(:,2),vtx(:,3));
axis image;
set(gcf,'Colormap',[0 0 0]);
axis off
hidden off
view(VV);


%and any previous patches
if ~isempty(sels) == 1 

for y=1:size(sels)
      
      paint_electrodes(sels(y),srf,vtx);
      
   end

end


disp('Rotate and click on the figure to locate electrode and then press ENTER');

pause; 

VV = get(gca,'View');

[sel] = laserbeam(vtx,srf,cnts);

paint_electrodes(sel,srf,vtx);
   

%Now confirmation about sel is required.

button = questdlg('Was the positioning OK?','Electrode confirmation','Yes','No','Help','No');
if strcmp(button,'Yes')
   disp('Creating electrode');
elseif strcmp(button,'No')
   disp('Canceling electrode');
   elseif strcmp(button,'Help')
   disp('Sorry, no help available')
end


if strcmp(button,'Yes')

ele_face = [ele_face; srf(sel,:)];
sels = [sels;sel];

end

   
if strcmp(button,'No')  
   
ele_face = ele_face;
   
%Plot the surface
trimesh(srf,vtx(:,1),vtx(:,2),vtx(:,3));
axis image;
set(gcf,'Colormap',[0 0 0]);
axis off
hidden off

   for u=1:size(sels)
      
      paint_electrodes(sels(u),srf,vtx);
      
   end
  
end


view(VV);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is part of the EIDORS suite.
% Copyright (c) N. Polydorides 2001
% Copying permitted under terms of GNU GPL
% See enclosed file gpl.html for details.
% EIDORS 3D version 1.0
% MATLAB version 5.3 R11
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -