EVAL_MI_CPS_WARP: get similarity score between CPS warped image and reference. (Evaluate the clamped-plate spline warp using mean-squared-differences) Code written by Katherine Smith, 2003 GENERAL [score, warped_points] = eval_mi_cps_warp(params, warp_centre, r, ref_points, start_image, ref_image) 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. (MSD) -warped_points: The position of points after warping. PENDING WORK - KNOWN BUG/S -None. COMMENT/S - RELATED FUNCTION/S EVAL_MI_CPS_WARP ABOUT -Created: November 23rd, 2003 -Last update: Novermber 27th, 2003 -Revision: 0.0.2 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function [score, warped_points] = eval_mi_cps_warp(params, warp_centre, r, ref_points, start_image, ref_image, number_of_bins) 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-differences) 0005 % 0006 % Code written by Katherine Smith, 2003 0007 % 0008 % GENERAL 0009 % 0010 % [score, warped_points] = eval_mi_cps_warp(params, warp_centre, 0011 % r, ref_points, start_image, ref_image) 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 % (MSD) 0042 % 0043 % -warped_points: 0044 % The position of points after warping. 0045 % 0046 % 0047 % PENDING WORK 0048 % 0049 % - 0050 % 0051 % KNOWN BUG/S 0052 % 0053 % -None. 0054 % 0055 % COMMENT/S 0056 % 0057 % - 0058 % 0059 % RELATED FUNCTION/S 0060 % 0061 % EVAL_MI_CPS_WARP 0062 % 0063 % ABOUT 0064 % 0065 % -Created: November 23rd, 2003 0066 % -Last update: Novermber 27th, 2003 0067 % -Revision: 0.0.2 0068 % -Author: R. S. Schestowitz, University of Manchester 0069 % ============================================================== 0070 0071 d = params; 0072 % copy parameters 0073 start_points = ref_points; 0074 max_d = 0.67; 0075 % maximum parameter value allowed?? 0076 0077 if (any((abs(d) > max_d)) | any(((warp_centre-r <-1) | (warp_centre+r > 1)))) 0078 0079 % ensure for all paramters p,-0.67<p<0.67 and also 0080 % warp center and radius are not out of normalisation 0081 % range 1. All must be in bounds 0082 0083 score = realmax; 0084 % if data is invalid, set to maximum <Real> value 0085 0086 else 0087 % if inputs okay 0088 for i=1:size(params,2) 0089 % for all parameters 0090 warped_points = cps_warp_1d(start_points,warp_centre(i),r(i),d(i)); 0091 % apply warp 0092 start_points = warped_points; 0093 % proceed with warped point to next iteration 0094 end 0095 warped_image = interp1(ref_points,start_image,warped_points, 'linear',0); 0096 % record warped image 0097 score = mi(ref_image, warped_image, number_of_bins); 0098 % score according to msd 0099 end