Home > Source > Build > build_model_from_models.m

build_model_from_models

PURPOSE ^

BUILD_MODEL_FROM_MODELS: Builds a combined model from shape

SYNOPSIS ^

function c_model = build_model_from_models(shape_model, intensity_model, label, norm_type, shape_weight)

DESCRIPTION ^

 BUILD_MODEL_FROM_MODELS: Builds a combined model from shape
                          and intensity models.

 Code written by Katherine Smith, 2003

    GENERAL

       c_model = build_model_from_models(shape_model, 
          intensity_model, label, norm_type, shape_weight)


    INPUT/S

      -shape_model:
           The shape model.

      -intensity_model:
           The intensity model

      -label:
           Label of the model created?

      -norm_type:


      -shape_weight:
          The value of Ws which is the weighing factor in the model.

           
    OUTPUT/S

      -c_model:
           The model built.

    PENDING WORK

      

    KNOWN BUG/S

      

    COMMENT/S

        -Smiliar to BUILD_MODEL
         It appears to build some optimised model which is combined given some model of shape and model
         of intensity.

    RELATED FUNCTION/S

      BUILD_AND_EVALUATE_MODEL, BUILD_MODEL

    ABOUT

      -Created:     November 23rd, 2003
      -Last update: December 1st, 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 c_model = build_model_from_models(shape_model, intensity_model, label, norm_type, shape_weight)
0002 % BUILD_MODEL_FROM_MODELS: Builds a combined model from shape
0003 %                          and intensity models.
0004 %
0005 % Code written by Katherine Smith, 2003
0006 %
0007 %    GENERAL
0008 %
0009 %       c_model = build_model_from_models(shape_model,
0010 %          intensity_model, label, norm_type, shape_weight)
0011 %
0012 %
0013 %    INPUT/S
0014 %
0015 %      -shape_model:
0016 %           The shape model.
0017 %
0018 %      -intensity_model:
0019 %           The intensity model
0020 %
0021 %      -label:
0022 %           Label of the model created?
0023 %
0024 %      -norm_type:
0025 %
0026 %
0027 %      -shape_weight:
0028 %          The value of Ws which is the weighing factor in the model.
0029 %
0030 %
0031 %    OUTPUT/S
0032 %
0033 %      -c_model:
0034 %           The model built.
0035 %
0036 %    PENDING WORK
0037 %
0038 %
0039 %
0040 %    KNOWN BUG/S
0041 %
0042 %
0043 %
0044 %    COMMENT/S
0045 %
0046 %        -Smiliar to BUILD_MODEL
0047 %         It appears to build some optimised model which is combined given some model of shape and model
0048 %         of intensity.
0049 %
0050 %    RELATED FUNCTION/S
0051 %
0052 %      BUILD_AND_EVALUATE_MODEL, BUILD_MODEL
0053 %
0054 %    ABOUT
0055 %
0056 %      -Created:     November 23rd, 2003
0057 %      -Last update: December 1st, 2003
0058 %      -Revision:    0.0.2
0059 %      -Author:      R. S. Schestowitz, University of Manchester
0060 % ==============================================================
0061 
0062 c_model.shape_weight = ones(1,size(shape_model.pcs,2));
0063 if(strcmp(norm_type,'variance'))
0064     % combine params - initially normalise to variance described
0065       % in model
0066     total_shape_variance = sum(shape_model.variances);
0067     total_intensity_variance = sum(intensity_model.variances);
0068     if(total_shape_variance ~= 0)
0069         c_model.shape_weight(:) = sqrt(total_intensity_variance/total_shape_variance);
0070     end
0071 elseif(strcmp(norm_type,'constant'))
0072       c_model.shape_weight(:) = shape_weight;
0073 elseif(strcmp(norm_type,'edge'))
0074       edges = abs(diff(image_set,1,2));
0075       mean_edge_strength = sum(edges(:))/size(edges(:),1);
0076       c_model.shape_weight(:) = mean_edge_strength;
0077 else
0078       error(['Unknown normalisation type: ',norm_type]);
0079 end
0080 
0081 [c_model.pcs, c_model.variances, c_model.params, c_model.mean, c_model.total_var, c_model.impdata] = make_combined_model(shape_model, intensity_model, c_model.shape_weight);
0082 
0083 % make combined model with the new parematers applied.
0084 
0085 % copy some parameters to be returned by the function
0086 
0087 c_model.sd = sqrt(c_model.variances);
0088 c_model.intensity_model = intensity_model;
0089 c_model.shape_model = shape_model;
0090 c_model.n_shape_modes = size(shape_model.sd,2);
0091 c_model.label = label;

Generated on Fri 14-May-2004 10:05:30 by m2html © 2003