% Roy test2

path(path,'/home/S00/schestr0/');
path(path,'/home/S00/schestr0/NRR_Smith');

% Save JPEGs under:
% /home/S00/schestr0/public_html/

% Test: control points in make_1d_images

figure(1);
hold on;
title('Initial control points');
unwarped_points = (1:50)';
plot(unwarped_points);
hold off;

% Test: is_invalid

is_invalid(unwarped_points); % gives flase
unwarped_points(10)=11;
is_invalid(unwarped_points); % gives true

% Test: setup_grid

[a,bump_images,image_control_points,d,e]=make_1d_images(1,50,0.1);

[grid, steps] = setup_grid(50, bump_images, image_control_points, 'overlap_grid', 20);

figure(2);
hold on;
title('Overlap Grid - grid');
plot(grid);
hold off;

figure(3);
hold on;
title('Overlap Grid - steps');
plot(steps);
hold off;

[grid, steps] = setup_grid(50, bump_images, image_control_points, 'grid', 20);

figure(4);
hold on;
title('Grid placement - grid');
plot(grid);
hold off;

figure(5);
hold on;
title('Grid placement - steps');
plot(steps);
hold off;

[grid, steps] = setup_grid(50, bump_images, image_control_points, 'random', 20);

figure(6);
hold on;
title('Random placement - grid');
plot(grid);
hold off;

figure(7);
hold on;
title('Random placement - steps');
plot(steps);
hold off;

[grid, steps] = setup_grid(50, bump_images, image_control_points, 'random_and_scale', 20);

figure(8);
hold on;
title('Random and Scale placement - grid');
plot(grid);
hold off;

figure(9);
hold on;
title('Random and Scale placement - steps');
plot(steps);
hold off;

[grid, steps] = setup_grid(50, bump_images, image_control_points, 'edge', 20);

figure(10);
hold on;
title('Edge placement - grid');
plot(grid);
hold off;

figure(11);
hold on;
title('Edge placement - steps');
plot(steps);
hold off;

[grid, steps] = setup_grid(50, bump_images, image_control_points, 'edge_and_scale', 20);

figure(12);
hold on;
title('Edge and Scale placement - grid');
plot(grid);
hold off;

figure(13);
hold on;
title('Edge and Scale placement - steps');
plot(steps);
hold off;


% Test: normalise_to_bounds

figure(14);
hold on;
title('Original bump and normalised bump (0.1 to 0.3)');
plot(bump_images);
normalised_bump = normalise_to_bounds(bump_images, 0.1, 0.3);
plot(normalised_bump,'R');
hold off;
