function rima=iwt2d(wwr,wwc,ss,m)

%%%backward dyadic wavelet transform%%%%%%
%wwr--------row part
%wwc--------column part
%ss---------smoothed image
%m----------extended point number

%rima-----reconstructed image

[J,n,nn]=size(wwr);

j=J;
while j>0
   twwr=reshape(wwr(j,:,:),n,n);
   twwr=conv2(twwr,getk(j-1));
   twwr=twwr(:,128:128+n-1);
   twwr=conv2(twwr,getl(j-1)');
   twwr=twwr(128:128+n-1,:);

   twwc=reshape(wwc(j,:,:),n,n);
   twwc=conv2(twwc,getl(j-1));
   twwc=twwc(:,128:128+n-1);
   twwc=conv2(twwc,getk(j-1)');
   twwc=twwc(128:128+n-1,:);

   ss=conv2(ss,getnh(j-1));
   ss=ss(:,128:128+n-1);
   ss=conv2(ss,getnh(j-1)');
   ss=ss(128:128+n-1,:)+twwr+twwc;
   
   j=j-1;
   
end

rima=ss(m+1:n-m,m+1:n-m);

