0001 function [marker, marker_name, ch_pos, ch_name] = vb_load_itk(fname)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 marker = [];
0020 marker_name = cell(3,1);
0021 ch_pos = [];
0022 ch_name = [];
0023
0024 fid = fopen(fname,'r');
0025
0026 if fid == -1
0027 error('file open error')
0028 end
0029
0030 k = 0;
0031 flg = true;
0032
0033 while ( flg == true )
0034 line = fgets(fid);
0035
0036 if line == -1
0037 flg = false;
0038 break;
0039
0040 elseif ~isempty(deblank(line))
0041 [name, pos(1), pos(2), pos(3)] = strread(line, '%s%f%f%f');
0042
0043 switch( char(name) )
0044 case 'LPA'
0045 marker(1,:) = pos(:)';
0046 marker_name(1,1) =name;
0047 case 'Nasion'
0048 marker(2,:) = pos(:)';
0049 marker_name(2,1) = name;
0050 case 'RPA'
0051
0052 marker(3,:) = pos(:)';
0053 marker_name(3,1) = name;
0054 otherwise
0055 k = k+1;
0056 ch_pos(k, :) = pos(:)';
0057 ch_name = [ch_name; name];
0058 end
0059 end
0060 end
0061
0062
0063 fclose(fid);
0064