Home > Source > Optimise > Others > optimise_wavelet.m

optimise_wavelet

PURPOSE ^

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

SYNOPSIS ^

function [param_list, warped_points, warped_image, score] = optimise_wavelet(ref_image, ref_points, unwarped_image, unwarped_points, spline_type, placement_method, n_points, verbose, do_plot, subplot_fig, pane, column, image_width, number_of_images, verbose_score, model_evaluation_method, n_modes, weighting_normalisation_method, shape_weight, variation_kept, wavelet_evalution_method, filter, filter_level, precision_required)

DESCRIPTION ^

 ==============================================================
 OPTIMISE_WAVELET

    GENERAL

 
    INPUT/S

      -X:
          X
           
    OUTPUT/S

      -X:
           X

    PENDING WORK
      
      

    KNOWN BUG/S

      

    COMMENT/S

      

    RELATED FUNCTION/S

      

    ABOUT

      -Created:     February 9th, 2004
      -Last update: February 2004
      -Revision:    0.1.0
      -Author:      R. S. Schestowitz, University of Manchester
 ==============================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [param_list, warped_points, warped_image, score] = optimise_wavelet(ref_image, ref_points, unwarped_image, unwarped_points, spline_type, placement_method, n_points, verbose, do_plot, subplot_fig, pane, column, image_width, number_of_images, verbose_score, model_evaluation_method, n_modes, weighting_normalisation_method, shape_weight, variation_kept, wavelet_evalution_method, filter, filter_level, precision_required)
0002 % ==============================================================
0003 % OPTIMISE_WAVELET
0004 %
0005 %    GENERAL
0006 %
0007 %
0008 %    INPUT/S
0009 %
0010 %      -X:
0011 %          X
0012 %
0013 %    OUTPUT/S
0014 %
0015 %      -X:
0016 %           X
0017 %
0018 %    PENDING WORK
0019 %
0020 %
0021 %
0022 %    KNOWN BUG/S
0023 %
0024 %
0025 %
0026 %    COMMENT/S
0027 %
0028 %
0029 %
0030 %    RELATED FUNCTION/S
0031 %
0032 %
0033 %
0034 %    ABOUT
0035 %
0036 %      -Created:     February 9th, 2004
0037 %      -Last update: February 2004
0038 %      -Revision:    0.1.0
0039 %      -Author:      R. S. Schestowitz, University of Manchester
0040 % ==============================================================
0041 
0042 [grid, steps] = setup_grid(2, unwarped_image, ref_points, placement_method, n_points);
0043 
0044 if (do_plot),
0045   figure(subplot_fig);
0046   subplot(number_of_images, column ,pane , 'replace');
0047   plot(unwarped_image);
0048   axis([0 image_width 0 1]);
0049   drawnow;
0050 end
0051 
0052 warp_params.green = 'biharmCPS';
0053 param_list = [];
0054 start_image = unwarped_image;
0055 start_points = unwarped_points;
0056 %last_score = msd(ref_image, unwarped_image);
0057 if(strcmp(spline_type,'single_point'))
0058   last_score = eval_wavelet_single_point(zeros(size(grid)),grid, steps, unwarped_image, unwarped_points, ref_image, ref_points, n_modes, start_points, model_evaluation_method, weighting_normalisation_method, shape_weight, variation_kept, wavelet_evalution_method, filter, filter_level);
0059   [params, score] = fminsearch(@eval_wavelet_single_point,zeros(size(grid)),optimset('Display',verbose,'TolX', precision_required),grid,steps,start_image, start_points, ref_image, ref_points, n_modes, start_points, model_evaluation_method, weighting_normalisation_method, shape_weight, variation_kept, wavelet_evalution_method, filter, filter_level);
0060   param_list(size(param_list,1)+1).d = params;
0061   [dummy,start_points] = eval_wavelet_single_point(params,grid,steps, start_image, start_points, ref_image, ref_points, n_modes, start_points, model_evaluation_method, weighting_normalisation_method, shape_weight, variation_kept, wavelet_evalution_method, filter, filter_level);
0062   start_image = interp1(unwarped_points,unwarped_image,start_points, 'linear',0); 
0063 elseif(strcmp(spline_type,'multi_point'))
0064   warped_grid = grid;
0065   warp_params.green = 'biharmCPS';
0066   last_score = eval_wavelet_multi_point(zeros(size(grid)),grid, unwarped_image, unwarped_points, ref_image, ref_points, n_modes, start_points, warp_params, model_evaluation_method, weighting_normalisation_method, shape_weight, variation_kept, wavelet_evalution_method, filter, filter_level);
0067   [params, score] = fminsearch(@eval_wavelet_multi_point,zeros(size(grid)),optimset('Display',verbose,'TolX', precision_required),grid, unwarped_image, unwarped_points, ref_image, ref_points, n_modes, start_points, warp_params, model_evaluation_method, weighting_normalisation_method, shape_weight, variation_kept, wavelet_evalution_method, filter, filter_level);
0068   param_list(size(param_list,1)+1,:).d = params;
0069   warped_grid = grid + params;
0070   start_points = nrr_trans_1d(start_points, grid, warped_grid, warp_params,[]);
0071   start_image = interp1(unwarped_points,unwarped_image,start_points, 'linear',0);
0072 else
0073   error('Unknown spline type');  
0074 end
0075 
0076 
0077 if (verbose_score == 1),
0078     disp(['Initial score: ',num2str(last_score),' Final score: ', num2str(score), ' Difference: ', num2str(last_score - score)]);
0079 end
0080 
0081 warped_points = start_points;
0082 warped_image = start_image;
0083 
0084 
0085 if (do_plot),
0086   figure(subplot_fig);
0087   subplot(number_of_images, column , pane, 'replace');
0088   plot(warped_image);
0089   axis([0 image_width 0 1]);
0090   title(num2str(score));
0091   drawnow;
0092 end

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