do posterior work for some works that require only valid coordinates [usage] [coord] = vb_valid_coordinate_filter_decode(file_spec) [input] filt_spec : <required> filtering specifications : that is basically made by "encoding" : - valid_coord : valid coordinates : : matrix:[Npoint x Ndimension] : - org_size : original size of coordinates [Npoint x Ndim] : : e.g. [10000 3] : - v_coord_idx : index of valid coord in original[N x 1] [output] coord : its size is the same as the original coordinate [note] [history] 2007-04-18 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [coord] = vb_valid_coordinate_filter_decode(filt_spec) 0002 % do posterior work for some works that require only valid coordinates 0003 % [usage] 0004 % [coord] = vb_valid_coordinate_filter_decode(file_spec) 0005 % [input] 0006 % filt_spec : <required> filtering specifications 0007 % : that is basically made by "encoding" 0008 % : - valid_coord : valid coordinates 0009 % : : matrix:[Npoint x Ndimension] 0010 % : - org_size : original size of coordinates [Npoint x Ndim] 0011 % : : e.g. [10000 3] 0012 % : - v_coord_idx : index of valid coord in original[N x 1] 0013 % [output] 0014 % coord : its size is the same as the original coordinate 0015 % [note] 0016 % 0017 % [history] 0018 % 2007-04-18 (Sako) initial version 0019 % 0020 % Copyright (C) 2011, ATR All Rights Reserved. 0021 % License : New BSD License(see VBMEG_LICENSE.txt) 0022 0023 % --- CHECK ARGUMENTS --- % 0024 if ~exist('filt_spec', 'var') filt_spec = []; end 0025 [filt_spec] = inner_check_arguments(filt_spec); 0026 0027 % --- MAIN PROCEDURE --------------------------------------------------------- % 0028 % 0029 Npoints = filt_spec.org_size(1); 0030 coord = repmat(INVALID_COORDINATE_3D, [Npoints, 1]); % Npoints x invalid_coordinate_3d 0031 coord(filt_spec.v_coord_idx, :) = filt_spec.valid_coord; 0032 % 0033 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0034 0035 % --- INNER FUNCTIONS -------------------------------------------------------- % 0036 % 0037 function [filt_spec] = inner_check_arguments(filt_spec) 0038 if isempty(filt_spec) 0039 error('filt_spec is a required parameter'); 0040 end 0041 0042 if ~isfield(filt_spec, 'valid_coord') ... 0043 || ~isfield(filt_spec, 'org_size') ... 0044 || ~isfield(filt_spec, 'v_coord_idx') 0045 error('incomplete filt_spec'); 0046 end 0047 0048 % check consistency between fields 0049 n_vp1 = size(filt_spec.valid_coord, 1); 0050 n_vp2 = size(filt_spec.v_coord_idx, 1); 0051 n_org = filt_spec.org_size(1); 0052 if n_vp1 ~= n_vp2 0053 error('%s : lengths of valid_coord and v_coord_idx are different', ... 0054 'invalid filt_spec'); 0055 end 0056 0057 if n_org < n_vp1 0058 error('%s : length of original data is shorter than valid one', ... 0059 'invalid filt_spec'); 0060 end 0061 % 0062 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0063 0064 %%% END OF FILE %%%