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

波变换

开发平台:

Matlab

  1. function varargout = wp1dtool(option,varargin)
  2. %WP1DTOOL Wavelet packets 1-D tool.
  3. %   VARARGOUT = WP1DTOOL(OPTION,VARARGIN)
  4. %
  5. %   OPTION = 'create' , 'close' , 'read' , 'show'
  6. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
  7. %   Last Revision: 27-Jun-2001.
  8. %   Copyright 1995-2002 The MathWorks, Inc.
  9. %   $Revision: 1.20 $ $Date: 2002/06/17 12:18:51 $
  10. % Test inputs.
  11. %-------------
  12. if nargin==0 , option = 'create'; end
  13. [option,winAttrb] = utguidiv('ini',option,varargin{:});
  14. % Default values.
  15. %----------------
  16. max_lev_anal = 12;
  17. default_nbcolors = 128;
  18. % Memory Blocks of stored values.
  19. %================================
  20. % MB0.
  21. %-----
  22. n_InfoInit   = 'WP1D_InfoInit';
  23. ind_filename = 1;
  24. ind_pathname = 2;
  25. nb0_stored   = 2;
  26. % MB1.
  27. %-----
  28. n_param_anal   = 'WP1D_Par_Anal';
  29. ind_sig_name   = 1;
  30. ind_wav_name   = 2;
  31. ind_lev_anal   = 3;
  32. ind_ent_anal   = 4;
  33. ind_ent_par    = 5;
  34. ind_sig_size   = 6;
  35. ind_act_option = 7;
  36. ind_thr_val    = 8;
  37. nb1_stored     = 8;
  38. % MB2.
  39. %-----
  40. n_wp_utils = 'WP_Utils';
  41. ind_tree_lin  = 1;
  42. ind_tree_txt  = 2;
  43. ind_type_txt  = 3;
  44. ind_sel_nodes = 4;
  45. ind_gra_area  = 5;
  46. ind_nb_colors = 6;
  47. nb2_stored    = 6;
  48. % MB3.
  49. %-----
  50. n_structures = 'Structures';
  51. ind_tree_st  = 1;
  52. ind_data_st  = 2;
  53. nb3_stored   = 2;
  54. % MB4.
  55. %-----
  56. n_sav_struct    = 'Sav_Struct';
  57. ind_sav_tree_st = 1;
  58. ind_sav_data_st = 2;
  59. nb4_stored      = 2;
  60. % Tag property of objects.
  61. %-------------------------
  62. tag_m_savesyn = 'Save_Syn';
  63. tag_m_savedec = 'Save_Dec';
  64. tag_pus_anal  = 'Pus_Anal';
  65. tag_pus_deno  = 'Pus_Deno';
  66. tag_pus_comp  = 'Pus_Comp';
  67. tag_pus_btree = 'Pus_Btree';
  68. tag_pus_blev  = 'Pus_Blev';
  69. tag_inittree  = 'Pus_InitTree';
  70. tag_wavtree   = 'Pus_WavTree';
  71. tag_curtree   = 'Pop_CurTree';
  72. tag_nodlab    = 'Pop_NodLab';
  73. tag_nodact    = 'Pop_NodAct';
  74. tag_nodsel    = 'Pus_NodSel';
  75. tag_txt_full  = 'Txt_Full';
  76. tag_pus_full  = ['Pus_Full.1';'Pus_Full.2';'Pus_Full.3';'Pus_Full.4'];
  77. tag_txt_colm  = 'Txt_ColM';
  78. tag_pop_colm  = 'Txt_PopM';
  79. tag_axe_t_lin = 'Axe_TreeLines';
  80. tag_axe_sig   = 'Axe_Sig';
  81. tag_axe_pack  = 'Axe_Pack';
  82. tag_axe_cfs   = 'Axe_Cfs';
  83. tag_axe_col   = 'Axe_Col';
  84. tag_sli_size  = 'Sli_Size';
  85. tag_sli_pos   = 'Sli_Pos';
  86. switch option
  87.     case 'create'
  88.         % Get Globals.
  89.         %-------------
  90.         [Def_Txt_Height,Def_Btn_Height,Def_Btn_Width, ...
  91.          X_Spacing,Y_Spacing,Def_FraBkColor] = ...
  92.             mextglob('get',...
  93.               'Def_Txt_Height','Def_Btn_Height','Def_Btn_Width',   ...
  94.               'X_Spacing','Y_Spacing','Def_FraBkColor');
  95.         % Wavelet Packets 1-D window initialization.
  96.         %-------------------------------------------
  97.         [win_wptool,pos_win,win_units,str_numwin,...
  98.                 frame0,pos_frame0,Pos_Graphic_Area,pus_close] = ...
  99.                     wfigmngr('create','Wavelet Packets 1-D',...
  100.                                         winAttrb,'ExtFig_Tool',mfilename,1,1,0);
  101.         set(win_wptool,'tag',mfilename);
  102.         if nargout>0 , varargout{1} = win_wptool; end
  103. % Add Help for Tool.
  104. %------------------
  105. wfighelp('addHelpTool',win_wptool,'&One-Dimensional Analysis','WP1D_GUI');
  106. % Add Help Item.
  107. %----------------
  108. wfighelp('addHelpItem',win_wptool,'Wavelet Packets','WP_PACKETS');
  109. wfighelp('addHelpItem',win_wptool,'Tool Features','WP_TOOLS');
  110. wfighelp('addHelpItem',win_wptool,'Loading and Saving','WP_LOADSAVE');
  111.         % Menu construction for current figure.
  112.         %--------------------------------------
  113. [m_files,m_load,m_save] = ...
  114. wfigmngr('getmenus',win_wptool,'file','load','save');
  115.         m_loadsig = uimenu(m_load,...
  116.                            'Label','&Signal ', ...
  117.                            'Position',1,           ...
  118.                            'Callback',             ...
  119.                            ['wp1dmngr(''load_sig'',' str_numwin ');'] ...
  120.                            );
  121.         m_loaddec = uimenu(m_load,...
  122.                            'Label','&Decomposition ', ...
  123.                            'Position',2,              ...
  124.                            'Callback',                ...
  125.                            ['wp1dmngr(''load_dec'',' str_numwin ');'] ...
  126.                            );
  127.         m_savesyn = uimenu(m_save,...
  128.                            'Label','&Synthesized Signal ',...
  129.                            'Position',1,        ...
  130.                            'Enable','Off',      ...
  131.                            'Tag',tag_m_savesyn, ...
  132.                            'Callback',          ...
  133.                            ['wp1dmngr(''save_synt'',' str_numwin ');'] ...
  134.                            );
  135.         m_savedec = uimenu(m_save,...
  136.                            'Label','&Decomposition ', ...
  137.                            'Position',2,         ...
  138.                            'Enable','Off',       ...
  139.                            'Tag',tag_m_savedec,  ...
  140.                            'Callback',           ...
  141.                            ['wp1dmngr(''save_dec'',' str_numwin ');'] ...
  142.                            );
  143.         m_loadtst = uimenu(m_files,...
  144.                            'Label','&Example Analysis ', ...
  145.                            'Position',3,             ...
  146.                            'Separator','Off'         ...
  147.                            );
  148.         % Submenu of test signals.
  149.         %-------------------------
  150.         beg_call_str = ['wp1dmngr(''demo'',' str_numwin];
  151.         lab             = ['db1  - depth : 2 - ent : shannon ---> sumsin '];
  152.         end_call_str    = [',''sumsin'',''db1'',2,''shannon'');'];
  153.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  154.         lab             = ['haar - depth : 3 - ent : shannon ---> freqbrk '];
  155.         end_call_str    = [',''freqbrk'',''haar'',3,''shannon'');'];
  156.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  157.         lab             = ['haar - depth : 4 - ent : shannon ---> mfrqbrk '];
  158.         end_call_str    = [',''mfrqbrk'',''haar'',4,''shannon'');'];
  159.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  160.         lab             = ['haar - depth : 3 - ent : threshold (0.2) ---> freqbrk '];
  161.         end_call_str    = [',''freqbrk'',''haar'',3,''threshold'',0.2);'];
  162.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  163.         lab             = ['haar - depth : 3 - ent : shannon ---> vonkoch '];
  164.         end_call_str    = [',''vonkoch'',''haar'',3,''shannon'');'];
  165.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  166.         lab             = ['db1  - depth : 7 - ent : shannon ---> sinper8 '];
  167.         end_call_str    = [',''sinper8'',''db1'',7,''shannon'');'];
  168.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  169.         lab             = ['db1  - depth : 3 - ent : shannon ---> qdchirp '];
  170.         end_call_str    = [',''qdchirp'',''db1'',3,''shannon'');'];
  171.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  172.         lab             = ['db1  - depth : 3 - ent : shannon ---> mishmash '];
  173.         end_call_str    = [',''mishmash'',''db1'',3,''shannon'');'];
  174.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  175.         lab             = ['haar - depth : 3 - ent : threshold (0.2) ---> noisbloc '];
  176.         end_call_str    = [',''noisbloc'',''haar'',3,''threshold'',0.2);'];
  177.         uimenu(m_loadtst,'Separator','on',...
  178.                         'Label',lab,'Callback',[beg_call_str end_call_str]);
  179.         lab             = ['haar - depth : 2 - ent : threshold (0.2) ---> noisbump '];
  180.         end_call_str    = [',''noisbump'',''haar'',2,''threshold'',0.2);'];
  181.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  182.         lab             = ['haar - depth : 2 - ent : threshold (0.2) ---> heavysin '];
  183.         end_call_str    = [',''heavysin'',''haar'',2,''threshold'',0.2);'];
  184.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  185.         lab             = ['haar - depth : 2 - ent : threshold (0.2) ---> noisdopp '];
  186.         end_call_str    = [',''noisdopp'',''haar'',2,''threshold'',0.2);'];
  187.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  188.         lab             = ['haar - depth : 2 - ent : threshold (0.2) ---> noischir '];
  189.         end_call_str    = [',''noischir'',''haar'',2,''threshold'',0.2);'];
  190.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  191.         lab             = ['haar - depth : 2 - ent : threshold (0.2) ---> noismima '];
  192.         end_call_str    = [',''noismima'',''haar'',2,''threshold'',0.2);'];
  193.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  194.         lab             = ['db2  - depth : 4 - ent : threshold (4) ---> linchirp '];
  195.         end_call_str    = [',''linchirp'',''db2'',4,''threshold'',4);'];
  196.         uimenu(m_loadtst,'Separator','on',...
  197.                         'Label',lab,'Callback',[beg_call_str end_call_str]);
  198.         lab             = ['db3  - depth : 4 - ent : threshold (4) ---> quachirp '];
  199.         end_call_str    = [',''quachirp'',''db3'',4,''threshold'',4);'];
  200.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  201.         lab             = ['sym3 - depth : 4 - ent : threshold (4) ---> sumlichr '];
  202.         end_call_str    = [',''sumlichr'',''sym3'',4,''threshold'',4);'];
  203.         uimenu(m_loadtst,'Label',lab,'Callback',[beg_call_str end_call_str]);
  204.         % Begin waiting.
  205.         %---------------
  206.         wwaiting('msg',win_wptool,'Wait ... initialization');
  207.         % General graphical parameters initialization.
  208.         %--------------------------------------------
  209.         dx = X_Spacing;  dx2 = 2*dx;
  210.         dy = Y_Spacing;  dy2 = 2*dy;
  211.         d_txt = (Def_Btn_Height-Def_Txt_Height);
  212.         x_frame0   = pos_frame0(1);
  213.         cmd_width  = pos_frame0(3);
  214.         push_width = (cmd_width-3*dx2)/2;
  215.         % Position property of objects.
  216.         %------------------------------
  217.         xlocINI    = [x_frame0 cmd_width];
  218.         ybottomINI = pos_win(4)-3.5*Def_Btn_Height-dy2;
  219.         ybottomENT = ybottomINI-(Def_Btn_Height+dy2)-dy;
  220.         bdx      = (cmd_width-1.5*Def_Btn_Width)/2;
  221.         x_left   = x_frame0+bdx;
  222.         y_low    = ybottomENT-2*(Def_Btn_Height+2*dy2);
  223.         pos_anal = [x_left, y_low, 1.5*Def_Btn_Width, 1.5*Def_Btn_Height];
  224.         x_left   = x_frame0+dx2;
  225.         y_low    = y_low-1.5*Def_Btn_Height-2*dy2;
  226.         pos_comp = [x_left, y_low, push_width , 1.5*Def_Btn_Height];
  227.         pos_deno    = pos_comp;
  228.         pos_deno(1) = pos_deno(1)+pos_deno(3)+dx2;
  229.         y_low        = y_low-Def_Btn_Height-2*dy2;
  230.         pos_inittree = [x_left, y_low, push_width, Def_Btn_Height];
  231.         pos_wavtree    = pos_inittree;
  232.         pos_wavtree(1) = pos_inittree(1)+pos_inittree(3)+dx2;
  233.         y_low       = y_low-Def_Btn_Height-dy;
  234.         pos_btree   = [x_left, y_low, push_width, Def_Btn_Height];
  235.         pos_blev    = pos_btree;
  236.         pos_blev(1) = pos_btree(1)+pos_btree(3)+dx2;
  237.         y_low         = y_low-Def_Btn_Height-dy;
  238.         wx            = cmd_width-2*dx2-dx;
  239.         pos_t_curtree = [x_left, y_low+d_txt/2, (2*wx)/3, Def_Txt_Height];
  240.         x_leftB       = pos_t_curtree(1)+pos_t_curtree(3)+dx;
  241.         pos_curtree   = [x_leftB, y_low, wx/3, Def_Btn_Height];
  242.         y_low         = y_low-Def_Btn_Height-dy2;
  243.         pos_t_nodlab  = [x_left, y_low+d_txt/2, wx/2, Def_Txt_Height];
  244.         x_leftB       = pos_t_nodlab(1)+pos_t_nodlab(3)+dx;
  245.         pos_nodlab    = [x_leftB, y_low, wx/2, Def_Btn_Height];
  246.  
  247.         y_low         = y_low-Def_Btn_Height-dy;
  248.         pos_t_nodact  = [x_left, y_low+d_txt/2, wx/2, Def_Txt_Height];
  249.         x_leftB       = pos_t_nodact(1)+pos_t_nodact(3)+dx;
  250.         pos_nodact    = [x_leftB, y_low, wx/2, Def_Btn_Height];
  251.         y_low         = y_low-Def_Btn_Height-dy;
  252.         pos_t_nodsel  = [x_left, y_low+d_txt/2, wx/2+2*dx, Def_Txt_Height];
  253.         x_leftB       = pos_t_nodsel(1)+pos_t_nodsel(3);
  254.         pos_nodsel    = [x_leftB, y_low, wx/2-dx, Def_Btn_Height];
  255.         pos_t_nodlab(3) = pos_t_nodlab(3)-dx2;
  256.         pos_nodlab(1)   = pos_nodlab(1)-dx2;
  257.         pos_nodlab(3)   = pos_nodlab(3)+dx2;
  258.         pos_t_nodact(3) = pos_t_nodact(3)-dx2;
  259.         pos_nodact(1)   = pos_nodact(1)-dx2;
  260.         pos_nodact(3)   = pos_nodact(3)+dx2;
  261.         y_low           = pos_nodsel(2)-Def_Btn_Height-dy2;
  262.         pos_txt_full    = [x_left, y_low-Def_Btn_Height/2, wx/3, Def_Btn_Height];
  263.         pos_pus_full    = zeros(4,4);
  264.         xl = pos_txt_full(1)+pos_txt_full(3)+dx;
  265.         pos_pus_full(1,:) = [xl, y_low, wx/3, Def_Btn_Height];
  266.         pos_pus_full(2,:) = pos_pus_full(1,:);
  267.         pos_pus_full(2,2) = pos_pus_full(2,2)-Def_Btn_Height;
  268.         pos_pus_full(3,:) = pos_pus_full(1,:);
  269.         pos_pus_full(3,1) = pos_pus_full(3,1)+pos_pus_full(3,3);
  270.         pos_pus_full(4,:) = pos_pus_full(3,:);
  271.         pos_pus_full(4,2) = pos_pus_full(4,2)-pos_pus_full(4,4);
  272.         y_low         = pos_pus_full(4,2)-Def_Btn_Height-dy2;
  273.         wx            = (cmd_width-2*dx2)/24;
  274.         pos_txt_colm  = [x_left, y_low+d_txt/2, 6*wx, Def_Txt_Height];
  275.         xl            = pos_txt_colm(1)+pos_txt_colm(3);
  276.         y_low         = pos_txt_colm(2);
  277.         pos_pop_colm  = [xl, y_low, 18*wx, Def_Btn_Height];
  278.         % String property of objects.
  279.         %----------------------------
  280.         str_anal      = 'Analyze';
  281.         str_btree     = 'Best Tree';
  282.         str_comp      = 'Compress';
  283.         str_blev      = 'Best Level';
  284.         str_deno      = 'De-noise';
  285.         str_inittree  = 'Initial Tree';
  286.         str_wavtree   = 'Wavelet Tree';
  287.         str_t_curtree = 'Cut Tree at Level : ';
  288.         str_curtree   = '0';
  289.         str_t_nodlab  = 'Node Label : ';
  290.         str_nodlab    = 'Depth_Pos|Index|Entropy|Opt. Ent.|Length|None|Type|Energy';
  291.         str_t_nodact  = 'Node Action : ';
  292.         str_nodact    = 'Visualize|Split / Merge|Recons.|Select On';
  293.         str_nodact    = [str_nodact '|Select Off|Statistics|View Col. Cfs'];
  294.         str_t_nodsel  = 'Select Nodes and';
  295.         str_nodsel    = 'Reconstruct';
  296.         str_txt_full  = 'Full Size';
  297.         str_txt_colm  = 'Cfs Col.';
  298.         str_pop_colm  = [ 'FRQ : Global + abs  ' ; 'FRQ : By Level + abs' ; ...
  299.                           'FRQ : Global        ' ; 'FRQ : By Level      ' ; ...
  300.                           'NAT : Global + abs  ' ; 'NAT : By Level + abs' ; ...
  301.                           'NAT : Global        ' ; 'NAT : By Level      '   ...
  302.                         ];
  303.         % Callback property of objects.
  304.         %------------------------------
  305.         cba_WPOpt      = 'wptreeop';
  306.         cba_anal       = ['wp1dmngr(''anal'',' str_numwin ');'];
  307.         cba_comp       = ['wp1dmngr(''comp'',' str_numwin ');'];
  308.         cba_deno       = ['wp1dmngr(''deno'',' str_numwin ');'];
  309.         cba_btree      = [cba_WPOpt '(''best'',' str_numwin ');'];
  310.         cba_blev       = [cba_WPOpt '(''blvl'',' str_numwin ');'];
  311.         cba_inittree   = [cba_WPOpt '(''restore'',' str_numwin ');'];
  312.         cba_wavtree    = [cba_WPOpt '(''wp2wtree'',' str_numwin ');'];
  313.         cba_nodact     = [cba_WPOpt '(''nodact'',' str_numwin ');'];
  314.         cba_nodlab     = [cba_WPOpt '(''nodlab'',' str_numwin ');'];
  315.         cba_pus_nodsel = [cba_WPOpt '(''recons'',' str_numwin ');'];
  316.         % Command part of the window.
  317.         %============================
  318.         % Data, Wavelet and Level parameters.
  319.         %------------------------------------
  320.         utanapar('create',win_wptool, ...
  321.                  'xloc',xlocINI,'bottom',ybottomINI,...
  322.                  'enable','off', ...
  323.                  'wtype','dwt'   ...
  324.                  );
  325.         % Entropy parameters.
  326.         %--------------------
  327.         utentpar('create',win_wptool, ...
  328.                  'xloc',xlocINI,'bottom',ybottomENT,'enable','off' ...
  329.                  );
  330.         comFigProp = {'Parent',win_wptool,'Unit',win_units};
  331.         comPusProp = {comFigProp{:},'Style','Pushbutton','Enable','Off'};
  332.         comPopProp = {comFigProp{:},'Style','Popupmenu','Enable','Off'};
  333.         comTxtProp = {comFigProp{:},'Style','text', ...
  334.            'HorizontalAlignment','left','Backgroundcolor',Def_FraBkColor};
  335.         pus_anal     = uicontrol(...
  336.                                  comPusProp{:},       ...
  337.                                  'Position',pos_anal, ...
  338.                                  'String',xlate(str_anal),   ...
  339.                                  'Tag',tag_pus_anal,  ...
  340.                                  'Callback',cba_anal, ...
  341.                                  'Interruptible','On' ...
  342.                                  );
  343.         pus_comp     = uicontrol(...
  344.                                  comPusProp{:},       ...
  345.                                  'Position',pos_comp, ...
  346.                                  'String',xlate(str_comp),   ...
  347.                                  'Tag',tag_pus_comp,  ...
  348.                                  'Callback',cba_comp  ...
  349.                                  );
  350.         pus_deno     = uicontrol(...
  351.                                  comPusProp{:},       ...
  352.                                  'Position',pos_deno, ...
  353.                                  'String',xlate(str_deno),   ...
  354.                                  'Tag',tag_pus_deno,  ...
  355.                                  'Callback',cba_deno  ...
  356.                                  );
  357.         pus_inittree = uicontrol(...
  358.                                  comPusProp{:},          ...
  359.                                  'Position',pos_inittree,...
  360.                                  'String',xlate(str_inittree),  ...
  361.                                  'Tag',tag_inittree,     ...
  362.                                  'Callback',cba_inittree ...
  363.                                  );
  364.         pus_wavtree  = uicontrol(...
  365.                                  comPusProp{:},          ...
  366.                                  'Position',pos_wavtree, ...
  367.                                  'String',xlate(str_wavtree),   ...
  368.                                  'Tag',tag_wavtree,      ...
  369.                                  'Callback',cba_wavtree  ...
  370.                                  );
  371.         pus_btree    = uicontrol(...
  372.                                  comPusProp{:},        ...
  373.                                  'Position',pos_btree, ...
  374.                                  'String',xlate(str_btree),   ...
  375.                                  'Tag',tag_pus_btree,  ...
  376.                                  'Callback',cba_btree  ...
  377.                                  );
  378.         pus_blev     = uicontrol(...
  379.                                  comPusProp{:},       ...
  380.                                  'Position',pos_blev, ...
  381.                                  'String',xlate(str_blev),   ...
  382.                                  'Tag',tag_pus_blev,  ...
  383.                                  'Callback',cba_blev  ...
  384.                                  );
  385.         pop_curtree  = uicontrol(...
  386.                                  comPopProp{:},          ...
  387.                                  'Position',pos_curtree, ...
  388.                                  'String',str_curtree,   ...
  389.                                  'Tag',tag_curtree       ...
  390.                                  );
  391.         txt_curtree = uicontrol(...
  392.                                 comTxtProp{:},            ...
  393.                                 'Position',pos_t_curtree, ...
  394.                                 'String',str_t_curtree    ...
  395.                                 );
  396.         txt_nodlab   = uicontrol(...
  397.                                  comTxtProp{:},           ...
  398.                                  'Position',pos_t_nodlab, ...
  399.                                  'String',str_t_nodlab    ...
  400.                                  );
  401.         pop_nodlab   = uicontrol(...
  402.                                  comPopProp{:},         ...
  403.                                  'Position',pos_nodlab, ...
  404.                                  'String',str_nodlab,   ...
  405.                                  'CallBack',cba_nodlab, ...
  406.                                  'Tag',tag_nodlab       ...
  407.                                  );
  408.         txt_nodact   = uicontrol(...
  409.                                  comTxtProp{:},           ...
  410.                                  'Position',pos_t_nodact, ...
  411.                                  'String',str_t_nodact    ...
  412.                                  );
  413.         pop_nodact   = uicontrol(...
  414.                                  comPopProp{:},         ...
  415.                                  'Position',pos_nodact, ...
  416.                                  'String',str_nodact,   ...
  417.                                  'CallBack',cba_nodact, ...
  418.                                  'Tag',tag_nodact       ...
  419.                                  );
  420.         txt_nodsel   = uicontrol(...
  421.                                  comTxtProp{:},           ...
  422.                                  'Position',pos_t_nodsel, ...
  423.                                  'String',str_t_nodsel    ...
  424.                                  );
  425.         pus_nodsel   = uicontrol(...
  426.                                  comPusProp{:},          ...
  427.                                  'Position',pos_nodsel,  ...
  428.                                  'String',xlate(str_nodsel),    ...
  429.                                  'Tag',tag_nodsel,       ...
  430.                                  'Callback',cba_pus_nodsel...
  431.                                  );
  432.         txt_full     = uicontrol(...
  433.                                  comTxtProp{:},           ...
  434.                                  'Position',pos_txt_full, ...
  435.                                  'String',str_txt_full,   ...
  436.                                  'Tag',tag_txt_full       ...
  437.                                  );
  438.         tooltip = strvcat(...
  439.             'View decomposition tree',  ...
  440.             'View node action result',...
  441.             'View analyzed signal', ...
  442.             'View colored coefficients' ...
  443.             );
  444.         for k=1:4
  445.             pus_full(k) = uicontrol(...
  446.                                     comPusProp{:},        ...
  447.                                     'Position',pos_pus_full(k,:), ...
  448.                                     'String',sprintf('%.0f',k),   ...
  449.                                     'Userdata',0,                 ...
  450.                                     'ToolTip',deblank(tooltip(k,:)), ...
  451.                                     'Tag',tag_pus_full(k,:)       ...
  452.                                     );
  453.         end
  454.         txt_colm = uicontrol(...
  455.                              comTxtProp{:},           ...
  456.                              'Position',pos_txt_colm, ...
  457.                              'String',str_txt_colm,   ...
  458.                              'Tag',tag_txt_colm       ...
  459.                              );
  460.         pop_colm = uicontrol(...
  461.                              comPopProp{:},          ...
  462.                              'Position',pos_pop_colm,...
  463.                              'String',str_pop_colm,  ...
  464.                              'Userdata',1,           ...
  465.                              'Tag',tag_pop_colm      ...
  466.                              );
  467.         drawnow;
  468.         % Adding colormap GUI.
  469.         %---------------------
  470.         utcolmap('create',win_wptool, ...
  471.                  'xloc',xlocINI, ...
  472.                  'briflag',0, ...
  473.                  'bkcolor',Def_FraBkColor);
  474.         %  Normalisation.
  475.         %----------------
  476.         Pos_Graphic_Area = wfigmngr('normalize',win_wptool,Pos_Graphic_Area);
  477.         drawnow
  478.         %  Axes Construction.
  479.         %---------------------
  480.         [pos_axe_pack,   pos_axe_tree,   pos_axe_cfs,    ...
  481.          pos_axe_sig,    pos_sli_size,   pos_sli_pos     ...
  482.          pos_axe_col] =  wpposaxe(win_wptool,1,Pos_Graphic_Area);
  483.         comFigProp = {'Parent',win_wptool,'Units','normalized','Visible','off'};
  484.         WP_Sli_Siz = uicontrol(...
  485.                                comFigProp{:},          ...
  486.                                'Style','slider',       ...
  487.                                'Position',pos_sli_size,...
  488.                                'Min',0.5,              ...
  489.                                'Max',10,               ...
  490.                                'Value',1,              ...
  491.                                'UserData',1,           ...
  492.                                'Tag',tag_sli_size      ...
  493.                                );
  494.         WP_Sli_Pos = uicontrol(...
  495.                                comFigProp{:},          ...
  496.                                'Style','slider',       ...
  497.                                'Position',pos_sli_pos, ...
  498.                                'Min',0,                ...
  499.                                'Max',1,                ...
  500.                                'Value',0,              ...
  501.                                'Tag',tag_sli_pos       ...
  502.                                );
  503.         drawnow;
  504.         commonProp = {...
  505.            comFigProp{:},                  ...
  506.            'XTicklabelMode','manual',      ...
  507.            'YTicklabelMode','manual',      ...
  508.            'XTicklabel',[],'YTicklabel',[],...
  509.            'XTick',[],'YTick',[],          ...
  510.            'Box','On'                      ...
  511.            };
  512.         WP_Axe_Tree = axes(commonProp{:}, ...
  513.                            'XLim',[-0.5,0.5],       ...
  514.                            'YDir','reverse',        ...
  515.                            'YLim',[0 1],            ...
  516.                            'Position',pos_axe_tree, ...
  517.                            'Tag',tag_axe_t_lin      ...
  518.                            );
  519.         WP_Axe_Pack = axes(commonProp{:}, ...
  520.                            'Position',pos_axe_pack,'Tag',tag_axe_pack);
  521.         WP_Axe_Cfs  = axes(commonProp{:}, ...
  522.                            'Position',pos_axe_cfs,'Tag',tag_axe_cfs);
  523.         WP_Axe_Sig  = axes(commonProp{:}, ...
  524.                            'Position',pos_axe_sig,'Tag',tag_axe_sig);
  525.         WP_Axe_Col  = axes(commonProp{:}, ...
  526.                            'Position',pos_axe_col,'Tag',tag_axe_col);
  527.         % Callbacks update.
  528.         %------------------
  529.         utanapar('set_cba_num',win_wptool,[m_files;pus_anal]);
  530.         
  531.         cba_curtree  = [cba_WPOpt '(''cuttree'',' str_numwin ',' ...
  532.                         num2mstr(pop_curtree) ');'];
  533.         cba_colm     = [cba_WPOpt '(''col_mode'',' str_numwin ',' ...
  534.                         num2mstr(pop_colm) ');'];
  535.         cba_sli_siz  = [cba_WPOpt '(''slide_size'',' str_numwin ',' ...
  536.                         num2mstr(WP_Sli_Siz) ','    ...
  537.                         num2mstr(WP_Sli_Pos) ');'];
  538.         cba_sli_pos  = [cba_WPOpt '(''slide_pos'',' str_numwin  ',' ...
  539.                         num2mstr(WP_Sli_Pos) ');'];
  540.         set(pop_curtree,'Callback',cba_curtree);
  541.         set(pop_colm,'Callback',cba_colm);
  542.         set(WP_Sli_Siz,'Callback',cba_sli_siz);
  543.         set(WP_Sli_Pos,'Callback',cba_sli_pos);
  544.         beg_cba = ['wpfullsi(''full'',' str_numwin ','];
  545.         for k=1:4
  546.             cba_pus_full = [beg_cba  sprintf('%.0f',k) ');'];
  547.             set(pus_full(k),'Callback',cba_pus_full);
  548.         end
  549.         drawnow;
  550. % Add Context Sensitive Help (CSHelp).
  551. %-------------------------------------
  552. hdl_WP_TOOLS = [...
  553. txt_nodlab,pop_nodlab, ...
  554. txt_nodact,pop_nodact, ...
  555. txt_nodsel,pus_nodsel, ...
  556. txt_colm,pop_colm      ...
  557. ];
  558. wfighelp('add_ContextMenu',win_wptool,pus_btree,'WP_BESTTREE');
  559. wfighelp('add_ContextMenu',win_wptool,hdl_WP_TOOLS,'WP_TOOLS');
  560. %-------------------------------------
  561.         % Memory for stored values.
  562.         %--------------------------
  563.         wmemtool('ini',win_wptool,n_InfoInit,nb0_stored);
  564.         wmemtool('ini',win_wptool,n_param_anal,nb1_stored);
  565.         wmemtool('ini',win_wptool,n_wp_utils,nb2_stored);
  566.         wmemtool('ini',win_wptool,n_structures,nb3_stored);
  567.         wmemtool('ini',win_wptool,n_sav_struct,nb4_stored);
  568.         wmemtool('wmb',win_wptool,n_wp_utils,ind_gra_area,Pos_Graphic_Area);
  569.         % Setting Initial Colormap.
  570.         %--------------------------
  571.         cbcolmap('set',win_wptool,'pal',{'cool',default_nbcolors});
  572.         % End waiting.
  573.         %---------------
  574.         wwaiting('off',win_wptool);
  575.     case 'close'
  576.         fig = varargin{1};
  577.         called_win = wfindobj('figure','Userdata',fig);
  578.         delete(called_win);
  579.         ssig_file = ['ssig_rec.' sprintf('%.0f',fig)];
  580.         if exist(ssig_file)==2
  581.             try , delete(ssig_file); end
  582.         end
  583.     case 'read'
  584.         %****************************************************%
  585.         %** OPTION = 'read' - read tree (and data struct). **%
  586.         %****************************************************%
  587.         % in2 = hdl fig
  588.         %--------------
  589.         % out1 = tree struct
  590.         % (out2 = data struct - optional)
  591.         %--------------------------------
  592.         fig = varargin{1};
  593.         err = 1-ishandle(fig);
  594.         if err==0
  595.             if ~strcmp(get(fig,'tag'),mfilename) , err = 1; end
  596.         end
  597.         if err
  598.             errargt(mfilename,'Invalid figure !','msg');
  599.             return;
  600.         end
  601.         [varargout{1},varargout{2}] = ...
  602.             wmemtool('rmb',fig,n_structures,ind_tree_st,ind_data_st);
  603.     case 'show'
  604.         %**************************************************%
  605.         %** OPTION = 'show' - show tree and data struct. **%
  606.         %**************************************************%
  607.         % in2 = hdl fig
  608.         % in3 = tree struct
  609.         % (in4 = data struct)
  610.         %---------------------
  611.         fig = varargin{1};      
  612.         err = 1-ishandle(fig);
  613.         if err
  614.             fig = wp1dtool; err = 0;
  615.         elseif ~strcmp(get(fig,'tag'),mfilename)
  616.             err = 1;
  617.         end
  618.         if err
  619.             errargt(mfilename,'Invalid figure !','msg');
  620.             return;
  621.         end
  622.         wp1dmngr('load_dec',varargin{:});
  623.     otherwise
  624.         errargt(mfilename,'Unknown Option','msg');
  625.         error('*');
  626. end