function [imagelist, images, points] = make_1d_bump(n_images, image_width, bump_width, bump_width_variation, bump_height, bump_height_variation, bump_position_freedom, initial_diminish_factor, smoothness_factor, save_bumps, format)
% MAKE_1D_BUMP: Genrates examples of 1-D images.
%
%    GENERAL
%
%      [imagelist,images,points, his, los] = 
%         make_1d_bump(n_images, image_width, white_width)
%
%    INPUT/S
%
%      -n_images:
%           The number of images to generate.
%
%      -image_width:
%           The width of the 1-D images to be created.
%           
%    OUTPUT/S
%
%      -imagelist:
%           The list of the images generated.
%
%      -images:
%           The images generated.
%
%      -points:
%           The (control) points of the images genearted.
%
%    PENDING WORK
%
%      -Get this function to work properly
%
%    KNOWN BUG/S
%
%      -
%
%    COMMENT/S
%
%      -This function does not deliver parameters such as
%       high and low, but these remain of use only in a
%       very limited way in BUILD_1D_MODEL
%
%    RELATED FUNCTION/S
%
%      MAKE_1D_IMAGES, BUILD_1D_MODEL
%
%    ABOUT
%
%      -Created:     December 23rd, 2003
%      -Last update: January 29th, 2004
%      -Revision:    0.3.7
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================

diminish_factor = 1 +  smoothness_factor / image_width;  % + (0.1 * rand * bump_width);
          % initialialise the parameters intenrnally for fine-tuning capabilities
          
unwarped_points = (1:image_width)'; 
          % get original unwarped points from the input -- diagonal line
          
images = zeros([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 = bump_width + rand * bump_width_variation;
  height = bump_height + bump_height_variation * rand;
  position = (bump_position_freedom - width) * rand;
          % set attributes of the bump using some randomisation
  increment = height / initial_diminish_factor;
        % set the current height
  for j = ceil((position * image_width) + 1):floor((position + (width / 2)) * image_width),
    images(j,i) = images(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 = ceil((position * image_width) + 1):floor((position + (width / 2)) * image_width),
    images(floor((position + width) * image_width) - count - 1,i) = images(j,i);
    count = count + 1;
  end
  
  images(:,i) = normalise_to_bounds(images(:,i),0,height);
  
%   for j = floor((position+(width/2)) * image_width)+1:1:floor((position+width) * image_width),
%     images(j,i) = images(j-1,i) + increment;
%     % images(j+1,i) = images(j-1,i) + increment;
%     increment = increment/1.2;
%     %images(floor((position+width)*image_width)-j,i) = images(j,i);
%   end 
   
 
  
%   increment=height/2;
%         % set the current height
%   for j = floor(position*image_width):1:floor((position+(width/2)) * image_width),
%     increment = increment/1.2;
%     images(floor((position+width)*image_width)-j,i) = images(j,i);
%   end 
  
  

%   increment=height/2;
%         % reset incremental height
%   for j = floor((position+width)*image_width):-1:floor((position+(width/2+1)) * image_width),
%     % decrement here, i.e. step backwar
%     images(j,i) = images(j-1,i) + increment;
%     increment = increment/1.2;
%   end

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