Home > Source > Model > construct_model_example.m

construct_model_example

PURPOSE ^

==============================================================

SYNOPSIS ^

function [example, example_shape] = construct_model_example(params, model, ref_points_vec);

DESCRIPTION ^

 ==============================================================
 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
 ==============================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Thu 13-May-2004 18:00:46 by m2html © 2003