EVAL_MI_CPS_WARP: get similarity score between CPS warped image and reference. (Evaluate the clamped-plate spline warp using mean-squared-difference) Code written by Katherine Smith, 2003 GENERAL score = eval_msd_cps_warp(params, start_points_vec, ref_image_vec) INPUT/S -params: The paramters of the warps. params(1): warp centre params(2): r params(3): d -warp centre: Not in parameters already?? -r: Not in parameters already?? -start_points_vec: Points before CPS warp. -start_image_vec: Image before CPS warp. -ref_image_vec: The reference image to be compared to. OUTPUT/S -score: The similarity score w.r.t. the reference image. (Mutual information) PENDING WORK - KNOWN BUG/S -None. COMMENT/S - RELATED FUNCTION/S LINEAR_WARP, MSD, EVAL_MSD, EVAL_MODEL_MULTI_WARP ABOUT -Created: November 23rd, 2003 -Last update: Novermber 27th, 2003 -Revision: 0.0.4 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function score = eval_mi_cps_warp(params, warp_centre, r, start_points_vec, start_image_vec, ref_image_vec) 0002 % EVAL_MI_CPS_WARP: get similarity score between CPS warped image and 0003 % reference. (Evaluate the clamped-plate spline warp using 0004 % mean-squared-difference) 0005 % 0006 % Code written by Katherine Smith, 2003 0007 % 0008 % GENERAL 0009 % 0010 % score = eval_msd_cps_warp(params, start_points_vec, ref_image_vec) 0011 % 0012 % INPUT/S 0013 % 0014 % -params: 0015 % The paramters of the warps. 0016 % 0017 % params(1): warp centre 0018 % params(2): r 0019 % params(3): d 0020 % 0021 % -warp centre: 0022 % Not in parameters already?? 0023 % 0024 % -r: 0025 % Not in parameters already?? 0026 % 0027 % -start_points_vec: 0028 % Points before CPS warp. 0029 % 0030 % -start_image_vec: 0031 % Image before CPS warp. 0032 % 0033 % -ref_image_vec: 0034 % The reference image to be compared to. 0035 % 0036 % OUTPUT/S 0037 % 0038 % -score: 0039 % The similarity score w.r.t. the reference image. 0040 % (Mutual information) 0041 % 0042 % PENDING WORK 0043 % 0044 % - 0045 % 0046 % KNOWN BUG/S 0047 % 0048 % -None. 0049 % 0050 % COMMENT/S 0051 % 0052 % - 0053 % 0054 % RELATED FUNCTION/S 0055 % 0056 % LINEAR_WARP, MSD, EVAL_MSD, 0057 % EVAL_MODEL_MULTI_WARP 0058 % 0059 % ABOUT 0060 % 0061 % -Created: November 23rd, 2003 0062 % -Last update: Novermber 27th, 2003 0063 % -Revision: 0.0.4 0064 % -Author: R. S. Schestowitz, University of Manchester 0065 % ============================================================== 0066 0067 % warp_centre = params(1); 0068 % r = params(1); 0069 d = params(1); 0070 0071 % rescale 0072 0073 % normalise params to 1 0074 0075 max_d = 0.67; 0076 0077 %scaled_d = d/r; 0078 0079 if ((abs(d) > max_d) | ((warp_centre-r <0) | (warp_centre+r > max(start_points_vec)))) 0080 0081 % if any of the parameters is not between -0.67 0082 %and 0.67, or the warp's location or size is invalid 0083 score = size(start_points_vec,1); % set to number of points??? 0084 else 0085 % if okay 0086 warped_points = cps_warp_1d(start_points_vec,warp_centre,r,d); 0087 % apply warp 0088 warped_image = interp1(start_points_vec,start_image_vec,warped_points, 'linear',0); 0089 % interpolate to create warped image from the warped points 0090 score = mi(ref_image_vec, warped_image, 256); 0091 % score acc to mutual information measure (entropy) 0092 end 0093 params 0094 % display parameters and score (still under debugging??) 0095 score