function [imagelist, images, points] = make_1d_bump(n_images, image_width, image_height, position, width, height, width_variation, height_variation)
% MAKE_1D_MODEL: Genrates examples of 2-D images.
%
%    GENERAL
%
%      [imagelist, images, points] = make_1d_images(n_images, image_width, image_height)
%
%    INPUT/S
%
%      -n_images:
%           The number of images to generate.
%
%      -image_width:
%           The width of the 2-D images to be created.
%
%      -image_height:
%           The width of the 2-D images to be created.
%
%       -position:
%           The position of the structure
%
%       -width:
%           The width of the structure
%
%       -height:
%           The height of the structure
%
%       -width_variation:
%           The variation in width of the structure
%
%       -height_variation:
%           The variation in height of the structure
%
%           
%    OUTPUT/S
%
%      -imagelist:
%           The list of the images generated.
%
%      -images:
%           The images generated.
%
%      -points:
%           The (control) points of the images genearted.
%
%    PENDING WORK
%
%
%    KNOWN BUG/S
%
%      -
%
%    COMMENT/S
%
%
%    RELATED FUNCTION/S
%
%      MAKE_1D_IMAGES, MAKE_1D_BUMP
%
%    ABOUT
%
%      -Created:     January 5th, 2003
%      -Last update: January 5th, 2003
%      -Revision:    0.0.1
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================


bump_width = width;
bump_width_variation = width_variation;

bump_height = height;
bump_height_variation = height_variation;

bump_position_freedom = position;

initial_diminish_factor = 2;
diminish_factor = 1.05 + (0.1 * rand * bump_width);
          % initialialise the parameters intenrnally for fine-tuning capabilities

          %%%%%%%%%% CHANGE BELOW CONTROL POINTS %%%%%%%%%%%%%
          
unwarped_points = (1:image_width)'; 
          % get original unwarped points from the input -- diagonal line
          
images = zeros([image_height image_width n_images]); 
          % set a bunch of black images of appropriate size,
          % the equivalent of making flat asymptotic curves
          
points = unwarped_points(:,ones(n_images,1));
          % duplicate points to fit number of images 

for i=1:n_images,
          % for all images
 
  width_x = bump_width + rand * bump_width_variation;
  width_y = bump_width + rand * bump_width_variation;
  height = bump_height + bump_height_variation * rand;
  position_x = bump_position_freedom  * rand;
  position_y = (bump_position_freedom - width_y) * rand;
          % set attributes of the bump using some randomisation
  increment = height / initial_diminish_factor;
  current_height = height;
        % set the current height    
  for k = 1:image_height,
    if (k < (image_height/2))
       current_height = height * (k / image_height);
    else
       current_height = height * ((image_height - k) / image_height);
    end
    current_width = width_x;
%     if (k < (image_height/2))
%        current_width = width_x * (k / image_height)
%     else
%        current_width = width_x * ((image_height - k) / image_height)
%     end
    increment = current_height / initial_diminish_factor;
    for j = floor(position_x * image_width):1:floor((position_x + (current_width / 2)) * image_width),
      images(k, j, i) = images(k, j-1, i) + increment;
      % images(j+1,i) = images(j-1,i) + increment;
      increment = increment / diminish_factor;
      % images(floor((position+width)*image_width)-j,i) = images(j,i);
    end
  
    count=1;
    for j = floor(position_x * image_width):1:floor((position_x + (current_width / 2)) * image_width),
      images(k,floor((position_x + current_width) * image_width) - count,i) = images(k,j,i);
      count = count + 1;
    end
  end  

%  images(:,i) = normalise_to_bounds(images(:,i),0,height);

  filename = ['1dim' num2str(i) '.png']; 
          % set name of file
  % imwrite(images(i,:), filename, 'png'); 
          % write file
  imagelist{i} = filename;
          % save in list of images
  % figure, plot(image);
end