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

波变换

开发平台:

Matlab

  1. function out1 = dw2dmngr(option,win_dw2dtool,in3,in4,in5)
  2. %DW2DMNGR Discrete wavelet 2-D general manager.
  3. %   OUT1 = DW2DMNGR(OPTION,WIN_DW2DTOOL,IN3,IN4,IN5)
  4. %
  5. %   option = 'load_img'
  6. %   option = 'load_dec'
  7. %   option = 'load_cfs'
  8. %   option = 'demo'
  9. %   option = 'save_synt'
  10. %   option = 'save_cfs'
  11. %   option = 'save_dec'
  12. %   option = 'analyze'
  13. %   option = 'synthesize'
  14. %   option = 'step2'
  15. %   option = 'view_dec'
  16. %   option = 'select'
  17. %   option = 'view_mode'
  18. %   option = 'fullsize'
  19. %   option = 'return_comp'
  20. %   option = 'return_deno'
  21. %   option = 'set_graphic'
  22. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
  23. %   Last Revision: 16-Apr-2003.
  24. %   Copyright 1995-2004 The MathWorks, Inc.
  25. %   $Revision: 1.24.4.2 $ $Date: 2004/03/15 22:40:20 $
  26. % Get Globals.
  27. %-------------
  28. [Def_AxeFontSize,Terminal_Prop,Def_TxtBkColor] = ...
  29.     mextglob('get','Def_AxeFontSize','Terminal_Prop','Def_TxtBkColor');
  30. % Default values.
  31. %----------------
  32. max_lev_anal = 5;
  33. def_nbCodeOfColors = 255;
  34. % Image Coding Value.
  35. %-------------------
  36. codemat_v = wimgcode('get',win_dw2dtool);
  37. % Tag property of objects.
  38. %-------------------------
  39. tag_m_savesyn  = 'Save_Syn';
  40. tag_m_savecfs  = 'Save_Cfs';
  41. tag_m_savedec  = 'Save_Dec';
  42. tag_cmd_frame  = 'Cmd_Frame';
  43. tag_pus_anal   = 'Pus_Anal';
  44. tag_pus_deno   = 'Pus_Deno';
  45. tag_pus_comp   = 'Pus_Comp';
  46. tag_pus_hist   = 'Pus_Hist';
  47. tag_pus_stat   = 'Pus_Stat';
  48. tag_pop_declev = 'Pop_DecLev';
  49. tag_pus_visu   = 'Pus_Visu';
  50. tag_pus_big    = 'Pus_Big';
  51. tag_pus_rec    = 'Pus_Rec';
  52. tag_pop_viewm  = 'Pop_ViewM';
  53. tag_txt_full   = 'Txt_Full';
  54. tag_pus_full   = ['Pus_Full.1';'Pus_Full.2';'Pus_Full.3';'Pus_Full.4'];
  55. tag_btnaxeset  = 'Btn_Axe_Set';
  56. tag_axefigutil = 'Axe_FigUtil';
  57. tag_linetree   = 'Tree_lines';
  58. tag_txttree    = 'Tree_txt';
  59. tag_axeimgbig  = 'Axe_ImgBig';
  60. tag_axeimgini  = 'Axe_ImgIni';
  61. tag_axeimgvis  = 'Axe_ImgVis';
  62. tag_axeimgsel  = 'Axe_ImgSel';
  63. tag_axeimgdec  = 'Axe_ImgDec';
  64. tag_axeimgsyn  = 'Axe_ImgSyn';
  65. tag_axeimghdls = 'Img_Handles';
  66. tag_imgdec     = 'Img_Dec';
  67. % Memory Blocks of stored values.
  68. %================================
  69. % MB0.
  70. %-----
  71. n_InfoInit   = 'DW2D_InfoInit';
  72. ind_filename = 1;
  73. ind_pathname = 2;
  74. nb0_stored   = 2;
  75. % MB1.
  76. %-----
  77. n_param_anal   = 'DWAn2d_Par_Anal';
  78. ind_img_name   = 1;
  79. ind_wav_name   = 2;
  80. ind_lev_anal   = 3;
  81. ind_img_t_name = 4;
  82. ind_img_size   = 5;
  83. ind_nbcolors   = 6;
  84. ind_act_option = 7;
  85. ind_simg_type  = 8;
  86. ind_thr_val    = 9;
  87. nb1_stored     = 9;
  88. % MB2.1 and 2.2.
  89. %---------------
  90. n_coefs = 'MemCoefs';
  91. n_sizes = 'MemSizes';
  92. % MB3.
  93. %-----
  94. n_miscella      = 'DWAn2d_Miscella';
  95. ind_graph_area  =  1;
  96. ind_pos_axebig  =  2;
  97. ind_pos_axeini  =  3;
  98. ind_pos_axevis  =  4;
  99. ind_pos_axedec  =  5;
  100. ind_pos_axesyn  =  6;
  101. ind_pos_axesel  =  7;
  102. ind_view_status =  8;
  103. ind_save_status =  9;
  104. ind_sel_funct   = 10;
  105. nb3_stored      = 10;
  106. % Miscellaneous values.
  107. %----------------------
  108. square_viewm    = 1;
  109. tree_viewm      = 2;
  110. [Col_BoxAxeSel,Col_Selected,BoxTitleSel_Col] = wtbutils('colors','dw2d');
  111. Width_LineSel   = 3;
  112. % View Status
  113. %--------------------------------------------------------%
  114. % 'none' : init
  115. % 's_l*' : square        * = lev_dec (1 --> Level_Anal)
  116. % 'f1l*' : full ini      * = lev_dec (1 --> Level_Anal)
  117. % 'f2l*' : full syn      * = lev_dec (1 --> Level_Anal)
  118. % 'f3l*' : full vis      * = lev_dec (1 --> Level_Anal)
  119. % 'f4l*' : full dec      * = lev_dec (1 --> Level_Anal)
  120. % 'b*l*' : big
  121. %            first   * = index   (1 --> 4*Level_Anal)
  122. %            second  * = lev_dec (1 --> Level_Anal)
  123. % 't_l*' : tree          * = lev_dec (1 --> Level_Anal)
  124. %--------------------------------------------------------%
  125. % Handles of tagged objects.
  126. %---------------------------
  127. str_numwin  = sprintf('%.0f',win_dw2dtool);
  128. children    = get(win_dw2dtool,'Children');
  129. uic_handles = findobj(children,'flat','type','uicontrol');
  130. axe_handles = findobj(children,'flat','type','axes');
  131. txt_handles = findobj(uic_handles,'Style','text');
  132. pop_handles = findobj(uic_handles,'Style','popupmenu');
  133. pus_handles = findobj(uic_handles,'Style','pushbutton');
  134. m_files   = wfigmngr('getmenus',win_dw2dtool,'file');
  135. m_savesyn = findobj(m_files,'Tag',tag_m_savesyn);
  136. m_savecfs = findobj(m_files,'Tag',tag_m_savecfs);
  137. m_savedec = findobj(m_files,'Tag',tag_m_savedec);
  138. pus_anal   = findobj(pus_handles,'Tag',tag_pus_anal);
  139. pus_deno   = findobj(pus_handles,'Tag',tag_pus_deno);
  140. pus_comp   = findobj(pus_handles,'Tag',tag_pus_comp);
  141. pus_hist   = findobj(pus_handles,'Tag',tag_pus_hist);
  142. pus_stat   = findobj(pus_handles,'Tag',tag_pus_stat);
  143. pop_declev = findobj(pop_handles,'Tag',tag_pop_declev);
  144. pus_visu   = findobj(pus_handles,'Tag',tag_pus_visu);
  145. pus_big    = findobj(pus_handles,'Tag',tag_pus_big);
  146. pus_rec    = findobj(pus_handles,'Tag',tag_pus_rec);
  147. pop_viewm  = findobj(pop_handles,'Tag',tag_pop_viewm);
  148. txt_full   = findobj(txt_handles,'Tag',tag_txt_full);
  149. for k =1:size(tag_pus_full,1)
  150.     pus_full(k) = (findobj(pus_handles,'Tag',tag_pus_full(k,:)))';
  151. end
  152. Axe_ImgBig = findobj(axe_handles,'flat','Tag',tag_axeimgbig);
  153. Axe_ImgIni = findobj(axe_handles,'flat','Tag',tag_axeimgini);
  154. Axe_ImgVis = findobj(axe_handles,'flat','Tag',tag_axeimgvis);
  155. Axe_ImgSel = findobj(axe_handles,'flat','Tag',tag_axeimgsel);
  156. Axe_ImgSyn = findobj(axe_handles,'flat','Tag',tag_axeimgsyn);
  157. switch option
  158.     case 'load_img'
  159.         % Testing file.
  160.         %--------------
  161.         imgFileType = ['*.mat;*.bmp;*.hdf;*.jpg;' ...
  162.                 '*.jpeg;*.pcx;*.tif;*.tiff;*.gif'];
  163.         [imgInfos,img_anal,map,ok] = ...
  164.             utguidiv('load_img',win_dw2dtool, ...
  165.                 imgFileType,'Load Image',def_nbCodeOfColors);
  166.         if ~ok, return; end
  167.         % Cleaning.
  168.         %----------
  169.         wwaiting('msg',win_dw2dtool,'Wait ... cleaning');
  170.         dw2dutil('clean',win_dw2dtool,option);
  171.         % Setting Analysis parameters.
  172.         %-----------------------------
  173.         NB_ColorsInPal = size(map,1);
  174.         wmemtool('wmb',win_dw2dtool,n_param_anal,   ...
  175.                        ind_act_option,option,       ...
  176.        ind_img_name,imgInfos.name,  ...
  177.        ind_img_t_name,imgInfos.true_name, ...
  178.        ind_img_size,imgInfos.size,  ...
  179.                        ind_nbcolors,NB_ColorsInPal, ...
  180.                        ind_simg_type,'ss'           ...
  181.                        );
  182.         wmemtool('wmb',win_dw2dtool,n_InfoInit, ...
  183.        ind_filename,imgInfos.filename, ...
  184.        ind_pathname,imgInfos.pathname  ...
  185.                        );
  186.         % Setting GUI values.
  187.         %--------------------
  188.         levm   = wmaxlev(imgInfos.size,'haar');
  189.         levmax = min(levm,max_lev_anal);
  190.         if isequal(imgInfos.true_name,'X')
  191.             img_Name = imgInfos.name;
  192.         else
  193.         img_Name = imgInfos.true_name;
  194.         end
  195.         img_Size = imgInfos.size;
  196.         cbanapar('set',win_dw2dtool, ...
  197.             'n_s',{img_Name,img_Size}, ...
  198.             'lev',{'String',int2str([1:levmax]'),'Value',min(levmax,2)} ...
  199.             );
  200.         if imgInfos.self_map , arg = map; else , arg = []; end
  201.         cbcolmap('set',win_dw2dtool,'pal',{'pink',NB_ColorsInPal,'self',arg});
  202.         % Drawing axes.
  203.         %--------------
  204.         dw2dutil('pos_axe_init',win_dw2dtool,option);
  205.         % Drawing Original Image
  206.         %-----------------------
  207.         img_anal = wimgcode('cod',0,img_anal,NB_ColorsInPal,codemat_v);
  208.         image([1 img_Size(1)],[1 img_Size(2)],img_anal,'Parent',Axe_ImgIni);
  209.         wtitle('Original Image','Parent',Axe_ImgIni);
  210.         set(Axe_ImgIni,'Tag',tag_axeimgini)
  211.         % Setting enabled values.
  212.         %------------------------
  213.         dw2dutil('enable',win_dw2dtool,option);
  214.         % End waiting.
  215.         %-------------
  216.         wwaiting('off',win_dw2dtool);
  217.     case 'load_dec'
  218.         % Testing file.
  219.         %--------------
  220.          fileMask = {...
  221.                '*.wa2;*.mat' , 'Decomposition  (*.wa2;*.mat)';
  222.                '*.*','All Files (*.*)'};        
  223.         [filename,pathname,ok] = utguidiv('load_var',win_dw2dtool, ...
  224.                                    fileMask,'Load Wavelet Analysis (2D)',...
  225.                                    {'coefs','sizes','wave_name'});
  226.         if ~ok, return; end
  227.         % Loading file.
  228.         %--------------
  229.         load([pathname filename],'-mat');
  230.         if ~exist('map','var'), map = pink(def_nbCodeOfColors); end
  231.         if ~exist('data_name','var') , data_name = 'no name'; end
  232.         lev = size(sizes,1)-2;
  233.         if lev>max_lev_anal
  234.             msg = sprintf('The level of the decomposition nis too large (max = %.0f).', max_lev_anal);
  235.             wwarndlg(msg,'Load Wavelet Analysis (2D)','block');
  236.             return  
  237.         end
  238.         % Cleaning.
  239.         %----------
  240.         wwaiting('msg',win_dw2dtool,'Wait ... cleaning');
  241.         dw2dutil('clean',win_dw2dtool,option);
  242.         % Getting Analysis parameters.
  243.         %-----------------------------
  244.         s_img          = size(sizes);
  245.         Img_Size       = fliplr(sizes(s_img(1),:));
  246.         Level_Anal     = s_img(1)-2;
  247.         NB_ColorsInPal = size(map,1);
  248.         % Setting coefs and sizes.
  249.         %-------------------------
  250.         wmemtool('wmb',win_dw2dtool,n_coefs,1,coefs);
  251.         wmemtool('wmb',win_dw2dtool,n_sizes,1,sizes);
  252.         % Setting GUI values.
  253.         %--------------------
  254.         levm   = wmaxlev(Img_Size,'haar');
  255.         levmax = min(levm,max_lev_anal);
  256.         cbanapar('set',win_dw2dtool, ...
  257.                  'n_s',{data_name,Img_Size},'wav',wave_name, ...
  258.                  'lev',{'String',int2str([1:levmax]'),'Value',Level_Anal});
  259.         levels = int2str([1:Level_Anal]');
  260.         set(pop_declev,'String',levels,'Value',Level_Anal);
  261.         pink_map = pink(NB_ColorsInPal);
  262.         self_map = max(max(abs(map-pink_map)));
  263.         if self_map , arg = map; else , arg = []; end
  264.         cbcolmap('set',win_dw2dtool,'pal',{'pink',NB_ColorsInPal,'self',arg});
  265.         % Setting Analysis parameters.
  266.         %-----------------------------
  267.         wmemtool('wmb',win_dw2dtool,n_param_anal,   ...
  268.                        ind_act_option,option,       ...
  269.                        ind_wav_name,wave_name,      ...
  270.                        ind_lev_anal,Level_Anal,     ...
  271.                        ind_img_name,data_name,      ...
  272.                        ind_img_t_name,'',           ...
  273.                        ind_img_size,Img_Size,       ...
  274.                        ind_nbcolors,NB_ColorsInPal, ...
  275.                        ind_simg_type,'ss'           ...
  276.                        );
  277.         wmemtool('wmb',win_dw2dtool,n_InfoInit, ...
  278.                        ind_filename,filename,   ...
  279.                        ind_pathname,pathname    ...
  280.                        );
  281.         % Drawing axes.
  282.         %--------------
  283.         dw2dutil('pos_axe_init',win_dw2dtool,option);
  284.         % Calling Analysis
  285.         %-----------------
  286.         dw2dmngr('step2',win_dw2dtool,option);
  287.         % Computing Original Image.
  288.         %--------------------------
  289.         X = appcoef2(coefs,sizes,wave_name,0);
  290.         % Drawing Original Image
  291.         %-----------------------
  292.         X = wimgcode('cod',0,X,NB_ColorsInPal,codemat_v);
  293.         image([1 Img_Size(1)],[1,Img_Size(2)],X,'Parent',Axe_ImgIni);
  294.         wtitle('Reconstructed Image','Parent',Axe_ImgIni);
  295.         set(Axe_ImgIni,'Tag',tag_axeimgini)
  296.         image([1 Img_Size(1)],[1 Img_Size(2)],X,'Parent',Axe_ImgSyn);
  297.         set(Axe_ImgSyn,...
  298.             'XTicklabelMode','manual', ...
  299.             'YTicklabelMode','manual', ...
  300.             'XTicklabel',[],           ...
  301.             'YTicklabel',[],           ...
  302.             'Box','On',                ...
  303.             'Tag',tag_axeimgsyn        ...
  304.             );
  305.         wtitle('Synthesized Image','Parent',Axe_ImgSyn);
  306.         % Setting enabled values.
  307.         %------------------------
  308.         dw2dutil('enable',win_dw2dtool,option);
  309.         % End waiting.
  310.         %-------------
  311.         wwaiting('off',win_dw2dtool);
  312.     case 'load_cfs'
  313.         % in3 = 'new_synt' (optional).
  314.         %----------------------------
  315.         if nargin==2
  316.             % Testing file.
  317.             %--------------
  318.             [filename,pathname,ok] = utguidiv('load_var',win_dw2dtool,  ...
  319.                                        '*.mat','Load Coefficients (2D)',...
  320.                                        {'coefs','sizes'});
  321.             if ~ok, return; end
  322.             % Loading file.
  323.             %--------------
  324.             load([pathname filename],'-mat');
  325.             lev = size(sizes,1)-2;
  326.             if lev>max_lev_anal
  327.                 msg = sprintf(...
  328.    'The level of the decomposition nis too large (max = %d).',max_lev_anal);
  329.                 wwarndlg(msg,'Load Coefficients (2D)','block');
  330.                 return  
  331.             end
  332.             in3 = '';
  333.             [Img_Name,ext] = strtok(filename,'.');
  334.             % Cleaning.
  335.             %----------
  336.             wwaiting('msg',win_dw2dtool,'Wait ... cleaning');
  337.             dw2dutil('clean',win_dw2dtool,option);
  338.             % Getting Analysis parameters.
  339.             %-----------------------------
  340.             s_img      = size(sizes);
  341.             Img_Size   = fliplr(sizes(s_img(1),:));
  342.             Level_Anal = s_img(1)-2;
  343.             % Setting coefs and sizes.
  344.             %-------------------------
  345.             wmemtool('wmb',win_dw2dtool,n_coefs,1,coefs);
  346.             wmemtool('wmb',win_dw2dtool,n_sizes,1,sizes);
  347.             % Setting GUI values.
  348.             %--------------------
  349.             cbanapar('set',win_dw2dtool, ...
  350.                'n_s',{Img_Name,Img_Size}, ...
  351.                'lev',{'String',int2str(Level_Anal),'Value',1} ...
  352.                );
  353.             levels = int2str([1:Level_Anal]');
  354.             set(pop_declev,'String',levels,'Value',Level_Anal);
  355.             % Computing (approximate) colormap.
  356.             %----------------------------------
  357.             tmp = appcoef2(coefs,sizes,'haar',Level_Anal);
  358.             NB_ColorsInPal = ceil(max(max(tmp))/(2^Level_Anal));
  359.             NB_ColorsInPal = min([max([2,NB_ColorsInPal]),def_nbCodeOfColors]);
  360.             cbcolmap('set',win_dw2dtool,'pal',{'pink',NB_ColorsInPal});
  361.             % Setting Analysis parameters.
  362.             %-----------------------------
  363.             wmemtool('wmb',win_dw2dtool,n_param_anal,   ...
  364.                            ind_act_option,option,       ...
  365.                            ind_lev_anal,Level_Anal,     ...
  366.                            ind_img_size,Img_Size,       ...
  367.                            ind_img_name,Img_Name,       ...
  368.                            ind_nbcolors,NB_ColorsInPal, ...
  369.                            ind_simg_type,'ss'           ...
  370.                            );
  371.             wmemtool('wmb',win_dw2dtool,n_InfoInit, ...
  372.                            ind_filename,filename,   ...
  373.                            ind_pathname,pathname    ...
  374.                            );
  375.         else
  376.             % Cleaning.
  377.             %----------
  378.             wwaiting('msg',win_dw2dtool,'Wait ... cleaning');
  379.             dw2dutil('clean',win_dw2dtool,option,in3);
  380.         end
  381.         % Drawing axes.
  382.         %--------------
  383.         dw2dutil('pos_axe_init',win_dw2dtool,option);
  384.         % Calling Analysis
  385.         %-----------------
  386.         dw2dmngr('step2',win_dw2dtool,option);
  387.         % Setting enabled values.
  388.         %------------------------
  389.         dw2dutil('enable',win_dw2dtool,option);
  390.         % End waiting.
  391.         %-------------
  392.         wwaiting('off',win_dw2dtool);
  393.     case 'demo'
  394.         Img_Name   = deblank(in3);
  395.         Wave_Name  = deblank(in4);
  396.         Level_Anal = in5;
  397.         % Loading file.
  398.         %--------------
  399.         filename = [Img_Name '.mat'];
  400.         pathname = utguidiv('WTB_DemoPath',filename);
  401.         [imgInfos,img_anal,map,ok] = utguidiv('load_dem2D',win_dw2dtool, ...
  402.                                        pathname,filename,def_nbCodeOfColors);
  403.         if ~ok, return; end
  404.         % Cleaning.
  405.         %----------
  406.         wwaiting('msg',win_dw2dtool,'Wait ... cleaning');
  407.         dw2dutil('clean',win_dw2dtool,option);
  408.         % Setting GUI values.
  409.         %--------------------
  410.         NB_ColorsInPal = size(map,1);
  411.         if isequal(imgInfos.true_name,'X')
  412.             img_Name = imgInfos.name;
  413.         else
  414.             img_Name = imgInfos.true_name;
  415.         end
  416.         cbanapar('set',win_dw2dtool, ...
  417.             'n_s',{img_Name,imgInfos.size}, ...
  418.             'wav',Wave_Name, ...
  419.             'lev',Level_Anal ...
  420.             );
  421.         levels = int2str([1:Level_Anal]');
  422.         set(pop_declev,'String',levels,'Value',Level_Anal);
  423.         if imgInfos.self_map , arg = map; else , arg = []; end
  424.         cbcolmap('set',win_dw2dtool,'pal',{'pink',NB_ColorsInPal,'self',arg});
  425.         % Setting Analysis parameters
  426.         %-----------------------------
  427.         NB_ColorsInPal = size(map,1);
  428.         wmemtool('wmb',win_dw2dtool,n_param_anal,  ...
  429.                        ind_act_option,option,      ...
  430.                        ind_img_name,imgInfos.name, ...
  431.                        ind_wav_name,Wave_Name,     ...
  432.                        ind_lev_anal,Level_Anal,    ...
  433.                        ind_img_t_name,imgInfos.true_name, ...
  434.                        ind_img_size,imgInfos.size, ...
  435.                        ind_nbcolors,NB_ColorsInPal,...
  436.                        ind_simg_type,'ss'          ...
  437.                        );
  438.         wmemtool('wmb',win_dw2dtool,n_InfoInit, ...
  439.                        ind_filename,imgInfos.filename, ...
  440.                        ind_pathname,imgInfos.pathname  ...
  441.                        );
  442.         % Drawing axes.
  443.         %--------------
  444.         dw2dutil('pos_axe_init',win_dw2dtool,option);
  445.         % Drawing Original Image
  446.         %-----------------------
  447.         X = wimgcode('cod',0,img_anal,NB_ColorsInPal,codemat_v);
  448.         image([1 imgInfos.size(1)],[1,imgInfos.size(2)],X,...
  449.                 'Parent',Axe_ImgIni);
  450.         wtitle('Original Image','Parent',Axe_ImgIni);
  451.         set(Axe_ImgIni,'Tag',tag_axeimgini)
  452.         % Calling Analysis.
  453.         %-----------------
  454.         dw2dmngr('step2',win_dw2dtool,option);
  455.         % Setting enabled values.
  456.         %------------------------
  457.         dw2dutil('enable',win_dw2dtool,option);
  458.         % End waiting.
  459.         %-------------
  460.         wwaiting('off',win_dw2dtool);
  461.     case 'save_synt'
  462.         % Testing file.
  463.         %--------------        
  464.         [filename,pathname,ok] = utguidiv('test_save',win_dw2dtool, ...
  465.                                      '*.mat','Save Synthesized Image');
  466.         if ~ok, return; end
  467.         % Begin waiting.
  468.         %--------------
  469.         wwaiting('msg',win_dw2dtool,'Wait ... saving');
  470.         % Getting Analysis values.
  471.         %-------------------------
  472.         [wname,valTHR] = wmemtool('rmb',win_dw2dtool,n_param_anal, ...
  473.                                   ind_wav_name,ind_thr_val);
  474.         map = cbcolmap('get',win_dw2dtool,'self_pal');
  475.         if isempty(map)
  476.             nb_colors = wmemtool('rmb',win_dw2dtool,n_param_anal,ind_nbcolors);
  477.             map = pink(nb_colors);
  478.         end
  479.         % Getting Synthesized Image.
  480.         %---------------------------
  481.         img = dw2drwcd('r_synt',win_dw2dtool);
  482.         X = round(get(img,'Cdata'));
  483.         % Saving file.
  484.         %--------------
  485.         [name,ext] = strtok(filename,'.');
  486.         if isempty(ext) | isequal(ext,'.')
  487.             ext = '.mat'; filename = [name ext];
  488.         end
  489.         saveStr = {'X','map','valTHR','wname'};
  490.         wwaiting('off',win_dw2dtool);
  491.         try
  492.           save([pathname filename],saveStr{:});
  493.         catch
  494.           errargt(mfilename,'Save FAILED !','msg');
  495.         end
  496.     case 'save_cfs'
  497.         % Testing file.
  498.         %--------------
  499.         [filename,pathname,ok] = utguidiv('test_save',win_dw2dtool, ...
  500.                                      '*.mat','Save Coefficients (2D)');
  501.         if ~ok, return; end
  502.         % Begin waiting.
  503.         %--------------
  504.         wwaiting('msg',win_dw2dtool,'Wait ... saving coefficients');
  505.         % Getting Analysis values.
  506.         %-------------------------
  507.         [wname,valTHR] = wmemtool('rmb',win_dw2dtool,n_param_anal, ...
  508.                                   ind_wav_name,ind_thr_val);
  509.         map = cbcolmap('get',win_dw2dtool,'self_pal');
  510.         if isempty(map)
  511.             nb_colors = wmemtool('rmb',win_dw2dtool,n_param_anal,ind_nbcolors);
  512.             map = pink(nb_colors);
  513.         end
  514.         coefs = wmemtool('rmb',win_dw2dtool,n_coefs,1);
  515.         sizes = wmemtool('rmb',win_dw2dtool,n_sizes,1);
  516.         % Saving file.
  517.         %--------------
  518.         [name,ext] = strtok(filename,'.');
  519.         if isempty(ext) | isequal(ext,'.')
  520.             ext = '.mat'; filename = [name ext];
  521.         end
  522.         saveStr = {'coefs','sizes','map','valTHR','wname'};
  523.         wwaiting('off',win_dw2dtool);
  524.         try
  525.           save([pathname filename],saveStr{:});
  526.         catch
  527.           errargt(mfilename,'Save FAILED !','msg');
  528.         end
  529.     case 'save_dec'
  530.         % Testing file.
  531.         %--------------
  532.          fileMask = {...
  533.                '*.wa2;*.mat' , 'Decomposition  (*.wa2;*.mat)';
  534.                '*.*','All Files (*.*)'};                
  535.         [filename,pathname,ok] = utguidiv('test_save',win_dw2dtool, ...
  536.                                      fileMask,'Save Wavelet Analysis (2D)');
  537.         if ~ok, return; end
  538.         % Begin waiting.
  539.         %--------------
  540.         wwaiting('msg',win_dw2dtool,'Wait ... saving decomposition');
  541.         % Getting Analysis parameters.
  542.         %-----------------------------
  543.         [wave_name,data_name,level_anal,nb_colors,valTHR] = ...
  544.                 wmemtool('rmb',win_dw2dtool,n_param_anal, ...
  545.                                ind_wav_name, ...
  546.                                ind_img_name, ...
  547.                                ind_lev_anal, ...
  548.                                ind_nbcolors, ...
  549.                                ind_thr_val   ...
  550.                                );
  551.         map = cbcolmap('get',win_dw2dtool,'self_pal');
  552.         if isempty(map) , map = pink(nb_colors); end
  553.         coefs = wmemtool('rmb',win_dw2dtool,n_coefs,1);
  554.         sizes = wmemtool('rmb',win_dw2dtool,n_sizes,1);
  555.         % Saving file.
  556.         %--------------
  557.         [name,ext] = strtok(filename,'.');
  558.         if isempty(ext) | isequal(ext,'.')
  559.             ext = '.wa2'; filename = [name ext];
  560.         end
  561.         saveStr = {'coefs','sizes','wave_name','map','valTHR','data_name'};
  562.         wwaiting('off',win_dw2dtool);
  563.         try
  564.           save([pathname filename],saveStr{:});
  565.         catch
  566.           errargt(mfilename,'Save FAILED !','msg');
  567.         end
  568.     case 'analyze'
  569.         active_option = wmemtool('rmb',win_dw2dtool,n_param_anal,ind_act_option);        
  570.         if ~strcmp(active_option,'load_img')
  571.             wwaiting('msg',win_dw2dtool,'Wait ... computing');
  572.             dw2dutil('clean2',win_dw2dtool,option);
  573.             wmemtool('wmb',win_dw2dtool,n_param_anal,ind_simg_type,'ss');
  574.         end
  575.         % Reading Analysis Parameters.
  576.         %----------------------------
  577.         [Wave_Name,Level_Anal] = cbanapar('get',win_dw2dtool,'wav','lev');
  578.         % Setting GUI values.
  579.         %--------------------
  580.         levels = int2str([1:Level_Anal]');
  581.         set(pop_declev,'String',levels,'Value',Level_Anal);
  582.         % Setting Analysis parameters.
  583.         %-----------------------------
  584.         wmemtool('wmb',win_dw2dtool,n_param_anal, ...
  585.                        ind_act_option,option,  ...
  586.                        ind_wav_name,Wave_Name, ...
  587.                        ind_lev_anal,Level_Anal ...
  588.                        );
  589.         % Calling Analysis.
  590.         %------------------
  591.         dw2dmngr('step2',win_dw2dtool,option);
  592.         % Setting enabled values.
  593.         %------------------------
  594.         dw2dutil('enable',win_dw2dtool,option);
  595.     case 'synthesize'
  596.         active_option = wmemtool('rmb',win_dw2dtool,n_param_anal,ind_act_option);
  597.         if ~strcmp(active_option,'load_cfs')
  598.             wwaiting('msg',win_dw2dtool,'Wait ... computing');
  599.             dw2dmngr('load_cfs',win_dw2dtool,'new_synt');
  600.         end
  601.         % Begin waiting.
  602.         %--------------
  603.         wwaiting('msg',win_dw2dtool,'Wait ... computing');
  604.         % Reading Analysis Parameters.
  605.         %----------------------------
  606.         Wave_Name  = cbanapar('get',win_dw2dtool,'wav');
  607.         % Getting & Setting Analysis parameters.
  608.         %---------------------------------------
  609.         [Img_Size,NB_ColorsInPal,Level_Anal] = ...
  610.                 wmemtool('rmb',win_dw2dtool,n_param_anal, ...
  611.                                ind_img_size, ...
  612.                                ind_nbcolors, ...
  613.                                ind_lev_anal  ...
  614.                                );
  615.         wmemtool('wmb',win_dw2dtool,n_param_anal, ...
  616.                        ind_act_option,option, ...
  617.                        ind_wav_name,Wave_Name ...
  618.                        );
  619.         % Setting GUI values.
  620.         %--------------------
  621.         cbanapar('set',win_dw2dtool, ...
  622.             'lev',{'String',sprintf('%.0f',Level_Anal)});
  623.         levels  = int2str([1:Level_Anal]');
  624.         set(pop_declev,'String',levels,'Value',Level_Anal);
  625.         % Getting Analysis values.
  626.         %-------------------------
  627.         coefs = wmemtool('rmb',win_dw2dtool,n_coefs,1);
  628.         sizes = wmemtool('rmb',win_dw2dtool,n_sizes,1);
  629.         % Getting Select Function.
  630.         %------------------------
  631.         [view_status,select_funct] = wmemtool('rmb',win_dw2dtool,n_miscella,...
  632.                                         ind_view_status,ind_sel_funct);
  633.         % Setting axes properties.
  634.         %-------------------------
  635.         Axe_ImgDec  = wmemtool('rmb',win_dw2dtool,tag_axeimgdec,1);
  636.         Axe_ImgDec  = Axe_ImgDec(1:4*Level_Anal);
  637.         Img_Handles = wmemtool('rmb',win_dw2dtool,tag_axeimghdls,1);
  638.         % Computing Synthesized Image.
  639.         %-----------------------------
  640.         view_mode = view_status(1);
  641.         for k=Level_Anal-1:-1:1
  642.             X = appcoef2(coefs,sizes,Wave_Name,k);
  643.             if (k~=Level_Anal) & ( view_mode=='s' | view_mode=='f')
  644.                 vis = 'Off';
  645.             else
  646.                 vis = 'On';
  647.             end
  648.             num_img = 4*k;
  649.             axeAct  = Axe_ImgDec(num_img);
  650.             axes(axeAct)
  651.             %--------------------------------%
  652.             %-   k = level ;
  653.             %-   m = 1 : v ;    m = 2 : d ;         
  654.             %-   m = 3 : h ;    m = 4 : a ; 
  655.             %--------------------------------%
  656.             trunc_p = [k Img_Size(2) Img_Size(1)];
  657.             X = wimgcode('cod',1,X,NB_ColorsInPal,codemat_v,trunc_p);
  658.             Img_Handles(num_img) = ...
  659.                             image([1 Img_Size(1)],[1,Img_Size(2)],X,...
  660.                                     'Parent',axeAct,...
  661.                                     'Visible',vis,...
  662.                                     'UserData',[0;k;4],...
  663.                                     'Tag',tag_imgdec,...
  664.                                     'ButtonDownFcn',select_funct...
  665.                                     );
  666.             set(axeAct, ...
  667.                   'Visible',vis,                   ...
  668.                   'Xcolor',Col_BoxAxeSel,          ...
  669.                   'Ycolor',Col_BoxAxeSel,          ...
  670.                   'XTicklabelMode','manual',       ...
  671.                   'YTicklabelMode','manual',       ...
  672.                   'XTicklabel',[],'YTicklabel',[], ...
  673.                   'XTick',[],'YTick',[],           ...
  674.                   'Box','On',                      ...
  675.                   'Tag',tag_axeimgdec              ...
  676.                   );
  677.         end
  678.         wmemtool('wmb',win_dw2dtool,tag_axeimghdls,1,Img_Handles);
  679.         % Drawing Synthesized Image.
  680.         %--------------------------
  681.         X = appcoef2(coefs,sizes,Wave_Name,0);
  682.         X = wimgcode('cod',0,X,NB_ColorsInPal,codemat_v);
  683.         if (view_mode=='f') , vis = 'Off'; else , vis = 'On'; end
  684.         axes(Axe_ImgIni);
  685.         image([1 Img_Size(1)],[1 Img_Size(2)],X, ...
  686.                 'Visible',vis,'Parent',Axe_ImgIni);
  687.         set(Axe_ImgIni,'Visible',vis,'Tag',tag_axeimgini);
  688.         wtitle('Original Synthesized Image','Parent',Axe_ImgIni);
  689.         axes(Axe_ImgSyn);
  690.         image([1 Img_Size(1)],[1 Img_Size(2)],X, ...
  691.                 'Visible',vis,'Parent',Axe_ImgSyn);
  692.         set(Axe_ImgSyn,'Visible',vis,'Tag',tag_axeimgsyn);
  693.         wtitle('Synthesized Image','Parent',Axe_ImgSyn);
  694.         delete(findobj(Axe_ImgVis,'Type','image'));
  695.         % Setting enabled values.
  696.         %------------------------
  697.         dw2dutil('enable',win_dw2dtool,option);
  698.         % End waiting.
  699.         %-------------
  700.         wwaiting('off',win_dw2dtool);
  701.     case 'step2'
  702.         %*****************************************************%
  703.         %** OPTION = 'step2' - (load_dec & demo & analyze)  **%
  704.         %*****************************************************%
  705.         % in3 = calling option
  706.         %---------------------
  707.         % Getting  Analysis parameters.
  708.         %------------------------------
  709.         [Img_Name,Img_Size,...
  710.          NB_ColorsInPal,Wave_Name,Level_Anal] = ...
  711.                  wmemtool('rmb',win_dw2dtool,n_param_anal, ...
  712.                                 ind_img_name, ...
  713.                                 ind_img_size, ...
  714.                                 ind_nbcolors, ...
  715.                                 ind_wav_name, ...
  716.                                 ind_lev_anal  ...
  717.                                 );
  718.         % Setting axes properties.
  719.         %-------------------------
  720.         Axe_ImgDec = wmemtool('rmb',win_dw2dtool,tag_axeimgdec,1);
  721.         set(Axe_ImgDec,'Visible','Off');
  722.         Axe_ImgDec = Axe_ImgDec(1:4*Level_Anal);
  723.         indVis = [1:4*Level_Anal];
  724.         indVis = [indVis(mod(indVis,4)~=0),indVis(end)];
  725.         set(Axe_ImgDec(indVis),'Visible','On');
  726.         % Getting Select Function.
  727.         %------------------------
  728.         select_funct = wmemtool('rmb',win_dw2dtool,n_miscella,ind_sel_funct);
  729.         % Begin waiting.
  730.         %---------------
  731.         wwaiting('msg',win_dw2dtool,'Wait ... computing');
  732.         % Computing.
  733.         %-----------
  734.         if strcmp(in3,'demo') | strcmp(in3,'analyze')
  735.             img_anal      = get(dw2drwcd('r_orig',win_dw2dtool),'Cdata');
  736.             [coefs,sizes] = wavedec2(img_anal,Level_Anal,Wave_Name);
  737.             clear img_anal
  738.             % Setting coefs and sizes.
  739.             %-------------------------
  740.             wmemtool('wmb',win_dw2dtool,n_coefs,1,coefs);
  741.             wmemtool('wmb',win_dw2dtool,n_sizes,1,sizes);
  742.         else
  743.             % Getting Analysis values.
  744.             %-------------------------
  745.             coefs = wmemtool('rmb',win_dw2dtool,n_coefs,1);
  746.             sizes = wmemtool('rmb',win_dw2dtool,n_sizes,1);
  747.         end
  748.         
  749.         % App flag.
  750.         %----------
  751.         if strcmp(in3,'load_cfs') | strcmp(in3,'new_synt')
  752.             app_flg = 0;
  753.         else
  754.             app_flg = 1;
  755.         end
  756.         % Decomposition drawing
  757.         %----------------------
  758.         size0 = sizes(1,:);
  759.         Img_Handles = zeros(1,4*Level_Anal);
  760.         for k=1:Level_Anal
  761.             for m=1:4
  762.                 switch m
  763.                     case 1 , Y = detcoef2('v',coefs,sizes,k);
  764.                     case 2 , Y = detcoef2('d',coefs,sizes,k);
  765.                     case 3 , Y = detcoef2('h',coefs,sizes,k);
  766.                     case 4
  767.                         if app_flg | k==Level_Anal
  768.                             Y = appcoef2(coefs,sizes,Wave_Name,k);
  769.                         else
  770.                             Y = zeros(size(Y));
  771.                         end
  772.                    otherwise , error('*');
  773.                 end
  774.                 if (m==4) & (k~=Level_Anal)
  775.                     vis = 'Off'; 
  776.                 else
  777.                     vis = 'On'; 
  778.                 end
  779.                 num_img = 4*(k-1)+m;
  780.                 axeAct  = Axe_ImgDec(num_img);
  781.                 axes(axeAct)
  782.                 %-------------------------------%
  783.                 %-   k = level ;
  784.                 %-   m = 1 : v ;   m = 2 : d ;         
  785.                 %-   m = 3 : h ;   m = 4 : a ; 
  786.                 %-------------------------------%
  787.                 trunc_p = [k Img_Size(2) Img_Size(1)];
  788.                 Y = wimgcode('cod',1,Y,NB_ColorsInPal,codemat_v,trunc_p);
  789.                 Img_Handles(num_img) = ...
  790.                         image([1 Img_Size(1)],[1 Img_Size(2)],Y,...
  791.                               'Parent',axeAct,             ...
  792.                               'Visible',vis,               ...
  793.                               'UserData',[0;k;m],          ...
  794.                               'Tag',tag_imgdec,            ...
  795.                               'ButtonDownFcn',select_funct ...
  796.                               );
  797.                 set(axeAct,...
  798.                     'Visible',vis,                    ...
  799.                     'Xcolor',Col_BoxAxeSel,           ...
  800.                     'Ycolor',Col_BoxAxeSel,           ...
  801.                     'XTicklabelMode','manual',        ...
  802.                     'YTicklabelMode','manual',        ...
  803.                     'XTicklabel',[],'YTicklabel',[],  ...
  804.                     'XTick',[],'YTick',[],'Box','On', ...
  805.                     'Tag',tag_axeimgdec               ...
  806.                     );
  807.             end
  808.         end
  809.         wmemtool('wmb',win_dw2dtool,tag_axeimghdls,1,Img_Handles);
  810.         % Decomposition Title.
  811.         %---------------------
  812.         wsetxlab(Axe_ImgSel,sprintf('Decomposition at level %.0f',Level_Anal));
  813.         % Synthesized Image (same that original).
  814.         %----------------------------------------
  815.         if strcmp(in3,'demo') | strcmp(in3,'analyze')
  816.             X      = appcoef2(coefs,sizes,Wave_Name,0);
  817.             X      = wimgcode('cod',0,X,NB_ColorsInPal,codemat_v);
  818.             gx     = get(Axe_ImgSyn,'Xgrid');
  819.             gy     = get(Axe_ImgSyn,'Ygrid');
  820.             strtit = get(get(Axe_ImgSyn,'title'),'String');
  821.             image([1 Img_Size(1)],[1 Img_Size(2)],X,'Parent',Axe_ImgSyn);
  822.             set(Axe_ImgSyn,...
  823.                 'Visible','On',           ...
  824.                 'Xgrid',gx,'Ygrid',gy,    ...
  825.                 'XTicklabelMode','manual',...
  826.                 'YTicklabelMode','manual',...
  827.                 'XTicklabel',[],          ...
  828.                 'YTicklabel',[],          ...
  829.                 'Box','On',               ...
  830.                 'Tag',tag_axeimgsyn       ...
  831.                 );
  832.             wtitle(strtit,'Parent',Axe_ImgSyn);
  833.         end
  834.         % Setting Dynamic Visualization tool.
  835.         %------------------------------------
  836.         dynvtool('init',win_dw2dtool,...
  837.                         [],...
  838.                         [Axe_ImgIni Axe_ImgBig Axe_ImgSyn Axe_ImgVis],...
  839.                         [Axe_ImgDec],...
  840.                         [1 1],'','','','int');
  841.         % Setting view_status.
  842.         %---------------------
  843.         view_status = ['s_l' sprintf('%.0f',Level_Anal)];
  844.         wmemtool('wmb',win_dw2dtool,n_miscella, ...
  845.                        ind_view_status,view_status,...
  846.                        ind_save_status,view_status ...
  847.                        );
  848.         % End waiting.
  849.         %-------------
  850.         wwaiting('off',win_dw2dtool);
  851.     case 'view_dec'
  852.         %**********************************************%
  853.         %** OPTION = 'view_dec' - view decomposition **%
  854.         %**********************************************%
  855.         % Getting position parameters.
  856.         %-----------------------------
  857.         [view_status,save_status] = ...
  858.                 wmemtool('rmb',win_dw2dtool,n_miscella, ...
  859.                                ind_view_status,ind_save_status ...
  860.                                );
  861.         new_lev_view = get(pop_declev,'Value');
  862.         k = findstr(view_status,'l');
  863.         lev_old = wstr2num(view_status(k+1:length(view_status)));
  864.         if new_lev_view==lev_old , return; end
  865.         dw2dimgs('cleanif',win_dw2dtool,new_lev_view,lev_old);
  866.         view_status = [view_status(1:k) sprintf('%.0f',new_lev_view)];
  867.         wmemtool('wmb',win_dw2dtool,n_miscella,ind_view_status,view_status);
  868.         % Begin waiting.
  869.         %--------------
  870.         wwaiting('msg',win_dw2dtool,'Wait ... drawing');
  871.         % Drawing.
  872.         %---------
  873.         dw2dmngr('set_graphic',win_dw2dtool,option);
  874.         % End waiting.
  875.         %-------------
  876.         wwaiting('off',win_dw2dtool);
  877.     case 'select'
  878.         % Getting active option.
  879.         %------------------------
  880.         active_option = wmemtool('rmb',win_dw2dtool,n_param_anal,ind_act_option);
  881.         Drag_Tools = [pus_visu,pus_big,pus_rec];
  882.         if nargin==3 , in4 = 0; end
  883.         if strcmp(in3,'end_big')
  884.             % End Big Image.
  885.             %---------------
  886.             dw2dmngr('set_graphic',win_dw2dtool,option,'end');
  887.             handles = [pus_anal, pop_declev, pus_visu, ...
  888.                        pus_rec,  pop_viewm,  pus_full  ...
  889.                        ];
  890.             set(handles,'Enable','On');
  891.             cba_pus_big  = ['dw2dmngr(''select'','  ...
  892.                             str_numwin ','  ...
  893.                             num2mstr(pus_big) ');'];
  894.             bk_col = get(pus_visu,'BackGroundColor');
  895.             set(pus_big,...
  896.                     'String',xlate('Full Size'),     ...
  897.                     'BackGroundColor',bk_col, ...
  898.                     'Callback',cba_pus_big    ...
  899.                     );
  900.             val = get(pop_viewm,'Value');
  901.             if (val==square_viewm)
  902.                 dw2darro('vis_arrow',win_dw2dtool,'on');
  903.             end
  904.             ind = 0;
  905.     dynvtool('dynvzaxe_BtnOnOff',win_dw2dtool,'On')
  906.         else
  907.             obj_sel = dw2dimgs('get',win_dw2dtool);
  908.             if ~isempty(obj_sel)
  909.                 ind = find(in3==Drag_Tools);
  910.             else
  911.                 ind = 0;
  912.             end
  913.         end
  914.         if ind~=0
  915.             % Getting  Analysis parameters.
  916.             %------------------------------
  917.             if strcmp(get(Drag_Tools(ind),'Enable'),'off') , return; end
  918.             Img_Handles = wmemtool('rmb',win_dw2dtool,tag_axeimghdls,1);
  919.             indimg      = find(Img_Handles==obj_sel);
  920.             if isempty(indimg) , return; end
  921.             % Begin waiting.
  922.             %--------------
  923.             wwaiting('msg',win_dw2dtool,'Wait ... computing');
  924.             [Img_Size,Wave_Name,Level_Anal] = ...
  925.                     wmemtool('rmb',win_dw2dtool,n_param_anal, ...
  926.                                    ind_img_size, ...
  927.                                    ind_wav_name, ...
  928.                                    ind_lev_anal  ...
  929.                                    );
  930.             Axe_ImgDec = wmemtool('rmb',win_dw2dtool,tag_axeimgdec,1);
  931.             Axe_ImgDec = Axe_ImgDec(1:4*Level_Anal);
  932.             % Computing.
  933.             %----------------------------%
  934.             %-   m = 1 : v ;   m = 2 : d ;             
  935.             %-   m = 3 : h ;   m = 4 : a ;     
  936.             %----------------------------%
  937.             us = get(Img_Handles(indimg),'UserData');
  938.             us = get(obj_sel,'UserData');
  939.             level = us(2,:);
  940.             m     = us(3,:);
  941.             str_lev = sprintf('%.0f',level);
  942.             switch m
  943.               case 1 , opt = 'v'; typestr = 'Vertical detail';
  944.               case 2 , opt = 'd'; typestr = 'Diagonal detail';
  945.               case 3 , opt = 'h'; typestr = 'Horizontal detail';
  946.               case 4 , opt = 'a'; typestr = 'Approximation';
  947.             end
  948.             switch ind
  949.                 case {1,2}    %-- Visualize or big image
  950.                     X = get(obj_sel,'CData');
  951.                     strxlab = [typestr ' coef. at level ' str_lev];
  952.                     axe = get(obj_sel,'Parent');
  953.                     xl = get(axe,'Xlim');
  954.                     yl = get(axe,'Ylim');
  955.                 case 3   %-- Reconstruction
  956.                     NB_ColorsInPal = wmemtool('rmb',win_dw2dtool, ...
  957.                                                     n_param_anal,  ...
  958.                                                     ind_nbcolors   ...
  959.                                                     );
  960.                     coefs = wmemtool('rmb',win_dw2dtool,n_coefs,1);
  961.                     sizes = wmemtool('rmb',win_dw2dtool,n_sizes,1);
  962.                     X = wrcoef2(opt,coefs,sizes,Wave_Name,level);
  963.                     if opt=='a' , flg_code = 0; else , flg_code = 1; end
  964.                     X = wimgcode('cod',flg_code,X,NB_ColorsInPal,codemat_v);
  965.                     strxlab = ['Recons. ' typestr ' coef. of level ' str_lev];
  966.                     xl = get(Axe_ImgIni,'Xlim');
  967.                     yl = get(Axe_ImgIni,'Ylim');
  968.             end
  969.             if ind~=2       % Drawing (little image)
  970.                 gx = get(Axe_ImgVis,'Xgrid');
  971.                 gy = get(Axe_ImgVis,'Ygrid');
  972.                 image([1 Img_Size(1)],[1 Img_Size(2)],X,'Parent',Axe_ImgVis);
  973.                 set(Axe_ImgVis,...
  974.                     'Visible','On',            ...
  975.                     'Xgrid',gx,'Ygrid',gy,     ...
  976.                     'Xlim',xl,'Ylim',yl,       ...
  977.                     'XTicklabel',[],           ...
  978.                     'YTicklabel',[],           ...
  979.                     'Xcolor',BoxTitleSel_Col,  ...
  980.                     'Ycolor',BoxTitleSel_Col,  ...
  981.                     'LineWidth',Width_LineSel, ...
  982.                     'Box','On',                ...
  983.                     'Tag',tag_axeimgvis        ...
  984.                     );
  985.                 wtitle(strxlab,'Parent',Axe_ImgVis);
  986.             else            % Drawing (big image)
  987.                 [row,col] = size(X);
  988.                 strxlab   = [strxlab '  -- image size : ('        ...
  989.                              sprintf('%.0f',row) ',' sprintf('%.0f',col) ')'];
  990.                 % Setting enabled values.
  991.                 %------------------------
  992. dynvtool('dynvzaxe_BtnOnOff',win_dw2dtool,'Off')
  993.                 handles = [ pus_anal, pop_declev, pus_visu, ...
  994.                             pus_rec,  pop_viewm,  pus_full  ...
  995.                             ];
  996.                 set(handles,'Enable','Off');
  997.                 set(pus_big,                               ...
  998.                         'String',xlate('End Full Size'),          ...
  999.                         'BackGroundColor',Def_TxtBkColor,  ...
  1000.                         'Callback',                        ...
  1001.                         ['dw2dmngr(''select'',' str_numwin ...
  1002.                                  ',''end_big'');']         ...
  1003.                         );
  1004.                 axe_figutil = findobj(get(win_dw2dtool,'Children'),...
  1005.                                     'flat','type','axes',      ...
  1006.                                     'Tag',tag_axefigutil...
  1007.                                     );
  1008.                 t_lines = findobj(axe_figutil,'type','line','Tag',tag_linetree);
  1009.                 t_txt   = findobj(axe_figutil,'type','text','Tag',tag_txttree);
  1010.                 for k=1:4*Level_Anal
  1011.                     ax = Axe_ImgDec(k);
  1012.                     set(get(ax,'Children'),'Visible','Off');
  1013.                     set(ax,'Visible','Off');
  1014.                 end
  1015.                 set(findobj([Axe_ImgIni,Axe_ImgVis,...
  1016.                              Axe_ImgSyn,Axe_ImgSel]),'visible','off');
  1017.                 wboxtitl('vis',Axe_ImgSel,'off');
  1018.                 set([t_lines' t_txt'],'Visible','off');
  1019.                 dw2darro('vis_arrow',win_dw2dtool,'off');
  1020.                 gx = get(Axe_ImgBig,'Xgrid');
  1021.                 gy = get(Axe_ImgBig,'Ygrid');
  1022.                 image([1 Img_Size(1)],[1 Img_Size(2)],X,...
  1023.                       'Parent',Axe_ImgBig);
  1024.                 set(Axe_ImgBig, ...
  1025.                     'Visible','On',        ...
  1026.                     'Xgrid',gx,'Ygrid',gy, ...
  1027.                     'XTicklabel',[],       ...
  1028.                     'YTicklabel',[],       ...
  1029.                     'Xlim',xl,'Ylim',yl,   ...
  1030.                     'Tag',tag_axeimgbig    ...
  1031.                     );
  1032.                 wsetxlab(Axe_ImgBig,strxlab);
  1033.                 % Changing View Status.
  1034.                 %----------------------
  1035.                 view_status = wmemtool('rmb',win_dw2dtool, ...
  1036.                                         n_miscella,ind_view_status);
  1037.                 wmemtool('wmb',win_dw2dtool,n_miscella,...
  1038.                                ind_save_status,view_status);
  1039.                 view_status = ['b' sprintf('%.0f',indimg) ...
  1040.                                 'l' sprintf('%.0f',get(pop_declev,'Value'))];
  1041.                 wmemtool('wmb',win_dw2dtool,n_miscella,...
  1042.                                ind_view_status,view_status);
  1043.             end
  1044.             % End waiting.
  1045.             %--------------
  1046.             wwaiting('off',win_dw2dtool);
  1047.         end
  1048.     case 'view_mode'
  1049.         % Getting & Setting View_status.
  1050.         %-------------------------------
  1051.         view_status = wmemtool('rmb',win_dw2dtool,n_miscella,ind_view_status);
  1052.         val = get(pop_viewm,'Value');
  1053.         if view_status(1)=='s'
  1054.             if val==square_viewm , return; end
  1055.             view_status(1) = 't';
  1056.         elseif view_status(1)=='t'
  1057.             if val==tree_viewm , return; end
  1058.             view_status(1) = 's';
  1059.         end
  1060.         wmemtool('wmb',win_dw2dtool,n_miscella, ...
  1061.                        ind_view_status,view_status, ...
  1062.                        ind_save_status,view_status  ...
  1063.                        );
  1064.         % Begin waiting.
  1065.         %--------------
  1066.         wwaiting('msg',win_dw2dtool,'Wait ... drawing');
  1067.         
  1068.         pos = zeros(4,4);
  1069.         pos(1,:) = get(pus_full(1),'Position');
  1070.         if val==square_viewm
  1071.             pos(1,3) = (3*pos(1,3))/2;
  1072.             pos(2,:) = pos(1,:); pos(2,2) = pos(2,2)-pos(2,4);
  1073.             pos(3,:) = pos(1,:); pos(3,1) = pos(3,1)+pos(3,3);
  1074.             pos(4,:) = pos(3,:);
  1075.             pos(4,2) = pos(4,2)-pos(4,4);
  1076.         else
  1077.             pos(1,3) = (2*pos(1,3))/3;
  1078.             pos(2,:) = pos(1,:); pos(2,1) = pos(2,1)+pos(2,3);
  1079.             pos(3,:) = pos(2,:); pos(3,1) = pos(3,1)+pos(3,3);
  1080.             pos(4,:) = pos(1,:);
  1081.             pos(4,3) = 3*pos(4,3);
  1082.             pos(4,2) = pos(4,2)-pos(4,4);
  1083.         end
  1084.         dw2darro('vis_arrow',win_dw2dtool,'off');
  1085.         % Cleaning Selection.
  1086.         %--------------------
  1087.         dw2dimgs('clean',win_dw2dtool);
  1088.         % Drawing.
  1089.         %---------
  1090.         dw2dmngr('set_graphic',win_dw2dtool,option);
  1091.         set([txt_full,pus_full],'Visible','off');
  1092.         for k=1:4 , set(pus_full(k),'Position',pos(k,:)); end
  1093.         pos_txt = get(txt_full,'Position');
  1094.         d_txt   = pos(1,4)-pos_txt(4);
  1095.         if val==square_viewm
  1096.             hdl_on = [txt_full,pus_full];
  1097.             pos_txt(2) = pos(1,2)-pos_txt(1,4)/2;
  1098.         else
  1099.             hdl_on = [txt_full,pus_full(1:3)];
  1100.             pos_txt(2) = pos(1,2)+d_txt/2;
  1101.         end
  1102.         set(txt_full,'Position',pos_txt);
  1103.         set(hdl_on,'Visible','on');
  1104.         if val==square_viewm
  1105.             dw2darro('vis_arrow',win_dw2dtool,'on');
  1106.         end
  1107.         % End waiting.
  1108.         %-------------
  1109.         wwaiting('off',win_dw2dtool);
  1110.     case 'fullsize'
  1111.         % in3 = btn number.
  1112.         %------------------
  1113.         % Begin waiting.
  1114.         %--------------
  1115.         wwaiting('msg',win_dw2dtool,'Wait ... drawing');
  1116.         % Getting active option.
  1117.         %------------------------
  1118.         active_option = wmemtool('rmb',win_dw2dtool,n_param_anal,...
  1119.                                        ind_act_option);
  1120.         % Test begin or end.
  1121.         %-------------------
  1122.         num = in3;
  1123.         btn = pus_full(num);
  1124.         act = get(btn,'Userdata');
  1125.         if act==0
  1126.             % begin full size
  1127.             %----------------
  1128.             dw2darro('vis_arrow',win_dw2dtool,'off');
  1129.             param = 'beg';
  1130.             for k=1:length(pus_full)
  1131.                 act_old = get(pus_full(k),'Userdata');
  1132.                 if act_old==1
  1133.                     other_btn = pus_full(length(pus_full)+1-k);
  1134.                     old_col = get(other_btn,'Backgroundcolor');
  1135.                     set(pus_full(k),...
  1136.                         'Backgroundcolor',old_col,  ...
  1137.                         'String',sprintf('%.0f',k), ...
  1138.                         'Userdata',0);
  1139.                     break;
  1140.                 end
  1141.             end
  1142.             set(btn,'Backgroundcolor',Def_TxtBkColor,      ...
  1143.                     'String',['end ' sprintf('%.0f',num)], ...
  1144.                     'Userdata',1);
  1145. if num==4 , ena_DynV = 'On'; else , ena_DynV = 'Off'; end
  1146.             % Changing View Status.
  1147.             %----------------------
  1148.             view_status = wmemtool('rmb',win_dw2dtool,n_miscella,...
  1149.                                          ind_view_status);
  1150.             if view_status(1)~='f'
  1151.                 wmemtool('wmb',win_dw2dtool,n_miscella,...
  1152.                                     ind_save_status,view_status);
  1153.             end
  1154.             view_status = ['f' sprintf('%.0f',num) 'l' ...
  1155.                                sprintf('%.0f',get(pop_declev,'value'))];
  1156.             wmemtool('wmb',win_dw2dtool,n_miscella,ind_view_status,view_status);
  1157.         else
  1158.             % end full size.
  1159.             %---------------
  1160.             other_btn = pus_full(length(pus_full)+1-num);
  1161.             old_col = get(other_btn,'Backgroundcolor');
  1162.             param = 'end';
  1163.             set(btn,'Backgroundcolor',old_col,    ...
  1164.                     'String',sprintf('%.0f',num), ...
  1165.                     'Userdata',0);
  1166. ena_DynV = 'On'; 
  1167.         end
  1168. dynvtool('dynvzaxe_BtnOnOff',win_dw2dtool,ena_DynV)
  1169.         % Setting enabled values.
  1170.         %------------------------
  1171.         handles = [pus_anal, pus_visu, pus_big, pus_rec, pop_viewm];
  1172.         if strcmp(param,'end')
  1173.             ena = 'on';
  1174.             handles = [handles , pop_declev];
  1175.         elseif find(num==[1 2 3])
  1176.             ena_val = 0; ena = 'off';
  1177.             handles = [handles , pop_declev];
  1178.         elseif num==4
  1179.             ena = 'off';
  1180.         end
  1181.         % Drawing.
  1182.         %---------
  1183.         if strcmp(ena,'off') , set(handles,'Enable',ena); end
  1184.         dw2dmngr('set_graphic',win_dw2dtool,option,param);
  1185.         if strcmp(ena,'on')
  1186.             set(handles,'Enable',ena);
  1187.         elseif num==4
  1188.             set(pop_declev,'Enable','On');
  1189.         end
  1190.         val = get(pop_viewm,'Value');
  1191.         if (val==square_viewm) & strcmp(param,'end')
  1192.             dw2darro('vis_arrow',win_dw2dtool,'on');
  1193.         end
  1194.         % End waiting.
  1195.         %-------------
  1196.         wwaiting('off',win_dw2dtool);
  1197.     case 'stat'
  1198.         set(wfindobj('figure'),'Pointer','watch');
  1199.         out1 = feval('dw2dstat','create',win_dw2dtool);
  1200.     case 'hist'
  1201.         set(wfindobj('figure'),'Pointer','watch');
  1202.         out1 = feval('dw2dhist','create',win_dw2dtool);
  1203.     case 'comp'
  1204.         set(wfindobj('figure'),'Pointer','watch');
  1205.         dw2dutil('enable',win_dw2dtool,option);
  1206.         out1 = feval('dw2dcomp','create',win_dw2dtool);
  1207.     case 'deno'
  1208.         set(wfindobj('figure'),'Pointer','watch');
  1209.         dw2dutil('enable',win_dw2dtool,option);
  1210.         out1 = feval('dw2ddeno','create',win_dw2dtool);
  1211.     case {'return_comp','return_deno'}
  1212.         % in3 = 1 : preserve compression
  1213.         % in3 = 0 : discard compression
  1214.         % in4 = hdl_img (optional)
  1215.         %--------------------------------------
  1216.         if in3==1
  1217.             % Begin waiting.
  1218.             %--------------
  1219.             wwaiting('msg',win_dw2dtool,'Wait ... computing');
  1220.             if strcmp(option,'return_comp')
  1221.                 arro_txt = 'comp';      t_simg = 'cs';
  1222.                 xlab_str = 'Compressed Image';
  1223.             else
  1224.                 arro_txt = 'deno';      t_simg = 'ds';
  1225.                 xlab_str = 'De-noised Image';
  1226.             end
  1227.             wmemtool('wmb',win_dw2dtool,n_param_anal, ...
  1228.                            ind_simg_type,t_simg       ...
  1229.                            );
  1230.             [Wave_Name,Img_Size,NB_ColorsInPal] = ...
  1231.                     wmemtool('rmb',win_dw2dtool,n_param_anal,...
  1232.                                    ind_wav_name,ind_img_size,ind_nbcolors);
  1233.             % Drawing Synthesized Image.
  1234.             %--------------------------
  1235.             view_status = wmemtool('rmb',win_dw2dtool,n_miscella,ind_view_status);
  1236.             view_mode   = view_status(1);
  1237.             if (view_mode=='f') & (view_status(2)~='2')
  1238.                 vis = 'Off';
  1239.             else
  1240.                 vis = 'on';
  1241.             end
  1242.             if (view_mode=='s') , vis_ar = 'On'; else , vis_ar = 'Off'; end
  1243.             xlim = get(Axe_ImgIni,'Xlim');
  1244.             ylim = get(Axe_ImgIni,'Ylim');
  1245.             axes(Axe_ImgSyn);
  1246.             image(...
  1247.                     [1 Img_Size(1)],[1 Img_Size(2)],        ...
  1248.                     wimgcode('cod',0,get(in4,'Cdata'),NB_ColorsInPal,codemat_v), ...
  1249.                     'Visible',vis,                           ...
  1250.                     'Parent',Axe_ImgSyn                      ...
  1251.                     );
  1252.             col = get(get(Axe_ImgSyn,'xlabel'),'Color');
  1253.             set(Axe_ImgSyn,...
  1254.                 'Visible',vis,                  ...
  1255.                 'XTicklabelMode','manual',      ...
  1256.                 'YTicklabelMode','manual',      ...
  1257.                 'XTicklabel',[],'YTicklabel',[],...
  1258.                 'Xlim',xlim,'Ylim',ylim,        ...
  1259.                 'Box','On',                     ...
  1260.                 'Tag',tag_axeimgsyn             ...
  1261.                 );
  1262.             wtitle(xlab_str,'Color',col,...
  1263.                             'Visible',vis,...
  1264.                             'Parent',Axe_ImgSyn);
  1265.             dw2darro('vis_arrow',win_dw2dtool,vis_ar,arro_txt);
  1266.             % End waiting.
  1267.             %-------------
  1268.             wwaiting('off',win_dw2dtool);
  1269.         end
  1270.         dw2dutil('enable',win_dw2dtool,option);
  1271.     case 'set_graphic'
  1272.         % in3 = calling option.
  1273.         %  if in3 = 'fullsize' :
  1274.         %     in4 = 'beg' or 'end'.
  1275.         %  if in3 = 'select' :
  1276.         %     in4 = 'beg' or 'end'.
  1277.         %-----------------------------
  1278.         % Getting Analysis parameters.
  1279.         %-----------------------------
  1280.         [Img_Size,Level_Anal] = wmemtool('rmb',win_dw2dtool,n_param_anal,...
  1281.                                                ind_img_size,ind_lev_anal);
  1282.         level_view = get(pop_declev,'Value');
  1283.         % Getting Axes handles.
  1284.         %----------------------
  1285.         Axe_ImgDec  = wmemtool('rmb',win_dw2dtool,tag_axeimgdec,1);
  1286.         Img_Handles = wmemtool('rmb',win_dw2dtool,tag_axeimghdls,1);
  1287.         % Getting position parameters.
  1288.         %-----------------------------
  1289.         [ pos,pos_axeini,pos_axevis,pos_axesel,   ...
  1290.           pos_axesyn,pos_axebig,pos_axedec,view_status,save_status] = ...
  1291.                   wmemtool('rmb',win_dw2dtool,n_miscella, ...
  1292.                                  ind_graph_area,  ...
  1293.                                  ind_pos_axeini,  ...
  1294.                                  ind_pos_axevis,  ...
  1295.                                  ind_pos_axesel,  ...
  1296.                                  ind_pos_axesyn,  ...
  1297.                                  ind_pos_axebig,  ...
  1298.                                  ind_pos_axedec,  ...
  1299.                                  ind_view_status, ...
  1300.                                  ind_save_status  ...
  1301.                                  );
  1302.         k = findstr(save_status,'l');
  1303.         lev_view_old = wstr2num(save_status(k+1:length(save_status)));
  1304.         % Setting options.
  1305.         %-----------------
  1306.         obj_sel = [];
  1307.         switch in3
  1308.             case 'fullsize'
  1309.                 if strcmp(in4,'beg')
  1310.                     view_attrb = 10+wstr2num(view_status(2));
  1311.                 else
  1312.                     view_status = save_status;
  1313.                     wmemtool('wmb',win_dw2dtool,n_miscella,...
  1314.                                             ind_view_status,view_status);
  1315.                     switch view_status(1)
  1316.                         case 's' , view_attrb = 5;
  1317.                         case 't' , view_attrb = 6;
  1318.                     end
  1319.                     obj_sel = dw2dimgs('get',win_dw2dtool);
  1320.                 end
  1321.             case 'select'       % end big_image
  1322.                 view_status = save_status;
  1323.                 wmemtool('wmb',win_dw2dtool,n_miscella,...
  1324.                                         ind_view_status,view_status);
  1325.                 switch view_status(1)
  1326.                     case 's' , view_attrb = 5;
  1327.                     case 't' , view_attrb = 6;
  1328.                 end
  1329.                 obj_sel = dw2dimgs('get',win_dw2dtool);
  1330.             case 'view_dec'
  1331.                 save_status = [save_status(1:k) sprintf('%.0f',level_view)];
  1332.                 wmemtool('wmb',win_dw2dtool,n_miscella,...
  1333.                                         ind_save_status,save_status);
  1334.                 switch view_status(1) 
  1335.                     case {'s','f'} , view_attrb = 3;
  1336.                     case 't' ,       view_attrb = 4;
  1337.                 end
  1338.             case 'view_mode'
  1339.                 switch view_status(1)
  1340.                     case 's' , view_attrb = 5;
  1341.                     case 't' , view_attrb = 6;
  1342.                 end
  1343.         end
  1344.         % Computing axes positions.
  1345.         %--------------------------
  1346.         if view_status(1)=='t'
  1347.             % Getting position parameters.
  1348.             %-----------------------------
  1349.             term_dim      = Terminal_Prop;
  1350.             [xpixl,ypixl] = wfigutil('prop_size',win_dw2dtool,1,1);
  1351.             % View boundary parameters.
  1352.             %--------------------------
  1353.             mx = 0.73;  my = 0.70;
  1354.             x_marge = 0.05;
  1355.             x_left  = pos(1)+x_marge;
  1356.             width   = pos(3)-x_marge;
  1357.             NBL     = level_view+1; NBC     = 4;
  1358.             w_theo  = width/NBC;    h_theo  = pos(4)/NBL;
  1359.             w_pos   = w_theo*mx;    h_pos = h_theo*my;
  1360.             X_cent  = x_left+(w_theo/2)*[1:2:2*NBC-1];
  1361.             Y_cent  = pos(2)+(h_theo/2)*[1:2:2*NBL-1];
  1362.             alpha   = (term_dim(2)*h_pos*Img_Size(1))/...
  1363.                       (term_dim(1)*w_pos*Img_Size(2));
  1364.             w_used  = w_pos*min(1,alpha);
  1365.             h_used  = h_pos*min(1,1/alpha);
  1366.             dy  = (h_theo-h_used)/2;
  1367.             ind = [2:NBL-1];
  1368.             Y_cent(ind) = Y_cent(ind)-dy*(ind-1); 
  1369.             if NBL>Level_Anal-2
  1370.                 Y_cent(NBL) = Y_cent(NBL)-(level_view*dy)/(NBL-1);
  1371.             end
  1372.             % Correction : Y-Shift
  1373.             %---------------------
  1374.             if level_view>max_lev_anal-2
  1375.                 Y_cent(1:NBL-1) = Y_cent(1:NBL-1)+25*ypixl;
  1376.                 bdy = 3*ypixl;
  1377.             else
  1378.                 bdy = 0*ypixl;
  1379.             end
  1380.             w_u2 = w_used/2;  h_u2 = h_used/2;
  1381.             pos_axeini = [ X_cent(1)-w_u2 , Y_cent(NBL)-h_u2 ,...
  1382.                            w_used         , h_used           ];
  1383.             pos_axesyn = [ X_cent(2)-w_u2 , Y_cent(NBL)-h_u2 ,...
  1384.                            w_used         , h_used           ];
  1385.             pos_axevis = [ X_cent(3)      , Y_cent(NBL)-h_u2 ,...
  1386.                            w_used         , h_used           ];
  1387.             bdy = 0*ypixl;
  1388.             xl  = pos(1)+20*xpixl;
  1389.             wa  = pos(3)-40*xpixl;
  1390.             yd  = Y_cent(1)-h_u2-bdy;
  1391.             ha  = Y_cent(NBL-1)-Y_cent(1)+h_used+bdy;
  1392.             [ha,yd] = depOfMachine(ypixl,ha,yd);
  1393.             pos_axesel = [xl yd wa ha];
  1394.             max_l   = max_lev_anal+1;
  1395.             l_Xdata = zeros(max_l,2);
  1396.             l_Ydata = zeros(max_l,2);
  1397.             for k = 1:level_view
  1398.                 for l = 1:4
  1399.                     ind = 4*(level_view-k+1)+1-l;
  1400.                     pos_axedec(ind,:) = [X_cent(l)-w_u2  ,...
  1401.                                          Y_cent(k)-h_u2  ,...
  1402.                                          w_used          ,...
  1403.                                          h_used  ];
  1404.                 end
  1405.                 l_Xdata(k,:) = [X_cent(1) X_cent(NBC)];
  1406.                 l_Ydata(k,:) = [Y_cent(k) Y_cent(k)];
  1407.             end
  1408.             l_Xdata(max_l,:) = [X_cent(1),  X_cent(1)];
  1409.             l_Ydata(max_l,:) = [Y_cent(NBL),Y_cent(1)];
  1410.             x_left_txt = pos_axeini(1)-0.035;
  1411.         end
  1412.         max_a   = 4*Level_Anal;
  1413.         max_v   = 4*level_view;
  1414.         all_ind = [1:max_a];
  1415.         rem_4   = rem(all_ind,4);
  1416.         switch view_status(1)
  1417.             case 's'
  1418.                 vis_ini = 'on';  vis_vis = 'on';
  1419.                 vis_sel = 'on';  vis_syn = 'on';
  1420.                 vis_big = 'off';
  1421.                 ind_On  = [find(all_ind<max_v & rem_4~=0) , max_v];
  1422.                 ind_Off = [find(all_ind<max_v & rem_4==0) , ...
  1423.                                         find(all_ind>max_v)];
  1424.             case 't'
  1425.                 vis_ini = 'on';  vis_vis = 'on';
  1426.                 vis_sel = 'on';  vis_syn = 'on';
  1427.                 vis_big = 'off';
  1428.                 ind_On  = 1:max_v;  ind_Off = max_v+1:max_a;
  1429.             case 'f'
  1430.                 switch view_status(2)
  1431.                     case '1'
  1432.                         pos_axeini = pos_axebig;
  1433.                         vis_ini = 'on';  vis_vis = 'off';
  1434.                         vis_sel = 'off'; vis_syn = 'off';
  1435.                         vis_big = 'off';
  1436.                         ind_On  = [];    ind_Off = all_ind;
  1437.                     case '2'
  1438.                         pos_axesyn = pos_axebig;
  1439.                         vis_ini = 'off'; vis_vis = 'off';
  1440.                         vis_sel = 'off'; vis_syn = 'on';
  1441.                         vis_big = 'off';
  1442.                         ind_On  = [];    ind_Off = all_ind;
  1443.                     case '3'
  1444.                         pos_axevis = pos_axebig;
  1445.                         vis_ini = 'off'; vis_vis = 'on';
  1446.                         vis_sel = 'off'; vis_syn = 'off';
  1447.                         vis_big = 'off';
  1448.                         ind_On  = [];    ind_Off = all_ind;
  1449.                     case '4'
  1450.                         pos_axesel = pos_axebig;
  1451.                         xl = pos_axesel(1);
  1452.                         yb = pos_axesel(2);
  1453.                         la = pos_axesel(3)/2;
  1454.                         ha = pos_axesel(4)/2;
  1455.                         ind = 1;
  1456.                         for k = 1:max_lev_anal
  1457.                             pos_axedec(ind:ind+3,1:4) = ...
  1458.                                     [xl   , yb   , la, ha;
  1459.                                      xl+la, yb   , la, ha;
  1460.                                      xl+la, yb+ha, la, ha;
  1461.                                      xl   , yb+ha, la, ha ...
  1462.                                     ];
  1463.                             ind = ind+4;
  1464.                             yb = yb+ha; la = la/2; ha = ha/2;
  1465.                         end
  1466.                         vis_ini = 'off'; vis_vis = 'off';
  1467.                         vis_sel = 'on';  vis_syn = 'off';
  1468.                         vis_big = 'off';
  1469.                         ind_On  = [find(all_ind<max_v & rem_4~=0) , max_v];
  1470.                         ind_Off = [find(all_ind<max_v & rem_4==0) , ...
  1471.                                         find(all_ind>max_v)];
  1472.                 end
  1473.         end     
  1474.         % Setting graphic area.
  1475.         %----------------------
  1476.         axe_figutil = findobj(axe_handles,'Tag',tag_axefigutil);
  1477.         t_lines     = findobj(axe_figutil,'type','line','Tag',tag_linetree);
  1478.         t_txt       = findobj(axe_figutil,'type','text','Tag',tag_txttree);
  1479.         set([t_lines' t_txt'],'Visible','off'); 
  1480.         set(Img_Handles,'Visible','Off');
  1481.         ind = 4*lev_view_old;
  1482.         delete([...
  1483.                 get(Axe_ImgDec(ind),'Xlabel'),...
  1484.                 get(Axe_ImgDec(ind-1),'Xlabel'),...
  1485.                 get(Axe_ImgDec(ind-2),'Xlabel'),...
  1486.                 get(Axe_ImgDec(ind-3),'Xlabel'),...
  1487.                 ]);
  1488.         switch view_status(1)
  1489.             case 'f'
  1490.                 switch view_status(2)
  1491.                     case '1' , set(Axe_ImgIni,'Position',pos_axeini);
  1492.                     case '2' , set(Axe_ImgSyn,'Position',pos_axesyn);
  1493.                     case '3' , set(Axe_ImgVis,'Position',pos_axevis);
  1494.                     case '4'
  1495.                         set(Axe_ImgSel,'Position',pos_axesel);
  1496.                         for k = 1:4*max_lev_anal
  1497.                             set(Axe_ImgDec(k),'Position',pos_axedec(k,:));
  1498.                         end
  1499.                 end
  1500.             case {'s','t'}
  1501.                 set(Axe_ImgIni,'Position',pos_axeini);
  1502.                 set(Axe_ImgVis,'Position',pos_axevis);
  1503.                 set(Axe_ImgSyn,'Position',pos_axesyn);
  1504.                 set(Axe_ImgSel,'Position',pos_axesel);
  1505.                 for k = 1:4*max_lev_anal
  1506.                     set(Axe_ImgDec(k),'Position',pos_axedec(k,:));
  1507.                 end
  1508.         end
  1509.         set(findobj(Axe_ImgIni),'visible',vis_ini);
  1510.         set(findobj(Axe_ImgVis),'visible',vis_vis);
  1511.         set(findobj(Axe_ImgSyn),'visible',vis_syn);
  1512.         set(findobj(Axe_ImgSel),'visible',vis_sel);
  1513.         set(findobj(Axe_ImgBig),'visible',vis_big);
  1514.         s_font = Def_AxeFontSize;
  1515.         if view_status(1)=='t'
  1516.             bdy = 18;
  1517.             strxlab = sprintf('Decomposition at level %.0f',level_view); 
  1518.             box_str = ['Image Selection : ' strxlab];
  1519.             wboxtitl('set',Axe_ImgSel,box_str,s_font,9,10,bdy,vis_sel);
  1520.         else
  1521.             bdy = 18;
  1522.             box_str = 'Image Selection';
  1523.             wboxtitl('set',Axe_ImgSel,box_str,s_font,9,18,bdy,vis_sel);
  1524.         end
  1525.         switch view_attrb
  1526.             case 4
  1527.                 for k = [1:level_view,max_lev_anal+1]
  1528.                     l = findobj(t_lines,'Type','line','Userdata',k);
  1529.                     set(l,...
  1530.                          'Xdata',l_Xdata(k,:),...
  1531.                          'Ydata',l_Ydata(k,:),...
  1532.                          'Visible','On'       ...
  1533.                          );
  1534.                 end
  1535.                 for k = [1:level_view]
  1536.                     txt = findobj(t_txt,'Type','text','Userdata',k);
  1537.                     j = level_view+1-k;
  1538.                     set(txt,...
  1539.                            'Position',[x_left_txt ,l_Ydata(j,1)], ...
  1540.                            'Visible','On'                         ...
  1541.                            );
  1542.                 end
  1543.                 set(Axe_ImgSel,'Visible','Off');
  1544.             case 5
  1545.                 set([Axe_ImgDec,Axe_ImgIni,Axe_ImgVis,Axe_ImgSel,Axe_ImgSyn],...
  1546.                                 'Visible','off');
  1547.                 ind = 4*level_view;
  1548.                 delete([...
  1549.                         get(Axe_ImgDec(ind),'Xlabel'),  ...
  1550.                         get(Axe_ImgDec(ind-1),'Xlabel'),...
  1551.                         get(Axe_ImgDec(ind-2),'Xlabel'),...
  1552.                         get(Axe_ImgDec(ind-3),'Xlabel') ...
  1553.                         ]);
  1554.             case 6
  1555.                 set([Axe_ImgDec,Axe_ImgIni,Axe_ImgVis,Axe_ImgSel,Axe_ImgSyn],...
  1556.                                 'Visible','off');
  1557.                 for k = [1:level_view,max_lev_anal+1]
  1558.                     l = findobj(t_lines,'Type','line','Userdata',k);
  1559.                     set(l,...
  1560.                         'Xdata',l_Xdata(k,:),...
  1561.                         'Ydata',l_Ydata(k,:),...
  1562.                         'Visible','On'       ...
  1563.                         );
  1564.                 end
  1565.                 for k = [1:level_view]
  1566.                     txt = findobj(t_txt,'Type','text','Userdata',k);
  1567.                     j = level_view+1-k;
  1568.                     set(txt,...
  1569.                         'Position',[x_left_txt ,l_Ydata(j,1)], ...
  1570.                         'Visible','On'                         ...
  1571.                         );
  1572.                 end
  1573.         end
  1574.         if find(view_attrb==[5 6])
  1575.                 if view_attrb==5
  1576.                     set([Axe_ImgIni,Axe_ImgSel],'Visible','on','Box','On');
  1577.                 else
  1578.                     set(Axe_ImgIni,...
  1579.                         'Visible','on',                 ...
  1580.                         'XTicklabelMode','manual',      ...
  1581.                         'YTicklabelMode','manual',      ...
  1582.                         'XTicklabel',[],'YTicklabel',[],...
  1583.                         'XTick',[],'YTick',[],          ...
  1584.                         'Box','On');
  1585.                 end
  1586.                 for k = 1:length(ind_On) , axes(Axe_ImgDec(k)); end
  1587.                 set(Axe_ImgDec(ind_On),...
  1588.                     'Visible','on',...
  1589.                     'Xcolor',Col_BoxAxeSel,         ...
  1590.                     'Ycolor',Col_BoxAxeSel,         ...
  1591.                     'XTicklabelMode','manual',      ...
  1592.                     'YTicklabelMode','manual',      ...
  1593.                     'XTicklabel',[],'YTicklabel',[],...
  1594.                     'XTick',[],'YTick',[],'Box','On'...
  1595.                     );
  1596.                 if ~isempty(obj_sel)
  1597.                     axe = get(obj_sel,'parent');
  1598.                     set(axe,...
  1599.                         'Xcolor',BoxTitleSel_Col, ...
  1600.                         'Ycolor',BoxTitleSel_Col, ...
  1601.                         'LineWidth',Width_LineSel,...
  1602.                         'Box','On'                ...
  1603.                         );
  1604.                 end
  1605.                                        
  1606.                 set(Axe_ImgVis,...
  1607.                     'Visible','on',                 ...
  1608.                     'XTicklabelMode','manual',      ...
  1609.                     'YTicklabelMode','manual',      ...
  1610.                     'XTicklabel',[],'YTicklabel',[],...
  1611.                     'Xcolor',BoxTitleSel_Col,       ...
  1612.                     'Ycolor',BoxTitleSel_Col,       ...
  1613.                     'LineWidth',Width_LineSel,      ...
  1614.                     'Box','On'                      ...
  1615.                     );
  1616.                 set(Axe_ImgSyn,...
  1617.                     'Visible','on',                 ...
  1618.                     'XTicklabelMode','manual',      ...
  1619.                     'YTicklabelMode','manual',      ...
  1620.                     'XTicklabel',[],'YTicklabel',[],...
  1621.                     'Box','On'                      ...
  1622.                     );
  1623.   
  1624.         end
  1625.         if find(view_attrb==[3 4 5 6 11 12 13 14])
  1626.             set(Img_Handles(ind_On),'Visible','On');
  1627.             set(Axe_ImgDec(ind_On),'Visible','On');
  1628.             if ~isempty(ind_Off)
  1629.                 set(Img_Handles(ind_Off),'Visible','Off');
  1630.                 set(Axe_ImgDec(ind_Off),'Visible','Off');
  1631.             end
  1632.         end
  1633.         if view_attrb==5
  1634.             strxlab = sprintf('Decomposition at level %.0f',level_view); 
  1635.             wsetxlab(Axe_ImgSel,strxlab);
  1636.         elseif find(view_attrb==[4 6])
  1637.             strxlab = '';
  1638.             wsetxlab(Axe_ImgSel,strxlab);
  1639.             ind = 4*level_view;
  1640.             col_lab = get(win_dw2dtool,'DefaultAxesXColor');
  1641.             wsetxlab(Axe_ImgDec(ind),xlate('Approximations'),col_lab);
  1642.             wsetxlab(Axe_ImgDec(ind-1),'Horizontal Details',col_lab);
  1643.             wsetxlab(Axe_ImgDec(ind-2),'Diagonal Details',col_lab);
  1644.             wsetxlab(Axe_ImgDec(ind-3),'Vertical Details',col_lab);
  1645.         elseif find(view_attrb==[3 14])
  1646.             strxlab = sprintf('Decomposition at level %.0f',level_view); 
  1647.             wsetxlab(Axe_ImgSel,strxlab);
  1648.         end
  1649.     otherwise
  1650.         errargt(mfilename,'Unknown Option','msg');
  1651.         error('*');
  1652. end
  1653. %-------------------------------------------------
  1654. function varargout = depOfMachine(varargin)
  1655. ypixl = varargin{1};
  1656. ha    = varargin{2};
  1657. yd    = varargin{3};
  1658. scrSize = get(0,'ScreenSize');
  1659. if (scrSize(4)<700) 
  1660.     dyd = 10*ypixl;
  1661.     ha = ha+dyd; 
  1662.     yd = yd-dyd;
  1663. end
  1664. varargout = {ha,yd};
  1665. %-------------------------------------------------