function [score, warped_points] = eval_groupwise_multi_point(knot_displacements, init_knots, unwarped_image_vec, unwarped_points_vec, image_set, points_set, n_modes, start_points_vec, warp_params, model_evaluation_method, weighting_normalisation_method, shape_weight, variation_kept, pdf_evaluation_method, kernel)
% OPTIMISE_GROUPWISE: Uses PDF's to minimise group-wise complexity
%
%    GENERAL
%
%      function [score, warped_points] = 
%       eval_groupwise_multi_point(knot_displacements, init_knots,
%       unwarped_image_vec, unwarped_points_vec, image_set, points_set,
%       n_modes, start_points_vec, warp_params, model_evaluation_method,
%       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
% ==============================================================

% scale it all down to try and get it to move more!
% init_knots = init_knots*0.01;
% start_points_vec = start_points_vec*0.01;

warped_points = nrr_trans_1d(start_points_vec, init_knots, init_knots + knot_displacements, warp_params, []);
warped_image = interp1(unwarped_points_vec,unwarped_image_vec,warped_points, 'linear',0);
image_set(:,size(image_set,2)+1) = warped_image;
points_set(:,size(points_set,2)+1) = warped_points;

groupwise_pdf = compute_pdf(image_set, points_set, kernel, shape_weight);
score = measure_pdf(groupwise_pdf, pdf_evaluation_method, warped_image);

% score = 0; % to be modified w.r.t. eval_groupwise_single_point