freesurfer_surf_interp [values, int, keepindex, repindex] = freesurfer_surf_interp(surf,index,values) surf is a struct with fields, surf.vertices (Nx3) Cartesian coordinates surf.faces (Nx3) triangulation of the vertices index is the vertices where the values are known, which comprise a subset of the surf.vertices. returns the values interpolated onto the full surface (at all vertices) and an interpolation matrix (int) for interpolation of scalar values from a subset of the surface vertices (given by index) to the full surface. If index contains duplicate values, then keepindex is required to select only the unique values. see mesh_laplacian, mesh_laplacian_interp for more details
0001 function [values, int, keepindex, repindex] = freesurfer_surf_interp(surf,index,values) 0002 0003 % freesurfer_surf_interp 0004 % 0005 % [values, int, keepindex, repindex] = freesurfer_surf_interp(surf,index,values) 0006 % 0007 % surf is a struct with fields, 0008 % 0009 % surf.vertices (Nx3) Cartesian coordinates 0010 % surf.faces (Nx3) triangulation of the vertices 0011 % 0012 % index is the vertices where the values are known, which comprise a subset 0013 % of the surf.vertices. 0014 % 0015 % returns the values interpolated onto the full surface (at all vertices) 0016 % and an interpolation matrix (int) for interpolation of scalar values from 0017 % a subset of the surface vertices (given by index) to the full surface. 0018 % If index contains duplicate values, then keepindex is required to select 0019 % only the unique values. 0020 % 0021 % see mesh_laplacian, mesh_laplacian_interp for more details 0022 % 0023 0024 % $Revision: 1.1 $ $Date: 2005/05/18 23:07:42 $ 0025 0026 % Copyright (C) 2000 Darren L. Weber 0027 % 0028 % This program is free software; you can redistribute it and/or 0029 % modify it under the terms of the GNU General Public License 0030 % as published by the Free Software Foundation; either version 2 0031 % of the License, or (at your option) any later version. 0032 % 0033 % This program is distributed in the hope that it will be useful, 0034 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0035 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0036 % GNU General Public License for more details. 0037 % 0038 % You should have received a copy of the GNU General Public License 0039 % along with this program; if not, write to the Free Software 0040 % Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 0041 % USA. 0042 0043 % History: 09/2005, Darren.Weber_at_radiology.ucsf.edu 0044 % 0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0046 0047 ver = '$Revision: 1.1 $ $Date: 2005/05/18 23:07:42 $'; 0048 fprintf('FREESURFER_SURF_INTERP [v %s]\n',ver(11:15)); 0049 0050 0051 % now interpolate to the full surface properly 0052 lap = mesh_laplacian(surf.vertices,surf.faces); 0053 [int, keepindex, repindex] = mesh_laplacian_interp(lap, index); 0054 if isempty(repindex), 0055 pial.vertexCdata = int * values; 0056 else 0057 pial.vertexCdata = int * values(keepindex); 0058 end 0059 0060 0061 return