0001 function [verts, faces] = mne_reduce_surface(surfin,desired_ntri,surfout)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
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