Home > bioelectromagnetism > vertices_connectivity.m

vertices_connectivity

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 <div class="moz-text-flowed" style="font-family: -moz-fixed">function VertConn = vertices_connectivity(FV,VERBOSE);
0002 %VERTICES_CONNECTIVITY - Generate the connections between vertices
0003 % function VertConn = vertices_connectivity(FV,VERBOSE);
0004 % function VertConn = vertices_connectivity(FV);
0005 % FV is the standard matlab structure for faces and vertices,
0006 %  where FV.faces is m x 3, and FV.vertices is n x 3.
0007 %
0008 % VertConn returned is vector of cells, one-to-one with each row of FV.vertices.
0009 % VertConn{i} returns a row vector of the vertex numbers (rows in FV.vertices) that
0010 %  are connected by faces to the ith vertex row in FV.vertices.
0011 %
0012 % Thus if we want to 'swell' the region around a vertex, VertConn{i} gives us the
0013 %  vertex numbers of those vertices that are adjacent.
0014 %
0015 % See also FACES_CONNECTIVITY
0016 
0017 %<autobegin> ---------------------- 26-May-2004 11:34:41 -----------------------
0018 % --------- Automatically Generated Comments Block Using AUTO_COMMENTS ---------
0019 %
0020 % CATEGORY: Visualization
0021 %
0022 % At Check-in: $Author: Mosher $  $Revision: 14 $  $Date: 5/26/04 10:02a $
0023 %
0024 % This software is part of BrainStorm Toolbox Version 2.0 (Alpha) 24-May-2004
0025 %
0026 % Principal Investigators and Developers:
0027 % ** Richard M. Leahy, PhD, Signal & Image Processing Institute,
0028 %    University of Southern California, Los Angeles, CA
0029 % ** John C. Mosher, PhD, Biophysics Group,
0030 %    Los Alamos National Laboratory, Los Alamos, NM
0031 % ** Sylvain Baillet, PhD, Cognitive Neuroscience & Brain Imaging Laboratory,
0032 %    CNRS, Hopital de la Salpetriere, Paris, France
0033 %
0034 % See BrainStorm website at http://neuroimage.usc.edu for further information.
0035 %
0036 % Copyright (c) 2004 BrainStorm by the University of Southern California
0037 % This software distributed  under the terms of the GNU General Public License
0038 % as published by the Free Software Foundation. Further details on the GPL
0039 % license can be found at http://www.gnu.org/copyleft/gpl.html .
0040 %
0041 % FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE
0042 % UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY
0043 % WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
0044 % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY
0045 % LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE.
0046 %<autoend> ------------------------ 26-May-2004 11:34:41 -----------------------
0047 
0048 % ----------------------------- Script History ---------------------------------
0049 % 1994 by John C. Mosher, Ph.D.
0050 % 19-Nov-1999 Based on May 1998 scripts.
0051 % 19-May-2004 JCM Comments Cleaning
0052 % ----------------------------- Script History ---------------------------------
0053 
0054 if(~exist('VERBOSE','var')),
0055    VERBOSE = 1; % default non-silent running of waitbars
0056 end
0057 
0058 nv = size(FV.vertices,1);
0059 [nf,ns] = size(FV.faces); % number of faces, number of sides per face
0060 
0061 VertConn = cell(nv,1); % one empty cell per vertex
0062 
0063 if(VERBOSE)
0064    % disp(sprintf('Processing %.0f faces',nf))
0065    hwait = waitbar(0,sprintf('Processing the Vertex Connectivity for %.0f faces',nf));
0066    drawnow %flush the display
0067 end
0068 
0069 for iv = 1:nf, % use each face's information
0070    if(VERBOSE)
0071       if(~rem(iv,max(round(nf/10),1))), % ten updates
0072          % fprintf(' %.0f',iv);d
0073          waitbar(iv/nf,hwait);
0074          drawnow %flush the display
0075       end
0076    end
0077    for i = 1:ns, %each vertex of the face
0078       for j = 0:(ns-2), % each additional vertex
0079          VertConn{FV.faces(iv,i)}(end+1) = FV.faces(iv,rem(i+j,ns)+1);
0080       end
0081    end
0082 end
0083 close(hwait);
0084 
0085 if(VERBOSE),
0086    hwait = waitbar(0,sprintf('Now sorting the vertex results'));
0087    drawnow %flush the display
0088 end
0089 
0090 for i = 1:nv,
0091    if(VERBOSE)
0092       if(~rem(i,round(nv/10))), % ten updates
0093          waitbar(i/nv,hwait);
0094          drawnow %flush the display
0095       end
0096    end
0097    VertConn{i} = unique(VertConn{i});
0098 end
0099 close(hwait);
0100 
0101 return
0102 </div>

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003