<<loader>> return transform matrix and coordinate types from POS-MAT file [usage] [transmat, type_bef, type_aft] = vb_posfile_get_transinfo(posfile) [input] posfile : <required> <<file>> POS-MAT file [output] transmat : transform matrix [4x4 double] type_bef : coordinate type before transforming [x1 string] type_aft : coordinate type after transforming [x1 string] [note] now on specify [history] 2008-02-25 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [transmat, type_bef, type_aft] = vb_posfile_get_transinfo(posfile) 0002 % <<loader>> return transform matrix and coordinate types from POS-MAT file 0003 % [usage] 0004 % [transmat, type_bef, type_aft] = vb_posfile_get_transinfo(posfile) 0005 % [input] 0006 % posfile : <required> <<file>> POS-MAT file 0007 % [output] 0008 % transmat : transform matrix [4x4 double] 0009 % type_bef : coordinate type before transforming [x1 string] 0010 % type_aft : coordinate type after transforming [x1 string] 0011 % [note] 0012 % now on specify 0013 % [history] 0014 % 2008-02-25 (Sako) initial version 0015 % 0016 % Copyright (C) 2011, ATR All Rights Reserved. 0017 % License : New BSD License(see VBMEG_LICENSE.txt) 0018 0019 % --- CHECK ARGUMENTS --- % 0020 if ~exist('posfile', 'var'), posfile = ''; end 0021 [posfile] = inner_check_arguments(posfile); 0022 0023 % --- MAIN PROCEDURE --------------------------------------------------------- % 0024 % 0025 load(posfile, 'trans_info'); 0026 if ~exist('trans_info', 'var') 0027 transmat = []; 0028 type_bef = ''; 0029 type_aft = ''; 0030 return; 0031 end 0032 0033 transmat = trans_info.trans_mri; 0034 type_bef = trans_info.coord_type_before; 0035 type_aft = trans_info.coord_type_after; 0036 return; 0037 % 0038 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0039 0040 % --- INNER FUNCTIONS -------------------------------------------------------- % 0041 % 0042 % --- inner_check_arguments() 0043 % 0044 function [posfile] = inner_check_arguments(posfile) 0045 func_ = mfilename; 0046 if isempty(posfile) 0047 error('(%s)posfile is a required parameter', func_); 0048 end 0049 if exist(posfile, 'file') ~= 2 0050 error('(%s)cannot find posfile : %s', func_); 0051 end 0052 return; 0053 % 0054 % --- end of inner_check_arguments() 0055 % 0056 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0057 0058 %%% END OF FILE %%%