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