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

波变换

开发平台:

Matlab

  1. function [out1,out2] = dw1dscrm(option,win_dw1dtool,in3,in4,in5)
  2. %DW1DSCRM Discrete wavelet 1-D show and scroll mode manager.
  3. %   [OUT1,OUT2] = DW1DSCRM(OPTION,WIN_DW1DTOOL,IN3,IN4,IN5)
  4. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
  5. %   Last Revision: 27-Jun-2001.
  6. %   Copyright 1995-2002 The MathWorks, Inc.
  7. %   $Revision: 1.17 $ $Date: 2002/04/14 19:44:27 $
  8. % MemBloc1 of stored values.
  9. %---------------------------
  10. n_param_anal   = 'DWAn1d_Par_Anal';
  11. ind_sig_name   = 1;
  12. ind_sig_size   = 2;
  13. ind_wav_name   = 3;
  14. ind_lev_anal   = 4;
  15. ind_axe_ref    = 5;
  16. ind_act_option = 6;
  17. ind_ssig_type  = 7;
  18. ind_thr_val    = 8;
  19. nb1_stored     = 8;
  20. % MemBloc2 of stored values.
  21. %---------------------------
  22. n_coefs_longs = 'Coefs_and_Longs';
  23. ind_coefs     = 1;
  24. ind_longs     = 2;
  25. nb2_stored    = 2;
  26. % MemBloc4 of stored values.
  27. %---------------------------
  28. n_miscella     = 'DWAn1d_Miscella';
  29. ind_graph_area =  1;
  30. ind_view_mode  =  2;
  31. ind_savepath   =  3;
  32. nb4_stored     =  3;
  33. % Tag property of objects.
  34. %-------------------------
  35. tag_valapp_scr = 'ValApp_Scr';
  36. tag_txtapp_scr = 'TxtApp_Scr';
  37. tag_valdet_scr = 'ValDet_Scr';
  38. tag_txtdet_scr = 'TxtDet_Scr';
  39. tag_axeappini  = 'Axe_AppIni';
  40. tag_axedetini  = 'Axe_DetIni';
  41. tag_axecfsini  = 'Axe_CfsIni';
  42. tag_axecolmap  = 'Axe_ColMap';
  43. tag_s_inapp    = 'Sig_in_App';
  44. tag_ss_inapp   = 'SSig_in_App';
  45. tag_s_indet    = 'Sig_in_Det';
  46. tag_ss_indet   = 'SSig_in_Det';
  47. tag_app        = 'App';
  48. tag_det        = 'Det';
  49. tag_img_cfs    = 'Img_Cfs';
  50. tag_img_sca    = 'Img_Sca';
  51. children    = get(win_dw1dtool,'Children');
  52. axe_handles = findobj(children,'flat','type','axes');
  53. uic_handles = findobj(children,'flat','type','uicontrol');
  54. txt_handles = findobj(uic_handles,'Style','text');
  55. pop_handles = findobj(uic_handles,'Style','popupmenu');
  56. axe_app_ini = findobj(axe_handles,'flat','Tag',tag_axeappini);
  57. axe_det_ini = findobj(axe_handles,'flat','Tag',tag_axedetini);
  58. axe_cfs_ini = findobj(axe_handles,'flat','Tag',tag_axecfsini);
  59. axe_col_map = findobj(axe_handles,'flat','Tag',tag_axecolmap);
  60. switch option
  61.     case 'app'
  62.         pop = findobj(pop_handles,'Tag',tag_valapp_scr);
  63.         num = get(pop,'Value');
  64.         old = findobj(axe_app_ini,'Tag',tag_app);
  65.         if ~isempty(old)
  66.             hdl_line = findobj(old,'Userdata',num);
  67.             if ~isempty(hdl_line)
  68.                 ii = find(old==hdl_line);
  69.                 old(ii) = [];
  70.                 num = 0;
  71.                 try , delete(old); end
  72.                 return
  73.             end
  74.         end
  75.         % Begin waiting.
  76.         %---------------
  77.         wwaiting('msg',win_dw1dtool,'Wait ... computing');
  78.         try , delete(old); end
  79.         x = dw1dfile('app',win_dw1dtool,num);
  80.         Level_Anal = wmemtool('rmb',win_dw1dtool,n_param_anal,ind_lev_anal);
  81.         col_app = wtbutils('colors','app',Level_Anal);
  82.         line('Parent',axe_app_ini,'Xdata',[1:length(x)],'Ydata',x,...
  83.              'Color',col_app(num,:),'Tag',tag_app,'Userdata',num);
  84.         str_tit = get(get(axe_app_ini,'title'),'String');
  85.         ind = findstr(str_tit,'level');
  86.         str_tit = [str_tit(1:ind+5) sprintf('%.0f',num)];
  87.         wtitle(str_tit,'Parent',axe_app_ini);
  88.         % End waiting.
  89.         %-------------
  90.         wwaiting('off',win_dw1dtool);
  91.     case 'det'
  92.         pop = findobj(pop_handles,'Tag',tag_valdet_scr);
  93.         num = get(pop,'Value');
  94.         old = findobj(axe_det_ini,'Tag',tag_det);
  95.         if ~isempty(old)
  96.             hdl_line = findobj(old,'Userdata',num);
  97.             if ~isempty(hdl_line)
  98.                 ii = find(old==hdl_line);
  99.                 old(ii) = [];
  100.                 num = 0;
  101.                 try , delete(old); end
  102.                 return
  103.             end
  104.         end
  105.         % Begin waiting.
  106.         %---------------
  107.         wwaiting('msg',win_dw1dtool,'Wait ... computing');
  108.         try , delete(old); end
  109.         ll = findobj(axe_det_ini,'type','line','Visible','On');
  110.         if isempty(ll)
  111.             [x,set_ylim,ymin,ymax] = dw1dfile('det',win_dw1dtool,num,1);
  112.         else
  113.             set_ylim = 0;
  114.             x = dw1dfile('det',win_dw1dtool,num);
  115.         end
  116.         Level_Anal = wmemtool('rmb',win_dw1dtool,n_param_anal,ind_lev_anal);
  117.         col_det = wtbutils('colors','det',Level_Anal);
  118.         line('Parent',axe_det_ini,'Xdata',[1:length(x)],'Ydata',x,...
  119.              'Color',col_det(num,:),'Tag',tag_det,'Userdata',num);
  120.         if set_ylim , set(axe_det_ini,'Ylim',[ymin,ymax]); end
  121.         str_tit = get(get(axe_det_ini,'title'),'String');
  122.         ind = findstr(str_tit,'level');
  123.         str_tit = [str_tit(1:ind+5) sprintf('%.0f',num)];
  124.         wtitle(str_tit,'Parent',axe_det_ini);
  125.         % End waiting.
  126.         %-------------
  127.         wwaiting('off',win_dw1dtool);
  128.     case 'plot_sig'
  129.         % in3 = signal
  130.         % in4 = display mode
  131.         % in5 = sig  visibility  
  132.         %----------------------
  133.         if     nargin==3 , in4 = 1; in5 = 1;
  134.         elseif nargin==4 , in5 = 1;
  135.         end
  136.         if in4==1 , v = 1; else , v = 0; end
  137.         axe_hdl = dw1dscrm('axes',win_dw1dtool,[1 1 1],1);
  138.         vsig = getonoff(in5);
  139.         set(axe_hdl(1),'Visible',vsig);
  140.         set(axe_hdl(2:4),'Visible',getonoff(v));
  141.         % Drawing.
  142.         %---------
  143.         axeAct = axe_hdl(1);
  144.         wtitle('Loaded Signal','Parent',axeAct);
  145.         col_s = wtbutils('colors','sig');
  146.         line('Parent',axeAct,'Xdata',[1:length(in3)],'Ydata',in3,...
  147.              'Color',col_s,'Visible',vsig,'Tag',tag_s_inapp);
  148.         axeAct = axe_hdl(2);
  149.         xmin = 1;             xmax = length(in3);
  150.         ymin = min(in3)-eps;  ymax = max(in3)+eps;
  151.         line('Parent',axeAct,'Xdata',[xmin:xmax],'Ydata',in3,...
  152.              'Color',col_s,'Visible','Off','Tag',tag_s_indet);
  153.         set(axe_hdl(1:3),'Xlim',[xmin xmax],'Ylim',[ymin ymax]);
  154.     case 'plot_anal'
  155.         lin_handles = findobj(axe_handles,'Type','line');
  156.         ss_in_app   = findobj(lin_handles,'Tag',tag_ss_inapp);
  157.         if isempty(ss_in_app)
  158.             col_ss = wtbutils('colors','ssig');
  159.             ss_rec = dw1dfile('ssig',win_dw1dtool);
  160.             line(...
  161.                  'Parent',axe_app_ini, ...
  162.                  'Xdata',[1:length(ss_rec)],'Ydata',ss_rec, ...
  163.                  'Zdata',2*ones(size(ss_rec)),...
  164.                  'Color',col_ss,'Visible','Off','Tag',tag_ss_inapp);
  165.             line(...
  166.                  'Parent',axe_det_ini, ...
  167.                  'Xdata',[1:length(ss_rec)],'Ydata',ss_rec, ...
  168.                  'Zdata',2*ones(size(ss_rec)), ...
  169.                  'Color',col_ss,'Visible','Off','Tag',tag_ss_indet);
  170.             clear ss_rec
  171.         end
  172.         Level_Anal = wmemtool('rmb',win_dw1dtool,n_param_anal,ind_lev_anal);
  173.         [app_rec,set_ylim,ymin,ymax] = dw1dfile('app',win_dw1dtool,1,1);
  174.         ylim = get(axe_app_ini,'Ylim');
  175.         if ylim(1)<ymin , ymin = ylim(1); end
  176.         if ylim(2)>ymax , ymax = ylim(2); end
  177.         col_app = wtbutils('colors','app',Level_Anal);
  178.         line(...
  179.              'Parent',axe_app_ini,...
  180.              'Xdata',[1:length(app_rec)],'Ydata',app_rec,...
  181.              'Color',col_app(1,:),'Tag',tag_app,'Userdata',1);
  182.         wtitle(sprintf('Signal and Approximation at level %.0f',1),...
  183.                 'Parent',axe_app_ini)
  184.         set(axe_app_ini,'Ylim',[ymin,ymax]);
  185.         clear app_rec
  186.         [det_rec,set_ylim,ymin,ymax] = dw1dfile('det',win_dw1dtool,1,1);
  187.         col_det = wtbutils('colors','det',Level_Anal);
  188.         line(...
  189.              'Parent',axe_det_ini,...
  190.              'Xdata',[1:length(det_rec)],'Ydata',det_rec,...
  191.              'Color',col_det(1,:),'Tag',tag_det,'Userdata',1);
  192.         if set_ylim , set(axe_det_ini,'Ylim',[ymin,ymax]); end
  193.         wtitle(sprintf('Detail at level %.0f',1),...
  194.                 'Parent',axe_det_ini)
  195.         clear det_rec
  196.         clear longs coefs
  197.         [det_cfs,xlim1,xlim2,ymax,ymin,nb_cla,levs,ccfs_vm] = ...
  198.                                 dw1dmisc('col_cfs',win_dw1dtool);
  199.         levlab  = flipud(int2str(levs(:)));
  200.         img_cfs = image(flipud(det_cfs),...
  201.                         'Parent',axe_cfs_ini,         ...
  202.                         'Tag',tag_img_cfs,            ...
  203.                         'Userdata',[ccfs_vm,levs,xlim1,xlim2,nb_cla]);
  204.         set(axe_cfs_ini,'YTicklabelMode','manual',...
  205.                         'YTick',[1:length(levs)], ...
  206.                         'YTickLabel',levlab,      ...
  207.                         'Ylim',[0.5 Level_Anal+0.5], ...
  208.                         'Tag',tag_axecfsini       ...
  209.                         );
  210.         wtitle('Details Coefficients','Parent',axe_cfs_ini);
  211.         wylabel('Level number','Parent',axe_cfs_ini)
  212.         clear dec_cfs
  213.         image([0 1],[0 1],[1:nb_cla],'Parent',axe_col_map,'Tag',tag_img_sca);
  214.         set(axe_col_map,...
  215.                 'XTickLabel',[],'YTickLabel',[],...
  216.                 'XTick',[],'YTick',[],'Tag',tag_axecolmap);
  217.         wsetxlab(axe_col_map,'Scale of colors from MIN to MAX');
  218.         % Reference axes used by stat. & histo & ...
  219.         %-------------------------------------------
  220.         wmemtool('wmb',win_dw1dtool,n_param_anal,ind_axe_ref,axe_app_ini);
  221.         % Axes attachment.
  222.         %-----------------
  223.         dw1dscrm('dynv',win_dw1dtool);
  224.     case 'plot_cfs'
  225.         % in3 = display mode
  226.         %------------------
  227.         if nargin==2 , in3 = 1; end
  228.         if in3==1 , v = 1; else , v = 0; end
  229.         v = 0;  % force l'affichage des coefficients
  230.         axe_hdl = dw1dscrm('axes',win_dw1dtool,[1 v 1],1);
  231.         set(axe_hdl(2),'Visible',getonoff(v));
  232.         set(axe_hdl(1,3:4),'Visible','On');
  233.         Signal_Size = wmemtool('rmb',win_dw1dtool,n_param_anal,ind_sig_size);
  234.         xmin = 1;  xmax = Signal_Size;
  235.         ta3 = 'Loaded Details Coefficients (Colored)';
  236.         if v
  237.             set(axe_hdl(1:3),'Xlim',[xmin xmax]);
  238.         else
  239.             [coefs,longs] = wmemtool('rmb',win_dw1dtool,...
  240.                                             n_coefs_longs,ind_coefs,ind_longs);
  241.             coefs = coefs(longs(1)+1:end);
  242.             longs = longs(2:end-1);
  243.             nbd   = length(longs);
  244.             ymin = min(coefs);
  245.             ymax = max(coefs);
  246.             if ymin==ymax , dy = 0.001; else ,dy = (ymax-ymin)/20; end
  247.             ymin = ymin-dy; ymax = ymax+dy;
  248.             axe_act = axe_hdl(1);
  249.             set(axe_act,'Xlim',[1 length(coefs)],'Ylim',[ymin ymax]);
  250.             wtitle(['Loaded Details Coefficients from level '...
  251.                      sprintf('%.0f',nbd) ' to level 1.'],'Parent',axe_act);
  252.             line('Parent',axe_act,'Xdata',[1:length(coefs)],'Ydata',coefs, ...
  253.                  'Color',wtbutils('colors','coefs'));
  254.             x = 0;
  255.             linCOL = wtbutils('colors','dw1d','sepcfs');
  256.             for k = 1:nbd-1
  257.                 x = x+longs(k);
  258.                 line('Parent',axe_act,'Xdata',[x x],'Ydata',[ymin ymax], ...
  259.                      'Color',linCOL);
  260.             end
  261.             drawnow
  262.             set(axe_hdl(2:3),'Xlim',[xmin xmax]);
  263.         end
  264.         axe_act = axe_hdl(3);
  265.         [det_cfs,xlim1,xlim2,ylim2,ylim1,nb_cla,levs,ccfs_vm] = ...
  266.                                 dw1dmisc('col_cfs',win_dw1dtool);
  267.         levlab  = flipud(int2str(levs(:)));
  268.         img_cfs = image(flipud(det_cfs),   ...
  269.                         'Parent',axe_act,  ...
  270.                         'Tag',tag_img_cfs, ...
  271.                         'Userdata',[ccfs_vm,levs,xlim1,xlim2,nb_cla]);
  272.         wtitle(ta3,'Parent',axe_act);
  273.         wylabel('Level number','Parent',axe_act)
  274.         set(axe_act,'YTicklabelMode','manual',   ...
  275.                     'YTick',[1:length(levs)],    ...
  276.                     'YTickLabel',levlab,         ...
  277.                     'Ylim',[0.5 length(levs)+0.5],...
  278.                     'Tag',tag_axecfsini          ...
  279.                     );
  280.         axe_act = axe_hdl(4);
  281.         image([0 1],[0 1],[1:nb_cla],'Parent',axe_act,'Tag',tag_img_sca);
  282.         set(axe_act,...
  283.                 'XTickLabel',[],'YTickLabel',[],...
  284.                 'XTick',[],'YTick',[],'Tag',tag_axecolmap);
  285.         wsetxlab(axe_act,'Scale of colors from MIN to MAX');
  286.         if v==0
  287.             set(axe_hdl(1),'Xlim',[1 length(coefs)],'Ylim',[ymin ymax]);
  288.         end
  289.     case 'plot_synt'
  290.         % Getting  Synthesis parameters.
  291.         %------------------------------
  292.         Level_Anal = wmemtool('rmb',win_dw1dtool,n_param_anal,ind_lev_anal);
  293.         % Computing Decomposition.
  294.         %-------------------------
  295.         col_s   = wtbutils('colors','sig');
  296.         col_ss  = wtbutils('colors','ssig');
  297.         col_app = wtbutils('colors','app',Level_Anal);
  298.         col_det = wtbutils('colors','det',Level_Anal);
  299.         delete(get(axe_app_ini,'Children'));
  300.         axe_hdl = dw1dscrm('axes',win_dw1dtool,[1 1 1],0);
  301.         set(axe_hdl,'Visible','On');
  302.         sig_rec = dw1dfile('sig',win_dw1dtool);
  303.         line(...
  304.              'Parent',axe_app_ini,...
  305.              'Xdata',[1:length(sig_rec)],'Ydata',sig_rec,...
  306.              'Color',col_s,'Tag',tag_s_inapp);
  307.         line(...
  308.              'Parent',axe_app_ini,...
  309.              'Xdata',[1:length(sig_rec)],'Ydata',sig_rec, ...
  310.              'Zdata',2*ones(size(sig_rec)),...
  311.              'Color',col_ss,'Visible','Off','Tag',tag_ss_inapp);
  312.         app_rec = dw1dfile('app',win_dw1dtool,1);
  313.         line(...
  314.              'Parent',axe_app_ini,...
  315.              'Xdata',[1:length(app_rec)],'Ydata',app_rec,...
  316.              'Color',col_app(1,:),'Tag',tag_app,'Userdata',1);
  317.         wtitle(sprintf('Original Synthesized Signal and Approximation at level %.0f',1),...
  318.        'Parent',axe_app_ini)
  319.         clear app_rec
  320.         [det_rec,set_ylim,ymin,ymax] = dw1dfile('det',win_dw1dtool,1,1);
  321.         line(...
  322.              'Parent',axe_det_ini,...
  323.              'Xdata',[1:length(sig_rec)],'Ydata',sig_rec,...
  324.              'Color',col_s,'Visible','Off','Tag',tag_s_indet);
  325.         line(...
  326.              'Parent',axe_det_ini,...
  327.              'Xdata',[1:length(sig_rec)],'Ydata',sig_rec,...
  328.              'Zdata',2*ones(size(sig_rec)),...
  329.              'Color',col_ss,'Visible','Off','Tag',tag_ss_indet);
  330.         line(...
  331.              'Parent',axe_det_ini,...
  332.              'Xdata',[1:length(det_rec)],'Ydata',det_rec,...
  333.              'Color',col_det(1,:),'Tag',tag_det,'Userdata',1);
  334.         if set_ylim , set(axe_det_ini,'Ylim',[ymin ymax]); end
  335.         wtitle(sprintf('Detail at level %.0f',1),'Parent',axe_det_ini)
  336.         wtitle('Details Coefficients','Parent',axe_cfs_ini);
  337.         wylabel('Level number','Parent',axe_cfs_ini);
  338.         wsetxlab(axe_col_map,'Scale of colors from MIN to MAX');
  339.         % Reference axes used by stat. & histo & ...
  340.         %-------------------------------------------
  341.         wmemtool('wmb',win_dw1dtool,n_param_anal,ind_axe_ref,axe_app_ini);
  342.         % Axes attachment.
  343.         %-----------------
  344.         dw1dscrm('dynv',win_dw1dtool);
  345.     case 'view'
  346.         % in3 = old_mode
  347.         %----------------
  348.         % in3 = -1 : same mode
  349.         % in3 =  0 : clean
  350.         % in3 =  1 : scr mode
  351.         % in3 =  2 : dec mode
  352.         % in3 =  3 : sep mode
  353.         % in3 =  4 : sup mode
  354.         % in3 =  5 : tre mode
  355.         % in3 =  6 : cfs mode
  356.         %---------------------------
  357.         old_mode = in3;
  358.         [flg_axe,flg_sa,flg_app,flg_sd,flg_det,ccfs_m] = ...
  359.                                 dw1dvmod('get_vm',win_dw1dtool,1);
  360.         v_flg = [flg_sa , flg_app , flg_sd , flg_det , flg_axe(3)];
  361.         if flg_axe(1)== 0 , v_flg(1:3) = zeros(1,3); end
  362.         if flg_axe(2)== 0 , v_flg(4:6) = zeros(1,3); end
  363.         if flg_axe(3)== 0 , v_flg(7)   = 0; end
  364.         pop_app  = findobj(pop_handles,'Tag',tag_valapp_scr);
  365.         lev_a    = get(pop_app,'Value');
  366.         pop_det  = findobj(pop_handles,'Tag',tag_valdet_scr);
  367.         lev_d    = get(pop_det,'Value');
  368.         vis_str  = getonoff(v_flg);
  369.         v_s_app  = vis_str(1,:);
  370.         v_ss_app = vis_str(2,:);
  371.         v_app    = vis_str(3,:);
  372.         v_s_det  = vis_str(4,:);
  373.         v_ss_det = vis_str(5,:);
  374.         v_det    = vis_str(6,:);
  375.         v_cfs    = vis_str(7,:);
  376.         axe_hdl     = dw1dscrm('axes',win_dw1dtool,flg_axe);
  377.         lin_handles = findobj(axe_hdl,'Type','line');
  378.         img_handles = findobj(axe_hdl,'Type','image');
  379.         s_in_app    = findobj(lin_handles,'Tag',tag_s_inapp);
  380.         s_in_det    = findobj(lin_handles,'Tag',tag_s_indet);
  381.         app         = findobj(lin_handles,'Tag',tag_app,'Userdata',lev_a);
  382.         ss_in_app   = findobj(lin_handles,'Tag',tag_ss_inapp);
  383.         ss_in_det   = findobj(lin_handles,'Tag',tag_ss_indet);
  384.         det         = findobj(lin_handles,'Tag',tag_det,'Userdata',lev_d);
  385.         img_cfs     = findobj(img_handles,'Tag',tag_img_cfs);
  386.         img_sca     = findobj(img_handles,'Tag',tag_img_sca);
  387.         [Wave_Name,opt_act,Level_Anal,ss_type] = ...
  388.                 wmemtool('rmb',win_dw1dtool,n_param_anal,...
  389.                           ind_wav_name,ind_act_option,ind_lev_anal,...
  390.                                                       ind_ssig_type);
  391.         if     ss_type=='ss', str_ss = 'Synthesized Signal';
  392.         elseif ss_type=='ds', str_ss = 'De-noised Signal';
  393.         elseif ss_type=='cs', str_ss = 'Compressed Signal';
  394.         end
  395.         if strcmp(opt_act,'synt')
  396.             ini_str = 'Orig. Synt. Sig.';
  397.         else
  398.             ini_str = 'Signal';
  399.         end
  400.         if v_flg(1)==1
  401.             if v_flg(2)==1
  402.                 str_tit = [ini_str ', ' str_ss ' and']; 
  403.             else    
  404.                 str_tit = [ini_str ' and'];     
  405.             end
  406.         else
  407.             if v_flg(2)==1
  408.                 str_tit = [str_ss ' and'];      
  409.             else    
  410.                 str_tit = '';   
  411.             end
  412.         end
  413.         wtitle([ str_tit ' Approximation at level ' sprintf('%.0f',lev_a)],...
  414.                 'Parent',axe_hdl(1));
  415.         if v_flg(4)==1
  416.             if v_flg(5)==1
  417.                 str_tit = [ini_str ', ' str_ss ' and']; 
  418.             else    
  419.                 str_tit = [ini_str ' and'];     
  420.             end
  421.         else
  422.             if v_flg(5)==1
  423.                 str_tit = [str_ss ' and'];      
  424.             else    
  425.                 str_tit = '';   
  426.             end
  427.         end
  428.         wtitle([ str_tit ' Detail at level ' sprintf('%.0f',lev_d)],...
  429.                 'Parent',axe_hdl(2));
  430.         if isempty(s_in_app)
  431.             x = dw1dfile('sig',win_dw1dtool);
  432.             xmin = 1;           xmax = length(x);
  433.             ymin = min(x)-eps;  ymax = max(x)+eps;
  434.             set(axe_hdl(1:3),'Xlim',[xmin xmax]);
  435.             col_s = wtbutils('colors','sig');
  436.             line(...
  437.                  'Parent',axe_hdl(1),...
  438.                  'Xdata',[xmin:xmax],'Ydata',x,...
  439.                  'Color',col_s,'Visible',v_s_app,'Tag',tag_s_inapp);
  440.             line(...
  441.                  'Parent',axe_hdl(2),...
  442.                  'Xdata',[xmin:xmax],'Ydata',x,...
  443.                  'Color',col_s,'Visible',v_s_det,'Tag',tag_s_indet);
  444.         else
  445.             set(s_in_app,'Visible',v_s_app);
  446.             set(s_in_det,'Visible',v_s_det);
  447.         end
  448.         if isempty(ss_in_app)
  449.             x = dw1dfile('ssig',win_dw1dtool);
  450.             col_ss = wtbutils('colors','ssig');
  451.             line(...
  452.                  'Parent',axe_hdl(1),...
  453.                  'Xdata',[1:length(x)],'Ydata',x,'Zdata',2*ones(size(x)),...
  454.                  'Color',col_ss,'Visible',v_ss_app,'Tag',tag_ss_inapp);
  455.             line(...
  456.                  'Parent',axe_hdl(2),...
  457.                  'Xdata',[1:length(x)],'Ydata',x,'Zdata',2*ones(size(x)),...
  458.                  'Color',col_ss,'Visible',v_ss_det,'Tag',tag_ss_indet);
  459.         else
  460.             set(ss_in_app,'Visible',v_ss_app);
  461.             set(ss_in_det,'Visible',v_ss_det);
  462.         end
  463.         if isempty(app)
  464.             x = dw1dfile('app',win_dw1dtool,lev_a);
  465.             col_app = wtbutils('colors','app',Level_Anal);
  466.             line(...
  467.                  'Parent',axe_hdl(1),...
  468.                  'Xdata',[1:length(x)],'Ydata',x,...
  469.                  'Color',col_app(lev_a,:),'Visible',v_app, ...
  470.                  'Tag',tag_app,'Userdata',lev_a);
  471.         else
  472.             set(app,'Visible',v_app);
  473.         end
  474.         if isempty(det)
  475.             ll = findobj([s_in_det,ss_in_det], 'Visible','on');
  476.             if isempty(ll)
  477.                 [x,set_ylim,ymin,ymax] = dw1dfile('det',win_dw1dtool,lev_d,1);
  478.             else
  479.                 set_ylim = 0;
  480.                 x = dw1dfile('det',win_dw1dtool,lev_d);
  481.             end
  482.             col_det = wtbutils('colors','det',Level_Anal);
  483.             line(...
  484.                  'Parent',axe_hdl(2),...
  485.                  'Xdata',[1:length(x)],'Ydata',x,...
  486.                  'Color',col_det(lev_d,:),'Visible',v_det, ...
  487.                  'Tag',tag_det,'Userdata',lev_d);
  488.             if set_ylim , set(axe_hdl(2),'Ylim',[ymin,ymax]); end
  489.         else
  490.             set(det,'Visible',v_det);
  491.         end
  492.         axe_act = axe_hdl(3);
  493.         [rep,ccfs_vm,levs,xlim,nb_cla] = ...                            
  494.         dw1dmisc('tst_vm',win_dw1dtool,1,axe_act,[1:Level_Anal]);
  495.         if rep==1 ,  delete(img_cfs); img_cfs = []; end
  496.         if isempty(img_cfs)
  497.             [x,xlim1,xlim2,ymax,ymin,nb_cla,levs,ccfs_vm] = ...
  498.                     dw1dmisc('col_cfs',win_dw1dtool,ccfs_vm,levs,xlim,nb_cla);
  499.             levlab  = flipud(int2str(levs(:)));
  500.             img_cfs = image(flipud(x),...
  501.                             'Parent',axe_act,  ...
  502.                             'Visible',v_cfs,   ...
  503.                             'Tag',tag_img_cfs, ...
  504.                             'Userdata',[ccfs_vm,levs,xlim1,xlim2,nb_cla]);
  505.             xlim = get(axe_hdl(1),'Xlim');
  506.             set(axe_act, ...
  507.                        'Xlim',xlim,              ...
  508.                        'YTicklabelMode','manual',...
  509.                        'YTick',[1:length(levs)], ...
  510.                        'YTickLabel',levlab,      ...
  511.                        'Ylim',[0.5 Level_Anal+0.5], ...
  512.                        'Tag',tag_axecfsini       ...
  513.                        );
  514.             clear x
  515.             axe_act = axe_hdl(4);
  516.             image([0 1],[0 1],[1:nb_cla],...
  517.                   'Parent',axe_act,...
  518.                   'Visible',v_cfs,...
  519.                   'Tag',tag_img_sca);
  520.             set(axe_act,...
  521.                     'XTickLabel',[],'YTickLabel',[],...
  522.                     'XTick',[],'YTick',[],'Tag',tag_axecolmap);
  523.         else
  524.             set([img_cfs img_sca],'Visible',v_cfs);
  525.         end
  526.         set(axe_hdl(3:4),'Visible',v_cfs);
  527.         axe_act = axe_hdl(3);
  528.         wylabel('Level number','Parent',axe_act);
  529.         wtitle('Details Coefficients','Parent',axe_act);
  530.         if strcmp(deblankl(v_cfs),'on') 
  531.             drawnow
  532.             wsetxlab(axe_hdl(4),'Scale of colors from MIN to MAX');
  533.         end
  534.         % Axes attachment.
  535.         %-----------------
  536.         dw1dscrm('dynv',win_dw1dtool,old_mode);
  537.         % Reference axes used by stat. & histo & ...
  538.         %-------------------------------------------
  539.         wmemtool('wmb',win_dw1dtool,n_param_anal,ind_axe_ref,axe_hdl(1));
  540.     case 'dynv'
  541.         % in3 = old_mode or ...
  542.         % in3 = -1 : same mode
  543.         % in3 =  0 : clean 
  544.         %-----------------------
  545.         % Axes attachment.
  546.         %-----------------
  547.         if nargin==2 , in3 = 0; end
  548.         okNew = dw1dvdrv('test_mode',win_dw1dtool,'scr',in3);
  549.         if okNew
  550.             Level_Anal = wmemtool('rmb',win_dw1dtool,n_param_anal,...
  551.                                             ind_lev_anal);
  552.             dynvtool('get',win_dw1dtool,0,'force');
  553.             dynvtool('init',win_dw1dtool,...
  554.                     [],[axe_app_ini axe_det_ini,axe_cfs_ini],[],[1 0], ...
  555.                     '','','dw1dcoor',[win_dw1dtool,axe_cfs_ini,Level_Anal]);
  556.         end
  557.     case 'axes'
  558.         % in3 flag for axes visibility
  559.         % in4 flag for clearing axes
  560.         % in4 = 1 , clear axes.
  561.         %---------------------------
  562.         switch nargin
  563.           case 2 , flg_axe = [1 1 1]; clear_axes = 1;
  564.           case 3 , flg_axe = in3;     clear_axes = 0;
  565.           case 4 , flg_axe = in3;     clear_axes = in4;
  566.         end
  567.         % Axes Positions.
  568.         %----------------
  569.         nb_axes = sum(flg_axe);
  570.         pos_graph = wmemtool('rmb',win_dw1dtool,n_miscella,ind_graph_area);
  571.         pos_win = get(win_dw1dtool,'Position');
  572.         bdx  = 0.06*pos_win(3);
  573.         bdy  = 0.08*pos_win(4);
  574.         bdy0 = 0.04*pos_win(4);
  575.         bdy1 = 0.04*pos_win(4);
  576.         bdy2 = 0.06*pos_win(4);
  577.         %--------------------- Scale of Colors Axes ----------------------%
  578.         h_col  = 0.02*pos_win(4);
  579.         w_col  = pos_graph(3)/3;
  580.         x_col  = pos_graph(1)+w_col;
  581.         y_col  = pos_graph(2)+bdy0;
  582.         pos_ax = zeros(4,4);
  583.         pos_ax(4,:) = [x_col , y_col , w_col , h_col];
  584.         %-----------------------------------------------------------------%
  585.         if nb_axes==0 , nb_axes = 3 ;end
  586.         xleft = pos_graph(1)+bdx;
  587.         width = pos_graph(3)-2*bdx;
  588.         hy = pos_graph(4)-(nb_axes-1)*bdy-bdy0-bdy2;
  589.         if flg_axe(3)==1
  590.             ylow        = y_col+h_col+bdy1;
  591.             height      = (hy-bdy1-h_col)/nb_axes;
  592.             pos_ax(3,:) = [xleft , ylow , width , height];
  593.             ylow = ylow+height+bdy;
  594.         else
  595.             ylow = pos_graph(2)+bdy0;
  596.             height = hy/nb_axes;
  597.         end
  598.         if flg_axe(2)==1
  599.             pos_ax(2,:) = [xleft , ylow , width , height];
  600.             ylow = ylow+height+bdy;
  601.         end
  602.         if flg_axe(1)==1
  603.             pos_ax(1,:) = [xleft , ylow , width , height];      
  604.         end
  605.         axe_hdl = findobj(axe_handles,'flat','Tag',tag_axeappini);
  606.         if ~isempty(axe_hdl)
  607.             out1(1) = axe_hdl;
  608.             out1(2) = findobj(axe_handles,'flat','Tag',tag_axedetini);
  609.             out1(3) = findobj(axe_handles,'flat','Tag',tag_axecfsini);
  610.             out1(4) = findobj(axe_handles,'flat','Tag',tag_axecolmap);
  611.             if clear_axes , cleanaxe(out1) ; end             
  612.         else
  613.             win_units = get(win_dw1dtool,'Units');
  614.             axeProp = {...
  615.                'Parent',win_dw1dtool, ...
  616.                'Units',win_units,     ...
  617.                'Visible','Off',       ...
  618.                'DrawMode','Normal',   ...
  619.                'box','on'             ...
  620.                };            
  621.             out1(1) = axes(axeProp{:},...
  622.                            'NextPlot','Add',   ...
  623.                            'Tag',tag_axeappini ...
  624.                            );
  625.             out1(2) = axes(axeProp{:},...
  626.                            'NextPlot','Add',   ...
  627.                            'Tag',tag_axedetini ...
  628.                            );
  629.             out1(3) = axes(axeProp{:},...
  630.                            'NextPlot','Replace',...
  631.                            'Tag',tag_axecfsini  ...
  632.                            );
  633.             out1(4) = axes(axeProp{:},...
  634.                             'XTicklabelMode','manual',...
  635.                             'YTicklabelMode','manual',...
  636.                             'XTickLabel',[],        ...
  637.                             'YTickLabel',[],        ...
  638.                             'XTick',[],'YTick',[],  ...
  639.                             'NextPlot','Replace',   ...
  640.                             'Tag',tag_axecolmap     ...
  641.                             );
  642.             ud.dynvzaxe.enable = 'off';
  643. setappdata(out1(4),'WTBX_UserData',ud);
  644.         end
  645.         flg_vis = [flg_axe flg_axe(3)];
  646.         for k =1:4
  647.             if flg_vis(k)==0
  648.                 h = findobj(out1(k));
  649.                 set(h,'Visible','off');
  650.             else
  651.                 set(out1(k),'Visible','on','Position',pos_ax(k,:));
  652.             end
  653.         end
  654.     case 'del_ss'
  655.         lin_handles = findobj(axe_handles,'Type','line');
  656.         ss_app = findobj(lin_handles,'Tag',tag_ss_inapp);
  657.         ss_det = findobj(lin_handles,'Tag',tag_ss_indet);
  658.         delete([ss_app ss_det]);
  659.     case 'clear'
  660.         % in3 = 0 : clean 
  661.         %------------------
  662.         new_mode = in3;
  663.         okNew = dw1dvdrv('test_mode',win_dw1dtool,'scr',new_mode);
  664.         if okNew , dynvtool('stop',win_dw1dtool); end
  665.         set(findobj([axe_app_ini,axe_det_ini,axe_cfs_ini,axe_col_map]),...
  666.                 'visible','off');
  667.         if okNew==1
  668.             cleanaxe([axe_app_ini,axe_det_ini,axe_cfs_ini,axe_col_map]);
  669.             drawnow;
  670.         elseif okNew==2     % superimpose mode
  671.             old_app = findobj(axe_app_ini,'Tag',tag_app);
  672.             old_det = findobj(axe_det_ini,'Tag',tag_det);
  673.             delete([old_app;old_det]);
  674.         end
  675.     otherwise
  676.         errargt(mfilename,'Unknown Option','msg');
  677.         error('*');
  678. end
  679.