function [imagelist, images, points] = make_elliptic_bumps(n_images, image_width, save_bumps, format, base_height, position_freedom, height_variation, width_variation)
% MAKE_ELLIPTIC_BUMPS: Generates examples of elliptic 1-D images.
%
%    ABOUT
%
%      -Created:     April 9th, 2004
%      -Last update: May 19th, 2004
%      -Revision:    0.0.8
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================

unwarped_points = (1:image_width)'; 
          % get original unwarped points from the input -- diagonal line
          
images_temp = zeros([image_width n_images]);          
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 

e = rand;
          % a formulation parameter for the ellipse

for i = 1:n_images,
	x0 = ceil ((rand * position_freedom / 4) * image_width + 2);	
	width_factor = (rand * width_variation + 3) ;	
	height = base_height + rand / 2 * height_variation;	
	width = image_width / width_factor;
	
	for x = - width:1: width,
        images_temp(x + width + 1, i) = e * sqrt(width.^2 - x.^2);
	end
	
	for j = x0:(width * 2 + 1) + x0,
        images(j,i) = images_temp (j - x0 + 1, i);
	end   
	
	images(:,i) = normalise_to_bounds(images(:,i), 0, height);
	
    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
end