Home > functions > device > acqdata > vb_facefile_get_spherical_info.m

vb_facefile_get_spherical_info

PURPOSE ^

<<getter>> return center and radius from FACE-MAT file

SYNOPSIS ^

function [sph_info] = vb_facefile_get_spherical_info(facefile)

DESCRIPTION ^

 <<getter>> return center and radius from FACE-MAT file

 [usage]
   [sph_info] = vb_facefile_get_spherical_info(facefile)

 [input]
   facefile : <required> <<file>> FACE-MAT file

 [output]
   sph_info : <<struct>> spherical information as follows
            :  .Center : center coordinate of spherical head [1x3 double]
            :  .Radius : radius of spherical head [x1 double]
            :  .CoordType : coordinate type [x1 string]

 [note]
   
 [history]
   2008-02-25 (Sako) initial version
   2008-03-07 (rhayashi) support old and ver1.0 FACE-MAT file.

 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [sph_info] = vb_facefile_get_spherical_info(facefile)
0002 % <<getter>> return center and radius from FACE-MAT file
0003 %
0004 % [usage]
0005 %   [sph_info] = vb_facefile_get_spherical_info(facefile)
0006 %
0007 % [input]
0008 %   facefile : <required> <<file>> FACE-MAT file
0009 %
0010 % [output]
0011 %   sph_info : <<struct>> spherical information as follows
0012 %            :  .Center : center coordinate of spherical head [1x3 double]
0013 %            :  .Radius : radius of spherical head [x1 double]
0014 %            :  .CoordType : coordinate type [x1 string]
0015 %
0016 % [note]
0017 %
0018 % [history]
0019 %   2008-02-25 (Sako) initial version
0020 %   2008-03-07 (rhayashi) support old and ver1.0 FACE-MAT file.
0021 %
0022 % Copyright (C) 2011, ATR All Rights Reserved.
0023 % License : New BSD License(see VBMEG_LICENSE.txt)
0024 
0025 % --- CHECK ARGUMENTS --- %
0026 if ~exist('facefile', 'var'), facefile = []; end
0027 [facefile] = inner_check_arguments(facefile);
0028 
0029 % --- MAIN PROCEDURE --------------------------------------------------------- %
0030 %
0031 
0032 face = load(facefile);
0033 if ~isfield(face, 'header')
0034     version = 0;
0035 else
0036     version = face.header.version;
0037 end
0038 
0039 switch(version)
0040     case 0
0041         if isfield(face.subject, 'spherical_head')
0042             if isfield(face.subject.spherical_head, 'Vcenter')
0043                 center = face.subject.spherical_head.Vcenter;
0044                 radius = face.subject.spherical_head.Vradius;
0045                 coord_type = face.subject.spherical_head.coord_type;
0046             else
0047                 center = [];
0048                 radius = [];
0049                 coord_type = [];
0050             end
0051         end
0052     otherwise
0053         if isfield(face, 'spherical_head')
0054             center = face.spherical_head.Vcenter;
0055             radius = face.spherical_head.Vradius;
0056             coord_type = face.coord_type;
0057         else
0058             center = [];
0059             radius = [];
0060             coord_type = [];
0061         end
0062 end
0063 
0064 sph_info = struct;
0065 sph_info.Center = center;
0066 sph_info.Radius = radius;
0067 sph_info.CoordType = coord_type;
0068 
0069 return;
0070 %
0071 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0072 
0073 % --- INNER FUNCTIONS -------------------------------------------------------- %
0074 %
0075 % --- inner_check_arguments()
0076 %
0077 function [facefile] = inner_check_arguments(facefile)
0078 func_ = mfilename;
0079 if isempty(facefile)
0080   error('(%s)facefile is a required parameter', func_);
0081 end
0082 if exist(facefile, 'file') ~= 2
0083   error('(%s)cannot find facefile : %s', func_, facefile);
0084 end
0085 return;
0086 %
0087 % --- end of inner_check_arguments()
0088 %
0089 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0090 
0091 % --- END OF FILE --- %

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005