function [image_number] = find_image_by_height(images, image_width, number_of_images, type)
% FIND_IMAGE_BY_HEIGHT: Find the image whose peak is highest or lowest
%
%    GENERAL
%
%      [image_number] = find_image_by_height(images, image_width, number_of_images, type)
%
%    INPUT/S
%
%      -images:
%            All the images.
%
%      -image_width:
%            The width of the images.
%
%      -number_of_images:
%            The number of images.
%
%      -type:
%            Allows other (inverse) operations.
%
%    OUTPUT/S
%
%      -image_number:
%           The number of the image whose height attributes are requested.
%
%    PENDING WORK
%
%      -
%
%    KNOWN BUG/S
%
%      -None.
%
%    COMMENT/S
%
%      -
%
%    RELATED FUNCTION/S
%
%      
%
%    ABOUT
%
%      -Created:     May 9th, 2004
%      -Last update: May 2004
%      -Revision:    0.0.1
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================

for current_image_number = 1:number_of_images,
  height_measure(current_image_number) = max(images(:,current_image_number));
    % get peak values
end

% OPTIMISATION NOTE: In the above, very many identical tests are run for
% all images.

if (strcmp(type,'highest')),
  required_height = max (height_measure);
elseif (strcmp(type,'lowest')),
  required_height = min (height_measure);
end

for current_image_number = 1:number_of_images,
  if (height_measure(current_image_number) == required_height),
      image_number = current_image_number;
  end
end
