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