Home > Source > Optimise > Others > optimise_groupwise.m

optimise_groupwise

PURPOSE ^

OPTIMISE_GROUPWISE: Uses PDF's to minimise group-wise complexity

SYNOPSIS ^

function [param_list, warped_points, warped_image, score] = optimise_groupwise(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, pdf_evalution_method, kernel, precision_required)

DESCRIPTION ^

 OPTIMISE_GROUPWISE: Uses PDF's to minimise group-wise complexity

    GENERAL

      [param_list, warped_points, warped_image, score] = 
       optimise_groupwise(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)

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

Generated on Fri 14-May-2004 10:05:30 by m2html © 2003