function image_diffuse_test ( )

%*****************************************************************************80
%
%% image_diffuse_test() tests image_diffuse().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 February 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../image_diffuse' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'image_diffuse_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test image_diffuse().\n' );

  image_diffuse4_test ( );
  image_diffuse8_test ( );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'image_diffuse_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../image_diffuse' );

  return
end
function image_diffuse4_test ( )

%*****************************************************************************80
%
%% image_diffuse4_test() tests image_diffuse4().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 June 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'image_diffuse4_test():\n' );
  fprintf ( 1, '  image_diffuse4() uses 4 neighbors for diffusion.\n' );

  gray = imread ( 'fool.png' );
  c = 0.05;
  k = 20;
  gray_new = image_diffuse4 ( gray, c, k );
  filename = 'fool_c0.05_k20_n4.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( );
  imshow ( gray_new );

  gray = imread ( 'fool.png' );
  c = 0.50;
  k = 1;
  gray_new = image_diffuse4 ( gray, c, k );
  filename = 'fool_c0.50_k01_n4.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( );
  imshow ( gray_new );

  gray = imread ( 'fool.png' );
  c = 0.50;
  k = 20;
  gray_new = image_diffuse4 ( gray, c, k );
  filename = 'fool_c0.50_k20_n4.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( );
  imshow ( gray_new );

  gray = imread ( 'fool.png' );
  c = 1.00;
  k = 1;
  gray_new = image_diffuse4 ( gray, c, k );
  filename = 'fool_c1.00_k01_n4.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( );
  imshow ( gray_new );

  return
end
function image_diffuse8_test ( )

%*****************************************************************************80
%
%% image_diffuse8_test() tests image_diffuse8().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 June 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'image_diffuse8_test():\n' );
  fprintf ( 1, '  image_diffuse8() uses 8 neighbors for diffusion.\n' );

  gray = imread ( 'fool.png' );
  c = 0.05;
  k = 20;
  gray_new = image_diffuse8 ( gray, c, k );
  filename = 'fool_c0.05_k20_n8.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( );
  imshow ( gray_new );

  gray = imread ( 'fool.png' );
  c = 0.50;
  k = 1;
  gray_new = image_diffuse8 ( gray, c, k );
  filename = 'fool_c0.50_k01_n8.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( );
  imshow ( gray_new );

  gray = imread ( 'fool.png' );
  c = 0.50;
  k = 20;
  gray_new = image_diffuse8 ( gray, c, k );
  filename = 'fool_c0.50_k20_n8.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( );
  imshow ( gray_new );

  gray = imread ( 'fool.png' );
  c = 1.00;
  k = 1;
  gray_new = image_diffuse8 ( gray, c, k );
  filename = 'fool_c1.00_k01_n8.png';
  imwrite ( gray_new, filename, 'png' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  figure ( );
  imshow ( gray_new );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

