Home > Source > Evaluation > eval_nmi_cps_warp.m

eval_nmi_cps_warp

PURPOSE ^

==============================================================

SYNOPSIS ^

function [score, warped_points] = eval_nmi_cps_warp(params, warp_centre, r, ref_points, start_image, ref_image, number_of_bins)

DESCRIPTION ^

 ==============================================================
 EVAL_NMI_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_nmi_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
 ==============================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [score, warped_points] = eval_nmi_cps_warp(params, warp_centre, r, ref_points, start_image, ref_image, number_of_bins)
0002 % ==============================================================
0003 % EVAL_NMI_CPS_WARP: get similarity score between CPS warped image and
0004 %                    reference. (Evaluate the clamped-plate spline warp using
0005 %                    mean-squared-differences)
0006 %
0007 % Code written by Katherine Smith, 2003
0008 %
0009 %    GENERAL
0010 %
0011 %       [score, warped_points] = eval_nmi_cps_warp(params, warp_centre,
0012 %                                r, ref_points, start_image, ref_image)
0013 %
0014 %    INPUT/S
0015 %
0016 %      -params:
0017 %           The paramters of the warps.
0018 %
0019 %           params(1): warp centre
0020 %           params(2): r
0021 %           params(3): d
0022 %
0023 %      -warp centre:
0024 %           Not in parameters already??
0025 %
0026 %      -r:
0027 %           Not in parameters already??
0028 %
0029 %      -start_points_vec:
0030 %           Points before CPS warp.
0031 %
0032 %      -start_image_vec:
0033 %           Image before CPS warp.
0034 %
0035 %      -ref_image_vec:
0036 %           The reference image to be compared to.
0037 %
0038 %    OUTPUT/S
0039 %
0040 %      -score:
0041 %           The similarity score w.r.t. the reference image.
0042 %           (MSD)
0043 %
0044 %      -warped_points:
0045 %           The position of points after warping.
0046 %
0047 %
0048 %    PENDING WORK
0049 %
0050 %      -
0051 %
0052 %    KNOWN BUG/S
0053 %
0054 %      -None.
0055 %
0056 %    COMMENT/S
0057 %
0058 %      -
0059 %
0060 %    RELATED FUNCTION/S
0061 %
0062 %      EVAL_MI_CPS_WARP
0063 %
0064 %    ABOUT
0065 %
0066 %      -Created:     November 23rd, 2003
0067 %      -Last update: Novermber 27th, 2003
0068 %      -Revision:    0.0.2
0069 %      -Author:      R. S. Schestowitz, University of Manchester
0070 % ==============================================================
0071 
0072 d = params; 
0073       % copy parameters
0074 start_points = ref_points;
0075 max_d = 0.67; 
0076       % maximum parameter value allowed??
0077 
0078 if (any((abs(d) > max_d)) | any(((warp_centre-r <-1) | (warp_centre+r > 1)))) 
0079 
0080       % ensure for all paramters p,-0.67<p<0.67 and also
0081       % warp center and radius are not out of normalisation
0082       % range 1. All must be in bounds
0083 
0084 score = realmax; 
0085       % if data is invalid, set to maximum <Real> value
0086 
0087 else 
0088       % if inputs okay
0089   for i=1:size(params,2) 
0090       % for all parameters
0091     warped_points = cps_warp_1d(start_points,warp_centre(i),r(i),d(i));
0092       % apply warp
0093     start_points = warped_points;
0094       % proceed with warped point to next iteration
0095   end
0096   warped_image = interp1(ref_points,start_image,warped_points, 'linear',0);
0097       % record warped image
0098   score = nmi(ref_image, warped_image, number_of_bins); 
0099       % score according to msd
0100 end

Generated on Thu 13-May-2004 18:00:46 by m2html © 2003