function testice(con)
% TESTICE Tests greedyice function
consz = 50;

%% read image
%im = imread('sauce.png');
%im = imread('bear.png');
im = imread('dale.png');
%im = imread('gromit.png');
%im = imread('cave.png');
%im = imread('box.png');
%im = imread('testimg.png');
%im = imread('skull.png');
%im = imread('salmon_2.png');
%im = imread('usaguy.bmp');
%im = imread('teach.png');
%im = imread('lena.png');
imsz = size(im);

%% create initial circle contour
if nargin < 1
    c = [imsz(1) / 2; imsz(2) / 2];
    r = floor(min(imsz(1), imsz(2)) / 2) - 2;
    con = zeros(consz,2);
    for i = 1:consz
        theta = 2 * pi * i / consz;
        xy = c + r * [cos(theta); sin(theta)];
        con(i,:) = round(xy');
    end
end

%% load initial contour
%con = load('contour1.ctr');
%con = makecontour(im);

%% preprocess image to extract edges
img = im;
img = imedgefilter(img);
%img = img(:,:,1) + img(:,:,2) + img(:,:,3);

%% normalize image
img = normimg(img);

%% filter noise
img = imnoisefilter(img);

displaysnake(im, con);

%% apply algorithm
con = greedyice(con, img, 1.0, 1.0, 1.2);

%% display result
displaysnake(im, con);