function rimat=th_w2d(wr,wc,ss,v,m)


[sca,n,nn]=size(wr);
nf=normf2d(sca);

for i=1:sca
   wrt=reshape(wr(i,:,:),n,n);
   mask=(abs(wrt)>3.1*v*nf(i));
   iwr(i,:,:)=wrt.*mask;
   
   wct=reshape(wc(i,:,:),n,n);
   mask=(abs(wct)>3.1*v*nf(i));
   iwc(i,:,:)=wct.*mask;
end

%wrt=reshape(wr(sca,:,:),n,n);
%iwr(sca,:,:)=wrt;
%wct=reshape(wc(sca,:,:),n,n);
%iwc(sca,:,:)=wct;

rimat=iwt2d(iwr,iwc,ss,m);
