function [S, v, f] = read_asc(fname) Reads asc-file with patch-information Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [S, v, f] = read_asc(fname) 0002 % function [S, v, f] = read_asc(fname) 0003 % 0004 % Reads asc-file with patch-information 0005 % 0006 % Copyright (C) 2011, ATR All Rights Reserved. 0007 % License : New BSD License(see VBMEG_LICENSE.txt) 0008 0009 0010 % 0011 % read_asc.m 0012 % 0013 % Original Author: Bruce Fischl 0014 % CVS Revision Info: 0015 % $Author: nicks $ 0016 % $Date: 2011/03/02 00:04:12 $ 0017 % $Revision: 1.3 $ 0018 % 0019 % Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH" 0020 % 0021 % Terms and conditions for use, reproduction, distribution and contribution 0022 % are found in the 'FreeSurfer Software License Agreement' contained 0023 % in the file 'LICENSE' found in the FreeSurfer distribution, and here: 0024 % 0025 % https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSoftwareLicense 0026 % 0027 % Reporting: freesurfer@nmr.mgh.harvard.edu 0028 % 0029 0030 fp = fopen(fname, 'r'); 0031 0032 % Dump first line 0033 fgets(fp); 0034 0035 % Nr of vertices and faces 0036 S = zeros(1, 3); 0037 S(1) = 1; 0038 [S(2:3)] = fscanf(fp, '%d', 2); 0039 0040 % Read vertices and its indices 0041 v = fscanf(fp, '%f', S(2)*4); 0042 v = reshape(v, [4 S(2)])'; 0043 % v(:, 1) = v(:, 1)+1; % 2012/04/27 M.Fukushima [comment out] 0044 0045 % Read faces and its indices 0046 f = fscanf(fp, '%d', S(3)*4); % 2012/04/27 M.Fukushima S(3)*5 -> S(3)*4 0047 f = reshape(f, [4 S(3)])'; % 2012/04/27 M.Fukushima [5 S(3)] -> [4 S(3)] 0048 % f = f+1; % 2012/04/27 M.Fukushima [comment out] 0049 0050 fclose(fp);