% Test my algorithme á trous on a delta function
% CCK 2018-Feb-28

N = 64
image = zeros(N,N);
image(N/2,N/2) = 1;

figure(1)
hold off
imagesc(image)
colormap(gray)
axis equal
title('Test image')

W = atrous(image, 8);

% Plot a cut through the response to the delta function
figure(2)
hold off
for j=1:9
   plot(W(:,N/2,j))
   hold on
end
title('Cut through W for a delta function')


% Look at each layer, renormalized to unit peak intensity
B = W;
for j=1:9
   B(:,:,j) = W(:,:,j)/max(max(W(:,:,j)));
end

% Plot a cut through the response to the delta function
figure(3)
hold off
for j=1:9
   plot(B(:,N/2,j))
   hold on
end
title('Basis elements renormalized to unit maximum')

figure(4)
hold off
imagesc( [B(:,:,1), B(:,:,2), B(:,:,3); B(:,:,4), B(:,:,5), B(:,:,6); B(:,:,7), B(:,:,8), B(:,:,9) ] )
colormap(gray)
axis equal
title('Layers of the Wavelet Transform')
