Home > vbmeg > functions > brain > vb_ScriptLoadSRF.m

vb_ScriptLoadSRF

PURPOSE ^

vb_ScriptLoadSRF

SYNOPSIS ^

function Srf=vb_ScriptLoadSRF(infile)

DESCRIPTION ^

vb_ScriptLoadSRF
 20 Dec 2001 N.Goda

 Modified by Taku Yoshioka
 2003-07-11 ファイルが無い場合にメッセージを表示

infile='ng_LH_WM.srf';
outfile='ng_LH_WM';

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Srf=vb_ScriptLoadSRF(infile)
0002 %vb_ScriptLoadSRF
0003 % 20 Dec 2001 N.Goda
0004 %
0005 % Modified by Taku Yoshioka
0006 % 2003-07-11 ファイルが無い場合にメッセージを表示
0007 %
0008 %infile='ng_LH_WM.srf';
0009 %outfile='ng_LH_WM';
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014  
0015 Srf.filename=infile;
0016 if ~exist(infile)
0017   error(sprintf('file %s not fount',infile));
0018 end
0019 
0020 fid=fopen(infile,'r','ieee-le');
0021 Srf.Version=fread(fid,1,'float32');
0022 fread(fid,1,'int32');
0023 Srf.NrOfVertices=fread(fid,1,'int32');
0024 Srf.NrOfTriangles=fread(fid,1,'int32');
0025 Srf.MeshCenterX=fread(fid,1,'float32');
0026 Srf.MeshCenterY=fread(fid,1,'float32');
0027 Srf.MeshCenterZ=fread(fid,1,'float32');
0028 Srf.VertexX=fread(fid,Srf.NrOfVertices,'float32');
0029 Srf.VertexY=fread(fid,Srf.NrOfVertices,'float32');
0030 Srf.VertexZ=fread(fid,Srf.NrOfVertices,'float32');
0031 Srf.NormalX=fread(fid,Srf.NrOfVertices,'float32');
0032 Srf.NormalY=fread(fid,Srf.NrOfVertices,'float32');
0033 Srf.NormalZ=fread(fid,Srf.NrOfVertices,'float32');
0034 Srf.Colors=fread(fid,8,'float32');
0035 Srf.MeshColor=fread(fid,Srf.NrOfVertices,'int32');
0036 for i=1:Srf.NrOfVertices
0037     n=fread(fid,1,'int32');
0038     fread(fid,n,'int32')';
0039 end
0040 Srf.Triangles=fread(fid,[3 Srf.NrOfTriangles],'int32')';
0041 Srf.NrOfStripElements=fread(fid,1,'int32');
0042 if Srf.NrOfStripElements>0
0043     Srf.StripElements=fread(fid,Srf.NrOfStripElements,'int32')
0044 end
0045 fclose(fid);
0046 
0047 %save(outfile,'Srf');
0048

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