Home > vbmeg > external > mne > mne_reduce_surface.m

mne_reduce_surface

PURPOSE ^

SYNOPSIS ^

function [verts, faces] = mne_reduce_surface(surfin,desired_ntri,surfout)

DESCRIPTION ^

  [verts, faces] = mne_reduce_surface(surfin,desired_ntri,surfout)

  verts       - Vertex coordinates in meters
  faces       - The triangulation information

  surfin      - Name of a surface file to read
  desired_nri - Desired number of triangles after reduction
  surfout     - Name of a surface file to hold the reduce surface (optional)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [verts, faces] = mne_reduce_surface(surfin,desired_ntri,surfout)
0002 %
0003 %  [verts, faces] = mne_reduce_surface(surfin,desired_ntri,surfout)
0004 %
0005 %  verts       - Vertex coordinates in meters
0006 %  faces       - The triangulation information
0007 %
0008 %  surfin      - Name of a surface file to read
0009 %  desired_nri - Desired number of triangles after reduction
0010 %  surfout     - Name of a surface file to hold the reduce surface (optional)
0011 %
0012 
0013 %
0014 %   Author : Matti Hamalainen, MGH Martinos Center
0015 %   License : BSD 3-clause
0016 %
0017 %
0018 %   Revision 1.2  2009/02/03 10:26:13  msh
0019 %   Added reading of 'new' quadrangle files
0020 %
0021 %   Revision 1.1  2009/01/28 20:43:52  msh
0022 %   Added mne_reduce_surface
0023 %
0024 %
0025 me='MNE:mne_reduce_surface';
0026 
0027 if nargin < 2
0028    error(me,'Incorrect number of input arguments');
0029 end
0030 
0031 fprintf(1,'Reading %s...\n',surfin);
0032 [surf.vertices,surf.faces] = mne_read_surface(surfin);
0033 
0034 ratio = desired_ntri/size(surf.faces,1);
0035 
0036 fprintf(1,'Reducing the number of triangles...');
0037 surf2 = reducepatch(surf,ratio);
0038 fprintf(1,'[done]\n');
0039 
0040 fprintf(1,'After reduction: %d vertices and %d triangles\n',size(surf2.vertices,1),size(surf2.faces,1));
0041 
0042 if nargin == 3
0043    mne_write_surface(surfout,surf2.vertices,surf2.faces);
0044 end
0045 
0046 verts = surf2.vertices;
0047 faces = surf2.faces;
0048 
0049 return

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005