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

波变换

开发平台:

Matlab

  1. function out1 = wp2ddraw(option,win_wptool,in3)
  2. %WP2DDRAW Wavelet packets 2-D drawing manager.
  3. %   OUT1 = WP2DDRAW(OPTION,WIN_WPTOOL,IN3)
  4. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
  5. %   Last Revision: 16-Jul-1999.
  6. %   Copyright 1995-2002 The MathWorks, Inc.
  7. %   $Revision: 1.15 $
  8. % Image Coding Value.
  9. %-------------------
  10. codemat_v = wimgcode('get');
  11. % Memory Blocks of stored values.
  12. %================================
  13. % MB1 (main window).
  14. %-------------------
  15. n_param_anal   = 'WP2D_Par_Anal';
  16. ind_img_name   = 1;
  17. ind_wav_name   = 2;
  18. ind_lev_anal   = 3;
  19. ind_ent_anal   = 4;
  20. ind_ent_par    = 5;
  21. ind_img_size   = 6;
  22. ind_img_t_name = 7;
  23. ind_act_option = 8;
  24. ind_thr_val    = 9;
  25. nb1_stored     = 9;
  26. % MB2 (main window).
  27. %-------------------
  28. n_wp_utils = 'WP_Utils';
  29. ind_tree_lin  = 1;
  30. ind_tree_txt  = 2;
  31. ind_type_txt  = 3;
  32. ind_sel_nodes = 4;
  33. ind_gra_area  = 5;
  34. ind_nb_colors = 6;
  35. nb2_stored    = 6;
  36. % MB3 (main window).
  37. %-------------------
  38. n_structures = 'Structures';
  39. ind_tree_st  = 1;
  40. ind_data_st  = 2;
  41. nb3_stored   = 2;
  42. % Tag properties.
  43. %----------------
  44. tag_curtree   = 'Pop_CurTree';
  45. tag_nodact    = 'Pop_NodAct';
  46. tag_axe_t_lin = 'Axe_TreeLines';
  47. tag_axe_sig   = 'Axe_Sig';
  48. tag_img_sig   = 'Img_sig';
  49. tag_axe_pack  = 'Axe_Pack';
  50. tag_axe_cfs   = 'Axe_Cfs';
  51. tag_axe_col   = 'Axe_Col';
  52. tag_sli_size  = 'Sli_Size';
  53. tag_sli_pos   = 'Sli_Pos';
  54. % Miscellaneous values.
  55. %----------------------
  56. children    = get(win_wptool,'Children');
  57. axe_handles = findobj(children,'flat','type','axes');
  58. uic_handles = findobj(children,'flat','type','uicontrol');
  59. WP_Axe_Tree = findobj(axe_handles,'flat','Tag',tag_axe_t_lin);
  60. WP_Axe_Sig  = findobj(axe_handles,'flat','Tag',tag_axe_sig);
  61. WP_Axe_Pack = findobj(axe_handles,'flat','Tag',tag_axe_pack);
  62. WP_Axe_Cfs  = findobj(axe_handles,'flat','Tag',tag_axe_cfs);
  63. WP_Axe_Col  = findobj(axe_handles,'flat','Tag',tag_axe_col);
  64. WP_Sli_Size = findobj(uic_handles,'Tag',tag_sli_size);
  65. WP_Sli_Pos  = findobj(uic_handles,'Tag',tag_sli_pos);
  66. switch option
  67.     case 'sig'
  68.         % Img_Anal = in3;
  69.         %----------------
  70.         set([ WP_Axe_Tree,WP_Axe_Cfs,WP_Axe_Sig,WP_Axe_Pack, ...
  71.               WP_Axe_Col,WP_Sli_Size,WP_Sli_Pos],'Visible','on');
  72.         NB_ColorsInPal = wmemtool('rmb',win_wptool, ...
  73.                                         n_wp_utils,ind_nb_colors);
  74.         image(wimgcode('cod',0,in3,NB_ColorsInPal,codemat_v),'tag',tag_img_sig,...
  75.                 'Parent',WP_Axe_Sig);
  76.         set(WP_Axe_Sig,'Tag',tag_axe_sig);
  77.         s = size(in3);
  78.         wtitle(sprintf('Analyzed Image : size = (%.0f, %.0f)',s(1),s(2)),...
  79.                 'Parent',WP_Axe_Sig);
  80.         wtitle('Decomposition Tree','Parent',WP_Axe_Tree);
  81.         wtitle('Node Action Result','Parent',WP_Axe_Pack);
  82.         wtitle('Colored Coefficients for Terminal Nodes','Parent',WP_Axe_Cfs);
  83.         image([0 1],[0 1],[1:NB_ColorsInPal],'Parent',WP_Axe_Col);
  84.         set(WP_Axe_Col,...
  85.                 'XTickLabel',[],'YTickLabel',[],...
  86.                 'XTick',[],'YTick',[],...
  87.                 'Tag',tag_axe_col);
  88.         wsetxlab(WP_Axe_Col,'Scale of Colors from Min to Max');
  89.     case 'anal'
  90.         pop_handles = findobj(uic_handles,'style','popupmenu');
  91.         pop_curtree = findobj(pop_handles,'Tag',tag_curtree);
  92.         pop_nodact  = findobj(pop_handles,'Tag',tag_nodact);
  93.         % Reading structures.
  94.         %--------------------
  95.         [tree_struct,data_struct] = wmemtool('rmb',win_wptool,n_structures,...
  96.                                                 ind_tree_st,ind_data_st);
  97.         if isa(tree_struct,'wptree')
  98.             wptreeop('input_tree',win_wptool,tree_struct);
  99.         else
  100.             wptreeop('input_tree',win_wptool,tree_struct,data_struct);
  101.         end
  102.         depth = treedpth(tree_struct);
  103.         str_depth = int2str([0:depth]');
  104.         set(pop_curtree,'String',str_depth,'Value',depth+1);
  105.         wtitle('Node Action Result','Parent',WP_Axe_Pack);
  106.         wtitle('Colored Coefficients for Terminal Nodes',...
  107.                 'Parent',WP_Axe_Cfs);
  108.         % Setting Dynamic Visualization tool.
  109.         %------------------------------------
  110.         dynvtool('init',win_wptool,...
  111.                 [WP_Axe_Pack],[WP_Axe_Sig],[WP_Axe_Cfs],[0 0],'','',...
  112.                                                         'wp2dcoor',WP_Axe_Cfs);
  113.         wptreeop('nodact',win_wptool,pop_nodact);
  114.     case 'r_orig'
  115.         out1 = findobj(WP_Axe_Sig,'type','image','tag',tag_img_sig);
  116.     otherwise
  117.         errargt(mfilename,'Unknown Option','msg');
  118.         error('*');
  119. end