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

波变换

开发平台:

Matlab

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