function wcshow(wc,s)

levels = length( s(:,1))-2

% create an empty matrix of the same size as the image.
wcMat = zeros(s(levels+2,1),s(levels+2,2));

A0 = wc;
for(j=levels+1:-1:2)
  n = s(j,1)*s(j,2)
  lA0 = length(A0);
  D=reshape( A0(lA0-n+1:lA0),s(j,1) ,s(j,2) ) ;
  V=reshape( A0(lA0-2*n+1:lA0-n ),s(j,1) ,s(j,2) );
  H=reshape( A0(lA0-3*n+1:lA0-2*n ),s(j,1) ,s(j,2) );
  A=reshape( A0(lA0-4*n+1:lA0-3*n ),s(j,1) ,s(j,2));
  A0 = A(1:n);
  mxA = max(max(A));
  mxH = max(max(H));
  mxV = max(max(V));
  mxD = max(max(D));
  g=size([A, H;V,D]);
  wcMat(1:g(1),1:g(2)) = [A/mxA, H/mxH;V/mxV,D/mxD];
end

figure(1)
imshow(wcMat)
