


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