CONSTRUCT_MODEL_EXAMPLE: Constructs a model example Code written by Katherine Smith, 2003 GENERAL [example, example_shape] = construct_model_example(params, model, ref_points_vec); INPUT/S -params: Input parameters. meaning of each parameter is yet to be resolved. -model: X -ref_points_vec: X OUTPUT/S -example X -example_shape X PENDING WORK -Find out what each parameters does (see INPUT/S) KNOWN BUG/S - COMMENT/S - RELATED FUNCTION/S ABOUT -Created: November 23rd, 2003 -Last update: Novermber 24th, 2003 -Revision: 0.0.2 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function [example, example_shape] = construct_model_example(params, model, ref_points_vec); 0002 % CONSTRUCT_MODEL_EXAMPLE: Constructs a model example 0003 % 0004 % Code written by Katherine Smith, 2003 0005 % 0006 % GENERAL 0007 % 0008 % [example, example_shape] = 0009 % construct_model_example(params, model, ref_points_vec); 0010 % 0011 % 0012 % INPUT/S 0013 % 0014 % -params: 0015 % Input parameters. meaning of each parameter is 0016 % yet to be resolved. 0017 % 0018 % -model: 0019 % X 0020 % 0021 % -ref_points_vec: 0022 % X 0023 % 0024 % OUTPUT/S 0025 % 0026 % -example 0027 % X 0028 % 0029 % -example_shape 0030 % X 0031 % 0032 % PENDING WORK 0033 % 0034 % -Find out what each parameters does (see INPUT/S) 0035 % 0036 % KNOWN BUG/S 0037 % 0038 % - 0039 % 0040 % COMMENT/S 0041 % 0042 % - 0043 % 0044 % RELATED FUNCTION/S 0045 % 0046 % 0047 % 0048 % ABOUT 0049 % 0050 % -Created: November 23rd, 2003 0051 % -Last update: Novermber 24th, 2003 0052 % -Revision: 0.0.2 0053 % -Author: R. S. Schestowitz, University of Manchester 0054 % ============================================================== 0055 0056 combined_shape_pcs = model.pcs(1:model.n_shape_modes,:); 0057 combined_intensity_pcs = model.pcs(model.n_shape_modes+1:size(model.pcs),:); 0058 0059 % get shape-free grey-level image 0060 example_sample = model.intensity_model.mean' + ... 0061 sum(model.intensity_model.pcs * (combined_intensity_pcs .* ... 0062 repmat(params,size(combined_intensity_pcs,1),1)),2); 0063 0064 % get reparameterisation 0065 where = find(model.shape_weight==0); 0066 model.shape_weight(where) = realmax; 0067 example_shape = model.shape_model.mean' + ... 0068 sum((model.shape_model.pcs ./ repmat(model.shape_weight,size(model.shape_model.pcs,1),1)) * (combined_shape_pcs .* ... 0069 repmat(params,size(combined_shape_pcs,1),1)),2); 0070 0071 % warp the shape-free image from above! 0072 example = interp1(ref_points_vec, example_sample, example_shape, 'linear',0); 0073