recons.m
上传用户:haiyisale
上传日期:2013-01-09
资源大小:3246k
文件大小:3k
源码类别:

波变换

开发平台:

Matlab

  1. function x = recons(t,node,x,sizes,edges)
  2. %RECONS Reconstruct wavelet coefficients.
  3. %   Y = RECONS(T,N,X,S,E) reconstructs the 
  4. %   wavelet packet coefficients X associated with the node N
  5. %   of the wavelet tree T, using sizes S and the edges values E.
  6. %   S contains the size of data associated with
  7. %   each ascendant of N.
  8. %   The children of a node F are numbered from left 
  9. %   to right: [0, ... , ORDER-1].
  10. %   The edge value between F and a child C is the child number.
  11. %
  12. %   This method overloads the DTREE method.
  13. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi  12-Feb-2003.
  14. %   Last Revision: 11-Jul-2003.
  15. %   Copyright 1995-2004 The MathWorks, Inc.
  16. %   $Revision: 1.1.6.2 $ $Date: 2004/03/15 22:38:55 $ 
  17. order = treeord(t);
  18. typeWT = t.WT_Settings.typeWT;
  19. nb_up = length(edges);
  20. switch typeWT
  21.     case {'dwt','wpt'}
  22.         dwtSHIFT = t.WT_Settings.shift;
  23.         dwtEXTM  = t.WT_Settings.extMode;
  24.         Lo_R    = t.WT_Settings.Filters.Lo_R;
  25.         Hi_R    = t.WT_Settings.Filters.Hi_R;
  26.         f = zeros(nb_up,length(Lo_R));
  27.         switch order
  28.             case 2
  29.                 K = find(edges==0);
  30.                 if ~isempty(K) , f(K,:) = Lo_R(ones(size(K)),:); end
  31.                 K = find(edges==1);
  32.                 if ~isempty(K) , f(K,:) = Hi_R(ones(size(K)),:); end
  33.                 for k=1:nb_up
  34.                     s = max(sizes(k,:));
  35.                     x = upsconv1(x,f(k,:),s,dwtEXTM,dwtSHIFT);
  36.                 end
  37.                 
  38.             case 4
  39.                 dwtATTR = struct('extMode',dwtEXTM,'shift1D',dwtSHIFT,'shift2D',dwtSHIFT);
  40.                 g = f;
  41.                 K = find(edges==0);
  42.                 if ~isempty(K)
  43.                     f(K,:) = Lo_R(ones(size(K)),:);
  44.                     g(K,:) = Lo_R(ones(size(K)),:);
  45.                 end
  46.                 K = find(edges==1);
  47.                 if ~isempty(K)
  48.                     f(K,:) = Hi_R(ones(size(K)),:);
  49.                     g(K,:) = Lo_R(ones(size(K)),:);
  50.                 end
  51.                 K = find(edges==2);
  52.                 if ~isempty(K)
  53.                     f(K,:) = Lo_R(ones(size(K)),:);
  54.                     g(K,:) = Hi_R(ones(size(K)),:);
  55.                 end
  56.                 K = find(edges==3);
  57.                 if ~isempty(K)
  58.                     f(K,:) = Hi_R(ones(size(K)),:);
  59.                     g(K,:) = Hi_R(ones(size(K)),:);
  60.                 end
  61.                 for k=1:nb_up
  62.                     s = sizes(k,:);
  63.                     x = upsconv2(x,{f(k,:),g(k,:)},s,dwtATTR);
  64.                 end
  65.         end
  66.             
  67.     case {'lwt','lwpt'}
  68.         typeDEC = typeWT(2:3);
  69.         LS = t.WT_Settings.LS;
  70.         switch order
  71.             case 2 ,
  72.                 
  73.             case 4 ,
  74.                 
  75.         end        
  76. end