set_electrodes.sci

来自「用来实现三维阻抗及光学断层成像重建的matlab程序」· SCI 代码 · 共 166 行

SCI
166
字号
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 then        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  //!! Unknown function trimesh ,the original calling sequence is usedtrimesh(srf,vtx(:,1),vtx(:,2),vtx(:,3)); //!! Unknown function axis ,the original calling sequence is usedaxis('image'); //!! Scilab set function is a partial emulation of the Matlab oneset(xget('window'),'Colormap',[0,0,0]); //!! Unknown function axis ,the original calling sequence is usedaxis('off'); //!! Unknown function hidden ,the original calling sequence is usedhidden('off'); //!! Unknown function view ,the original calling sequence is usedview(VV);  //and any previous patchesif ~((sels==[])==%t) then     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'); halt(); //!! gca has no Scilab equivalent! //!! Scilab get function is a partial emulation of the Matlab oneVV = get(gca(),'View'); sel = laserbeam(vtx,srf,cnts); paint_electrodes(sel,srf,vtx);  //Now confirmation about sel is required.  //!! Unknown function questdlg ,the original calling sequence is usedbutton = questdlg('Was the positioning OK?','Electrode confirmation','Yes','No','Help','No');if button=='Yes' then  disp('Creating electrode');elseif button=='No' then  disp('Canceling electrode');elseif button=='Help' then  disp('Sorry, no help available');end  if button=='Yes' then     ele_face = [ele_face;srf(sel,:)];  sels = [sels;sel];   end  if button=='No' then     ele_face = ele_face;     //Plot the surface     //!! Unknown function trimesh ,the original calling sequence is used  trimesh(srf,vtx(:,1),vtx(:,2),vtx(:,3));     //!! Unknown function axis ,the original calling sequence is used  axis('image');     //!! Scilab set function is a partial emulation of the Matlab one  set(xget('window'),'Colormap',[0,0,0]);     //!! Unknown function axis ,the original calling sequence is used  axis('off');     //!! Unknown function hidden ,the original calling sequence is used  hidden('off');     for u = 1:size(sels)         paint_electrodes(sels(u),srf,vtx);       end   end   //!! Unknown function view ,the original calling sequence is usedview(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 + =
减小字号Ctrl + -
显示快捷键?