function score = measure_model_msd(warped_images)
% MEASURE_MODEL_MSD: Measure the reference against a set of images using
%                    mean-squared-differences and return mean.
%
% Code written by Katherine Smith, 2003
%
%    GENERAL
%
%      score = measure_model_msd(warped_images)
%
%    INPUT/S
%
%      -warped_images:
%           A set of images (similar to the model).
%           
%    OUTPUT/S
%
%      -score:
%           Mean-squared difference score.
%
%    PENDING WORK
%
%      -
%
%    KNOWN BUG/S
%
%      -None.
%
%    COMMENT/S
%
%      -The name is misleading because models are not involved. Consider
%      renaming.
%
%    RELATED FUNCTION/S
%
%      MSD, EVAL_MSD
%
%    ABOUT
%
%      -Created:     November 23rd, 2003
%      -Last update: February 18th, 2004
%      -Revision:    0.0.9
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================

n_images = size(warped_images,2); 
          % get number of images
ref_image = warped_images(:,1);
          % set reference image
for i=1:n_images
  score(i) = msd(ref_image, warped_images(:,i)); 
          % record the squared mean difference of all images against the reference
end
score = mean(score); 
          % get the mean score