BUILD_AND_EVAL_MODEL: Builds a model for the set of images and points and measures it. Code written by Katherine Smith, 2003 GENERAL score = build_and_eval_model (image_set, points_set, norm_type) INPUT/S -image_set: The set of images. -points_set: The set of points. -norm_type: Normalisation type? OUTPUT/S -score: Then score of the model. PENDING WORK -Find out the meaning od normalisation type. KNOWN BUG/S COMMENT/S -This does the same thingas BUILD_MODEL but also evaluates it RELATED FUNCTION/S 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 score = build_and_eval_model(image_set, points_set, norm_type) 0002 % BUILD_AND_EVAL_MODEL: Builds a model for the set of images and points and 0003 % measures it. 0004 % 0005 % Code written by Katherine Smith, 2003 0006 % 0007 % GENERAL 0008 % 0009 % score = build_and_eval_model 0010 % (image_set, points_set, norm_type) 0011 % 0012 % INPUT/S 0013 % 0014 % -image_set: 0015 % The set of images. 0016 % 0017 % -points_set: 0018 % The set of points. 0019 % 0020 % -norm_type: 0021 % Normalisation type? 0022 % 0023 % OUTPUT/S 0024 % 0025 % -score: 0026 % Then score of the model. 0027 % 0028 % PENDING WORK 0029 % 0030 % -Find out the meaning od normalisation type. 0031 % 0032 % KNOWN BUG/S 0033 % 0034 % 0035 % 0036 % COMMENT/S 0037 % 0038 % -This does the same thingas BUILD_MODEL but also evaluates it 0039 % 0040 % RELATED FUNCTION/S 0041 % 0042 % BUILD_MODEL 0043 % 0044 % ABOUT 0045 % 0046 % -Created: November 23rd, 2003 0047 % -Last update: December 1st, 2003 0048 % -Revision: 0.0.2 0049 % -Author: R. S. Schestowitz, University of Manchester 0050 % ============================================================== 0051 0052 keep = 0.9999; 0053 [intensity_model.pcs,intensity_model.variances,intensity_model.params, intensity_model.mean, intensity_model.var_r, intensity_model.total_var, intensity_model.impdata] = st_pca(image_set', keep); 0054 [shape_model.pcs,shape_model.variances,shape_model.params, shape_model.mean, shape_model.var_r, shape_model.total_var, shape_model.impdata] = st_pca(points_set', keep); 0055 0056 if(norm_type == 'variance') 0057 intensity_model.sd = std(intensity_model.params); 0058 shape_model.sd = std(shape_model.params); 0059 0060 % combine params - initially normalise to variance described in model 0061 total_shape_variance = sum(shape_model.variances); 0062 total_intensity_variance = sum(intensity_model.variances); 0063 c_model.shape_weight = ones(1,size(shape_model.pcs,2)); 0064 if(total_shape_variance ~= 0) 0065 c_model.shape_weight(:) = sqrt(total_intensity_variance/total_shape_variance); 0066 % w_shapeweight(:) = sqrt(ones(1,length(w_shape_variances))*total_intensity_variance/total_shape_variance); 0067 end 0068 else 0069 error(['Unknown normalisation type: ',norm_type]); 0070 end 0071 0072 [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); 0073 0074 % get the combined model 0075 0076 c_model.sd = sqrt(c_model.variances); 0077 c_model.intensity_model = intensity_model; 0078 c_model.shape_model = shape_model; 0079 c_model.n_shape_modes = size(shape_model.sd,2); 0080 c_model.label = 'Warp'; 0081 0082 score = measure_model(c_model.variances, 50); 0083 % now return the evaluation of this newly constructed model