0001 function [curv] = mne_read_curvature(fname)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 me='MNE:mne_read_curvature';
0032
0033
0034
0035
0036 fid = fopen(fname,'rb','ieee-be');
0037
0038 if (fid < 0)
0039 error(me,'Cannot open file %s', fname);
0040 end;
0041
0042 magic = mne_fread3(fid) ;
0043 NEW_VERSION_MAGIC_NUMBER = 16777215;
0044 if (magic == NEW_VERSION_MAGIC_NUMBER)
0045 nvert = fread(fid, 1, 'int32');
0046 nface = fread(fid, 1, 'int32');
0047 val_per_vertex = fread(fid, 1, 'int32');
0048 if val_per_vertex ~= 1
0049 fclose(fid);
0050 error(me,'Values per vertex not equal to one');
0051 end
0052 curv = fread(fid, nvert, 'float') ;
0053 fprintf(1,'\t%d values read from a new style curvature file.\n',nvert);
0054 else
0055 nvert = magic;
0056 nface = mne_fread3(fid);
0057 curv = fread(fid, nvert, 'int16') ./ 100 ;
0058 fprintf(1,'\t%d values read from an old style curvature file.\n',nvert);
0059 end
0060
0061 fclose(fid);
0062
0063 return;