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

波变换

开发平台:

Matlab

  1. function varargout = utthrw2d(option,fig,varargin)
  2. %UTTHRW2D Utilities for wavelet thresholding 2-D.
  3. %   VARARGOUT = UTTHRW2D(OPTION,FIG,VARARGIN)
  4. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 01-Oct-98.
  5. %   Last Revision: 22-May-2003.
  6. %   Copyright 1995-2004 The MathWorks, Inc.
  7. %   $Revision: 1.8.4.2 $  $Date: 2004/03/15 22:42:12 $
  8. % Default values.
  9. %----------------
  10. max_lev_anal = 5;
  11. def_lev_anal = 2;
  12. % Tag property.
  13. %--------------
  14. tag_fra_tool = ['Fra_' mfilename];
  15. switch option
  16.   case {'create'}
  17.   otherwise
  18.     uic = findobj(get(fig,'Children'),'flat','type','uicontrol');
  19.     fra = findobj(uic,'style','frame','tag',tag_fra_tool);
  20.     if isempty(fra) , return; end
  21.     calledFUN = wfigmngr('getWinPROP',fig,'calledFUN');
  22.     ud = get(fra,'Userdata');
  23.     toolOPT = ud.toolOPT;
  24.     toolStatus = ud.status;
  25.     handlesUIC = ud.handlesUIC;
  26.     h_CMD_LVL  = ud.h_CMD_LVL;
  27.     h_GRA_LVL  = ud.h_GRA_LVL;
  28.     if isequal(option,'handles')
  29.         handles = [handlesUIC(:);h_CMD_LVL(:)];
  30.         varargout{1} = handles(ishandle(handles));
  31.         return;
  32.     end
  33.     thrStruct = ud.thrStruct;
  34.     ind = 2;
  35.     txt_top = handlesUIC(ind); ind = ind+1;
  36.     pop_met = handlesUIC(ind); ind = ind+1;
  37.     rad_sof = handlesUIC(ind); ind = ind+1;
  38.     rad_har = handlesUIC(ind); ind = ind+1;
  39.     txt_noi = handlesUIC(ind); ind = ind+1;
  40.     pop_noi = handlesUIC(ind); ind = ind+1;
  41.     txt_BMS = handlesUIC(ind); ind = ind+1;  
  42.     sli_BMS = handlesUIC(ind); ind = ind+1;
  43.     pop_dir = handlesUIC(ind); ind = ind+1;
  44.     txt_tit(1:3) = handlesUIC(ind:ind+2); ind = ind+3;
  45.     txt_nor = handlesUIC(ind); ind = ind+1;
  46.     edi_nor = handlesUIC(ind); ind = ind+1;
  47.     txt_npc = handlesUIC(ind); ind = ind+1;
  48.     txt_zer = handlesUIC(ind); ind = ind+1;
  49.     edi_zer = handlesUIC(ind); ind = ind+1;
  50.     txt_zpc = handlesUIC(ind); ind = ind+1;
  51.     tog_res = handlesUIC(ind); ind = ind+1;
  52.     pus_est = handlesUIC(ind); ind = ind+1;
  53. end
  54. switch option
  55.     case 'create'
  56.         % Get Globals.
  57.         %--------------
  58.         [Def_Txt_Height,Def_Btn_Height,Def_Btn_Width,Pop_Min_Width, ...
  59.          X_Spacing,Y_Spacing,sliYProp,Def_FraBkColor,Def_EdiBkColor] = ...
  60.             mextglob('get',...
  61.                 'Def_Txt_Height','Def_Btn_Height','Def_Btn_Width',   ...
  62.                 'Pop_Min_Width','X_Spacing','Y_Spacing','Sli_YProp', ...
  63.                 'Def_FraBkColor','Def_EdiBkColor');
  64.         % Defaults.
  65.         %----------
  66.         xleft = Inf; xright  = Inf; xloc = Inf;
  67.         ytop  = Inf; ybottom = Inf; yloc = Inf;
  68.         bkColor = Def_FraBkColor;
  69.         enaVal  = 'Off';
  70.         %------------------------
  71.         ydir   = -1;
  72.         levmin = 1;
  73.         levmax = def_lev_anal;
  74.         levmaxMAX = max_lev_anal;
  75.         levANAL = def_lev_anal;
  76.         visVal = 'On';        
  77.         isbior = 0;
  78.         statusINI = 'On';
  79.         toolOPT   = 'deno';
  80.         %------------------------
  81.         % Inputs.
  82.         %--------        
  83.         nbarg = length(varargin);
  84.         for k=1:2:nbarg
  85.             arg = lower(varargin{k});
  86.             switch arg
  87.               case 'left'     , xleft     = varargin{k+1};
  88.               case 'right'    , xright    = varargin{k+1};
  89.               case 'xloc'     , xloc      = varargin{k+1};
  90.               case 'bottom'   , ybottom   = varargin{k+1};
  91.               case 'top'      , ytop      = varargin{k+1};
  92.               case 'yloc'     , yloc      = varargin{k+1};
  93.               case 'bkcolor'  , bkColor   = varargin{k+1};
  94.               case 'visible'  , visVal    = varargin{k+1};
  95.               case 'enable'   , enaVal    = varargin{k+1};
  96.               case 'isbior'   , isbior    = varargin{k+1};
  97.               case 'ydir'     , ydir      = varargin{k+1};
  98.               case 'levmin'   , levmin    = varargin{k+1};
  99.               case 'levmax'   , levmax    = varargin{k+1};
  100.               case 'levmaxmax', levmaxMAX = varargin{k+1};
  101.               case 'levanal'  , levANAL   = varargin{k+1};
  102.               case 'status'   , statusINI = varargin{k+1};
  103.               case 'toolopt'  , toolOPT   = varargin{k+1};
  104.             end 
  105.         end
  106.         % Structure initialization.
  107.         %--------------------------
  108.         % h_CMD_LVL: [txt_lev ; sli_lev ; edi_lev] x Level
  109.         % h_GRA_LVL: [axe_thr ; lin_min ; lin_max] x Dir x Level
  110.         h_CMD_LVL = NaN*ones(3,levmaxMAX);        
  111.         h_GRA_LVL = NaN*ones(3,3,levmaxMAX);
  112.         threshDEF = NaN*ones(3,levmaxMAX);
  113.         thrStruct = struct('value',threshDEF,'max',threshDEF);
  114.         ud = struct(...
  115.                 'toolOPT',toolOPT, ...
  116.                 'status',statusINI,...
  117.                 'levmin',levmin,   ...
  118.                 'levmax',levmax,   ...
  119.                 'levmaxMAX',levmaxMAX, ...
  120.                 'levANAL',levANAL, ...
  121.                 'thrStruct',thrStruct, ...            
  122.                 'visible',lower(visVal),...
  123.                 'ydir', ydir,          ...
  124.                 'isbior',isbior,       ...
  125.                 'handlesUIC',[],       ...
  126.                 'h_CMD_LVL',h_CMD_LVL, ...
  127.                 'h_GRA_LVL',h_GRA_LVL, ...
  128.                 'handleORI' ,[],       ... 
  129.                 'handleTHR',[],        ... 
  130.                 'handleRES' ,[]        ... 
  131.                 );
  132.         % Figure units.
  133.         %--------------
  134.         str_numfig = num2mstr(fig);
  135.         old_units  = get(fig,'units');
  136.         fig_units  = 'pixels';
  137.         if ~isequal(old_units,fig_units), set(fig,'units',fig_units); end       
  138.         % Positions utilities.
  139.         %---------------------
  140.         dx = X_Spacing; bdx = 3;
  141.         dy = Y_Spacing; bdy = 4;       
  142.         d_txt  = (Def_Btn_Height-Def_Txt_Height);
  143.         deltaY = (Def_Btn_Height+dy);
  144.         d_lev  = 2;
  145.         sli_hi = Def_Btn_Height*sliYProp;
  146.         sli_dy = 0.5*Def_Btn_Height*(1-sliYProp);
  147.         % Setting frame position.
  148.         %------------------------
  149.         switch  toolOPT
  150.           case {'deno','esti'} , NB_Height = 7;
  151.           case {'comp'}        , NB_Height = 8;
  152.         end
  153.         w_fra   = wfigmngr('get',fig,'fra_width');
  154.         h_fra   = (levmaxMAX+NB_Height)*Def_Btn_Height+...
  155.                    levmaxMAX*d_lev+ (NB_Height-2)*bdy;
  156.         xleft   = utposfra(xleft,xright,xloc,w_fra);
  157.         ybottom = utposfra(ybottom,ytop,yloc,h_fra);
  158.         pos_fra = [xleft,ybottom,w_fra,h_fra];
  159.         % String property of objects.
  160.         %----------------------------
  161.         str_txt_top = 'Select thresholding method';
  162.         str_txt_BMS = '-       Sparsity       +';
  163.         str_pop_dir = strvcat('Horizontal details coefs', ...
  164.                               'Diagonal details coefs',   ...
  165.                               'Vertical details coefs'  );
  166.         str_txt_tit = strvcat('Level','Select','Thresh');
  167.         str_tog_res = 'Residuals';
  168.         str_pop_met = wthrmeth(toolOPT,'names');
  169.         switch  toolOPT
  170.           case {'deno','esti'}
  171.             str_rad_sof = 'soft';
  172.             str_rad_har = 'hard';
  173.             str_txt_noi = 'Select noise structure';
  174.             str_pop_noi = strvcat(...
  175.                 'Unscaled white noise', ...
  176.                 'Scaled white noise',   ...
  177.                 'Non-white noise'       ...
  178.                 );
  179.           case 'comp'
  180.             if ud.isbior
  181.                 str_txt_nor = 'Norm cfs recovery';
  182.             else
  183.                 str_txt_nor = 'Retained energy';
  184.             end
  185.             str_txt_zer = 'Number of zeros';
  186.         end
  187.         switch  toolOPT
  188.           case 'deno' , str_pus_est = 'De-noise'; estOPT = 'denoise';
  189.           case 'comp' , str_pus_est = 'Compress'; estOPT = 'compress';
  190.           case 'esti' , str_pus_est = 'Estimate'; estOPT = 'estimate';
  191.         end
  192.         % Position properties.
  193.         %---------------------
  194.         txt_width   = Def_Btn_Width;
  195.         dy_lev      = Def_Btn_Height+d_lev;
  196.         xleft       = xleft+bdx;
  197.         w_rem       = w_fra-2*bdx;
  198.         ylow        = ybottom+h_fra-Def_Btn_Height-bdy;
  199.         w_uic       = (5*txt_width)/2;
  200.         x_uic       = xleft+(w_rem-w_uic)/2;
  201.         y_uic       = ylow;
  202.         pos_txt_top = [x_uic, y_uic+d_txt/2, w_uic, Def_Txt_Height];
  203.         y_uic       = y_uic-Def_Btn_Height;
  204.         pos_pop_met = [x_uic, y_uic, w_uic, Def_Btn_Height];
  205.         y_uic       = y_uic-Def_Btn_Height;
  206.         switch  toolOPT
  207.           case {'deno','esti'}
  208.             y_uic       = y_uic-bdy;
  209.             w_rad       = Pop_Min_Width;
  210.             w_sep       = (w_uic-2*w_rad)/3;
  211.             x_rad       = x_uic+w_sep;
  212.             pos_rad_sof = [x_rad, y_uic, w_rad, Def_Btn_Height];
  213.             x_rad       = x_rad+w_rad+w_sep;
  214.             pos_rad_har = [x_rad, y_uic, w_rad, Def_Btn_Height];
  215.             y_uic       = y_uic-Def_Btn_Height;
  216.             y_BMS       = y_uic;
  217.             pos_txt_noi = [x_uic, y_uic, w_uic, Def_Txt_Height];
  218.             y_uic       = y_uic-Def_Btn_Height;
  219.             pos_pop_noi = [x_uic, y_uic, w_uic, Def_Btn_Height];
  220.           case 'comp'
  221.             y_BMS       = y_uic;
  222.             y_uic       = y_uic-Def_Btn_Height;
  223.         end
  224.         pos_txt_BMS = [x_uic, y_BMS, w_uic, Def_Txt_Height];
  225.         y_BMS       = y_BMS-Def_Btn_Height;
  226.         w_BMS       = (w_uic-bdx)/3;
  227.         pos_sli_BMS = [x_uic+w_BMS/2, y_BMS+sli_dy, 2*w_BMS, sli_hi];
  228.         y_uic       = y_uic-Def_Btn_Height-bdy;
  229.         pos_pop_dir = [x_uic, y_uic, w_uic, Def_Btn_Height];
  230.         wx          = 2;
  231.         wbase       = 2*(w_rem-4*wx)/5;
  232.         w_lev       = [6*wbase ; 15*wbase ; 9*wbase]/12;
  233.         x_uic       = xleft+wx;
  234.         y_uic       = y_uic-Def_Btn_Height;
  235.         pos_lev_tit = [x_uic, y_uic, w_lev(1), Def_Txt_Height];
  236.         pos_lev_tit = pos_lev_tit(ones(1,3),:);
  237.         pos_lev_tit(:,3) = w_lev; 
  238.         for k=1:2 , pos_lev_tit(k+1,1) = pos_lev_tit(k,1)+pos_lev_tit(k,3); end
  239.         y_uic = pos_lev_tit(1,2)-levmaxMAX*(Def_Btn_Height+d_lev);
  240.         switch  toolOPT
  241.           case {'deno','esti'}
  242.           case {'comp'}
  243.             wid1 = (15*w_rem)/26;
  244.             wid2 = (8*w_rem)/26;
  245.             wid3 = (2*w_rem)/26;
  246.             wx   = (w_rem-wid1-wid2-wid3)/4;
  247.             y_uic       = y_uic-Def_Btn_Height-bdy;
  248.             pos_txt_nor = [xleft, y_uic+d_txt/2, wid1, Def_Txt_Height];
  249.             x_uic       = pos_txt_nor(1)+pos_txt_nor(3)+wx;
  250.             pos_edi_nor = [x_uic, y_uic, wid2, Def_Btn_Height];
  251.             x_uic       = pos_edi_nor(1)+pos_edi_nor(3)+wx;
  252.             pos_txt_npc = [x_uic, y_uic+d_txt/2, wid3, Def_Txt_Height];
  253.             y_uic       = y_uic-Def_Btn_Height-bdy;
  254.             pos_txt_zer = [xleft, y_uic+d_txt/2, wid1, Def_Txt_Height];
  255.             x_uic       = pos_txt_zer(1)+pos_txt_zer(3)+wx;
  256.             pos_edi_zer = [x_uic, y_uic, wid2, Def_Btn_Height];
  257.             x_uic       = pos_edi_zer(1)+pos_edi_zer(3)+wx;
  258.             pos_txt_zpc = [x_uic, y_uic+d_txt/2, wid3, Def_Txt_Height];
  259.         end
  260.         w_uic = w_fra/2-bdx;
  261.         x_uic = pos_fra(1);
  262.         h_uic = (3*Def_Btn_Height)/2;
  263.         y_uic = pos_fra(2)-h_uic-Def_Btn_Height/2;
  264.         pos_pus_est = [x_uic, y_uic, w_uic, h_uic];
  265.         x_uic = x_uic+w_uic+2*bdx;
  266.         pos_tog_res = [x_uic, y_uic, w_uic, h_uic];
  267.         % Create UIC.
  268.         %------------
  269.         comProp = {...
  270.            'Parent',fig,    ...
  271.            'Unit',fig_units ...
  272.            'Visible','On'  ...
  273.            };
  274.         comTxtProp = {comProp{:}, ...
  275.            'Style','Text',...
  276.            'HorizontalAlignment','center', ...
  277.            'Backgroundcolor',bkColor ...
  278.            };
  279.         fra_utl = uicontrol(comProp{:}, ...
  280.                             'Style','frame', ...
  281.                             'Position',pos_fra, ...
  282.                             'Backgroundcolor',bkColor, ...
  283.                             'Tag',tag_fra_tool ...
  284.                             );
  285.         txt_top = uicontrol(comProp{:}, ...
  286.                             'Style','Text', ...
  287.                             'Position',pos_txt_top,   ...
  288.                             'String',str_txt_top,     ...
  289.                             'Backgroundcolor',bkColor ...
  290.                             );
  291.         cba = [mfilename '(''update_methName'',' str_numfig ');'];
  292.         pop_met = uicontrol(comProp{:}, ...
  293.                             'Style','Popup',...
  294.                             'Position',pos_pop_met,...
  295.                             'Enable',statusINI, ...
  296.                             'String',str_pop_met,...
  297.                             'HorizontalAlignment','center',...
  298.                             'Userdata',1,...
  299.                             'Callback',cba ...
  300.                             );
  301.         switch  toolOPT
  302.           case {'deno','esti'}
  303.             rad_sof = uicontrol(comProp{:}, ...
  304.                                 'Style','RadioButton',...
  305.                                 'Position',pos_rad_sof,...
  306.                                 'Enable',statusINI, ...
  307.                                 'HorizontalAlignment','center',...
  308.                                 'String',str_rad_sof,...
  309.                                 'Value',1,'Userdata',1 ...
  310.                                 );
  311.             rad_har = uicontrol(comProp{:}, ...
  312.                                 'Style','RadioButton',...
  313.                                 'Position',pos_rad_har,...
  314.                                 'Enable',statusINI, ...
  315.                                 'HorizontalAlignment','center',...
  316.                                 'String',str_rad_har,...
  317.                                 'Value',0,'Userdata',0 ...
  318.                                 );
  319.             cba = [mfilename '(''update_thrType'',' str_numfig ');'];
  320.             set(rad_sof,'Callback',cba);
  321.             set(rad_har,'Callback',cba);
  322.             txt_noi = uicontrol(comProp{:}, ...
  323.                                 'Style','Text',...
  324.                                 'Position',pos_txt_noi,...
  325.                                 'Backgroundcolor',bkColor,...
  326.                                 'String',str_txt_noi...
  327.                                 );
  328.             cba = [mfilename '(''update_by_Caller'',' str_numfig ');'];
  329.             pop_noi = uicontrol(comProp{:}, ...
  330.                                 'Style','Popup',...
  331.                                 'Position',pos_pop_noi,...
  332.                                 'Enable',statusINI, ...
  333.                                 'String',str_pop_noi,...
  334.                                 'HorizontalAlignment','center',...
  335.                                 'Userdata',1,...
  336.                                 'Callback',cba ...
  337.                                 );
  338.           case {'comp'}
  339.         end
  340.         txt_BMS = uicontrol(comProp{:}, ...
  341.                             'Style','Text',...
  342.                             'Position',pos_txt_BMS,...
  343.                             'Backgroundcolor',bkColor,...
  344.                             'String',str_txt_BMS...
  345.                             );
  346.         cba = [mfilename '(''update_by_Caller'',' str_numfig ');'];
  347.         sli_BMS = uicontrol(comProp{:}, ...
  348.                             'Style','Slider',...
  349.                             'Position',pos_sli_BMS,...
  350.                             'Enable',statusINI,    ...
  351.                             'Min',1+sqrt(eps),     ...
  352.                             'Max',5-sqrt(eps),     ...
  353.                             'Value',1.5,           ...
  354.                             'Backgroundcolor',bkColor, ...
  355.                             'Callback',cba         ...
  356.                             );
  357.         cba = [mfilename '(''update_DIR'',' str_numfig ');'];
  358.         pop_dir = uicontrol(comProp{:}, ...
  359.                             'Style','Popup',...
  360.                             'Position',pos_pop_dir,...
  361.                             'Enable',statusINI,    ...
  362.                             'String',str_pop_dir,  ...
  363.                             'Userdata',1,          ...
  364.                             'Callback',cba         ...
  365.                             );
  366.         txt_tit = zeros(3,1);
  367.         for k=1:3
  368.             txt_tit(k) = uicontrol(...
  369.                                    comTxtProp{:}, ...
  370.                                    'Position',pos_lev_tit(k,:), ...
  371.                                    'String',deblank(str_txt_tit(k,:))...
  372.                                    );
  373.         end
  374.         xbtn0 = xleft;
  375.         ybtn0 = pos_lev_tit(1,2)-Def_Btn_Height;
  376.         xbtn  = xbtn0;
  377.         ybtn  = ybtn0;
  378.         if ud.ydir==1
  379.             index = [1:levmaxMAX];
  380.         else
  381.             index = [levmaxMAX:-1:1];
  382.             ybtn  = ybtn0+(levmaxMAX-levmax)*dy_lev;
  383.         end
  384.         for j=1:length(index)
  385.             i = index(j);
  386.             max_lev = 1;
  387.             val_lev = 0.5;
  388.             pos_lev = [xbtn ybtn+d_txt/2 w_lev(1) Def_Txt_Height];
  389.             str_lev = sprintf('%.0f',i);
  390.             txt_lev = uicontrol(...
  391.                               comTxtProp{:},     ...
  392.                               'Position',pos_lev,...
  393.                               'String',str_lev,  ...
  394.                               'Userdata',i       ...
  395.                               );
  396.             xbtn    = xbtn+w_lev(1)+wx;
  397.             pos_lev = [xbtn, ybtn+sli_dy, w_lev(2), sli_hi];
  398.             sli_lev = uicontrol(...
  399.                               comProp{:},         ...
  400.                               'Style','Slider',   ...
  401.                               'Enable',enaVal,    ...
  402.                               'Position',pos_lev, ...
  403.                               'Min',0,            ...
  404.                               'Max',max_lev,      ...
  405.                               'Value',val_lev,    ...
  406.                               'Userdata',i        ...
  407.                               );
  408.             xbtn    = xbtn+w_lev(2)+wx;
  409.             pos_lev = [xbtn ybtn w_lev(3) Def_Btn_Height];
  410.             str_val = sprintf('%1.4g',val_lev);
  411.             edi_lev = uicontrol(...
  412.                               comProp{:},         ...
  413.                               'Style','Edit',     ...
  414.                               'Enable',enaVal,    ...
  415.                               'Position',pos_lev, ...
  416.                               'String',str_val,   ...
  417.                               'HorizontalAlignment','center',...
  418.                               'Backgroundcolor',Def_EdiBkColor,...
  419.                               'Userdata',i          ...
  420.                               );
  421.             beg_cba = [mfilename '(''update_by_UIC'',' str_numfig ',' str_lev];
  422.             cba_sli = [beg_cba ',''sli'');'];
  423.             cba_edi = [beg_cba ',''edi'');'];
  424.             set(sli_lev,'Callback',cba_sli);
  425.             set(edi_lev,'Callback',cba_edi);
  426.             h_CMD_LVL(:,i) = [txt_lev ; sli_lev ; edi_lev];
  427.             xbtn = xbtn0;
  428.             ybtn = ybtn-dy_lev;
  429.         end
  430.         switch  toolOPT
  431.           case {'deno','esti'}
  432.           case {'comp'}
  433.             comEdiProp = {comProp{:}, ...
  434.                 'Style','Edit',...
  435.                 'String','',...
  436.                 'Enable','Inactive', ...
  437.                 'Backgroundcolor',bkColor,...
  438.                 'HorizontalAlignment','center'...
  439.                 };
  440.             txt_nor = uicontrol(comTxtProp{:}, ...
  441.                                 'Position',pos_txt_nor,...
  442.                                 'HorizontalAlignment','left',...
  443.                                 'String',str_txt_nor...
  444.                                 );
  445.             cba_nor = [mfilename '(''updateTHR'',' str_numfig ',''nor'');'];
  446.             edi_nor = uicontrol(comEdiProp{:}, ...
  447.                                 'Position',pos_edi_nor,...
  448.                                 'Callback',cba_nor ...
  449.                                 );
  450.             txt_npc = uicontrol(comTxtProp{:}, ...
  451.                                 'Position',pos_txt_npc,...
  452.                                 'String','%'...
  453.                                 );
  454.             txt_zer = uicontrol(comTxtProp{:}, ...
  455.                                 'Position',pos_txt_zer,...
  456.                                 'HorizontalAlignment','left',...
  457.                                 'String',str_txt_zer...
  458.                                 );
  459.             cba_zer = [mfilename '(''updateTHR'',' str_numfig ',''zer'');'];
  460.             edi_zer = uicontrol(comEdiProp{:}, ...
  461.                                 'Position',pos_edi_zer,...
  462.                                 'Callback',cba_zer ...
  463.                                 );
  464.             txt_zpc = uicontrol(comTxtProp{:}, ...
  465.                                 'Position',pos_txt_zpc,...
  466.                                 'String','%'...
  467.                                 );
  468.         end
  469.         cba = [mfilename '(''residuals'',' str_numfig ');'];
  470.         tip = 'More on Residuals';
  471.         tog_res = uicontrol(...
  472.                             comProp{:},             ...
  473.                             'Style','Togglebutton', ...
  474.                             'Position',pos_tog_res, ...
  475.                             'String',str_tog_res,   ...
  476.                             'Enable','off',         ...
  477.                             'Callback',cba,         ...
  478.                             'tooltip',tip,          ...
  479.                             'Interruptible','Off'   ...
  480.                             );
  481.         cba_pus_est = [mfilename '(''' estOPT ''',' str_numfig ');'];
  482.         pus_est = uicontrol(comProp{:},             ...
  483.                             'Style','Pushbutton',   ...
  484.                             'Position',pos_pus_est, ...
  485.                             'String',xlate(str_pus_est),   ...
  486.                             'Enable',enaVal,        ...
  487.                             'callback',cba_pus_est  ...
  488.                             );
  489. % Add Context Sensitive Help (CSHelp).
  490. %-------------------------------------
  491.         switch  toolOPT
  492.           case {'deno','esti'}
  493. hdl_DENO_SOFTHARD   = [rad_sof,rad_har];
  494. hdl_DENO_NOISSTRUCT = [txt_noi,pop_noi];
  495. wfighelp('add_ContextMenu',fig,hdl_DENO_SOFTHARD,'DENO_SOFTHARD');
  496. wfighelp('add_ContextMenu',fig,hdl_DENO_NOISSTRUCT,'DENO_NOISSTRUCT');
  497.           case {'comp'}
  498. hdl_COMP_SCORES = [...
  499. txt_nor,edi_nor,txt_npc,txt_zer,edi_zer,txt_zpc ...
  500. ];   
  501. wfighelp('add_ContextMenu',fig,hdl_COMP_SCORES,'COMP_SCORES');
  502.         end
  503.         hdl_COMP_DENO_STRA = [...
  504. fra_utl,txt_top,pop_met,txt_BMS,sli_BMS,  ...
  505. ];
  506. wfighelp('add_ContextMenu',fig,hdl_COMP_DENO_STRA,'COMP_DENO_STRA');
  507. %-------------------------------------
  508. % Store handles.
  509. %--------------
  510.         switch  toolOPT
  511.           case {'deno','esti'}
  512.             ud.handlesUIC = ...
  513.                 [fra_utl;txt_top;pop_met;...
  514.                 rad_sof;rad_har;txt_noi;pop_noi; ...
  515.                 txt_BMS;sli_BMS;pop_dir;txt_tit(1:3); ...
  516.                 NaN;NaN;NaN;NaN;NaN;NaN; ...
  517.                 tog_res;pus_est];
  518.           case {'comp'}
  519.             ud.handlesUIC = ...
  520.                 [fra_utl;txt_top;pop_met; ...
  521.                 NaN;NaN;NaN;NaN; ...
  522.                 txt_BMS;sli_BMS;pop_dir;txt_tit(1:3);...
  523.                 txt_nor;edi_nor;txt_npc;txt_zer;edi_zer;txt_zpc; ...
  524.                 tog_res;pus_est];
  525.         end        
  526.         ud.h_CMD_LVL = h_CMD_LVL;
  527.         ud.h_GRA_LVL = h_GRA_LVL;
  528.         set(fra_utl,'Userdata',ud);
  529.         varargout{1} = utthrw2d('set',fig,'position',{levmin,levmax});
  530.     case 'status'
  531.       if length(varargin)>0
  532.          toolStatus = varargin{1};
  533.          ud.status  = toolStatus;
  534.          set(fra,'Userdata',ud);
  535.          set([pop_met;rad_sof;rad_har;...
  536.               pop_noi;sli_BMS;pop_dir],'Enable',toolStatus)
  537.          if isequal(lower(toolStatus),'off')
  538.              utthrw2d('enable',fig,'off')
  539.          end       
  540.       end
  541.       varargout{1} = toolStatus;
  542.     case 'enable'
  543.         enaVal = varargin{1};
  544.         if length(varargin)>1
  545.             levs = varargin{2};
  546.         else
  547.             levs = [1:size(h_GRA_LVL,3)];
  548.         end
  549.         uic = h_CMD_LVL(2:3,:);
  550.         set([uic(:);tog_res;pus_est],'Enable','off');
  551.         if isequal(lower(enaVal),'on')
  552.             uic = h_CMD_LVL(2:3,levs);
  553.             set([uic(:);pus_est],'Enable',enaVal);
  554.         end
  555.     case 'enable_tog_res'
  556.         enaVal = varargin{1};
  557.         set(tog_res,'Enable',enaVal);
  558.     case 'visible'
  559.         visVal     = lower(varargin{1});
  560.         ud.visible = visVal;
  561.         handlesAXE = h_GRA_LVL(1,:,ud.levmin:ud.levmax);
  562.         handlesAXE = findobj(handlesAXE(ishandle(handlesAXE(:))));
  563.         if isequal(visVal,'on')
  564.             h_CMD_LVL = h_CMD_LVL(1:3,ud.levmin:ud.levmax);
  565.             numMeth = get(pop_met,'value');
  566.             switch toolOPT
  567.               case {'deno','esti'}
  568.                 switch numMeth
  569.                   case {1,5}   , invis = [txt_BMS;sli_BMS];
  570.                   case {2,3,4} , invis = [txt_noi;pop_noi];
  571.                 end
  572.               case {'comp'}
  573.                 switch numMeth
  574.                    case {1,2,3} , invis = [];
  575.                    case {4,5,6} , invis = [txt_BMS;sli_BMS];
  576.                 end 
  577.             end
  578.             handlesUIC = setdiff(handlesUIC,invis);
  579.         end
  580.         handles = [h_CMD_LVL(:);handlesAXE(:);handlesUIC(:)];
  581.         set(handles(ishandle(handles)),'visible',visVal);
  582.     case 'set'
  583.         nbarg = length(varargin);
  584.         if nbarg<1 , return; end
  585.         for k = 1:2:nbarg
  586.            argType = lower(varargin{k});
  587.            argVal  = varargin{k+1};
  588.            switch argType
  589.                case 'position'
  590.                  [levmin,levmax] = deal(argVal{:});
  591.                  nblevs = levmax-levmin+1;
  592.                  if ud.ydir==1
  593.                      dnum_lev = (levmin-ud.levmin);
  594.                  else
  595.                      dnum_lev = (ud.levmax-levmax);
  596.                  end
  597.                  ud.levmin = levmin;
  598.                  ud.levmax = levmax;
  599.                  set(fra,'Userdata',ud);
  600.                  old_units = get(fig,'units');
  601.                  tmpHandles = [h_CMD_LVL(:);handlesUIC(:)];
  602.                  tmpHandles = tmpHandles(ishandle(tmpHandles));
  603.                  set(tmpHandles,'visible','off');
  604.                  set([fig;tmpHandles],'units','pixels');
  605.                  [pos_fra,dy_lev,y_res,y_est] = getPosFraThr(fra,nblevs,toolOPT);
  606.                  set(fra,'Position',pos_fra);
  607.                  ytrans = dnum_lev*dy_lev;
  608.                  [row,col] = size(h_CMD_LVL);
  609.                  for j=1:col
  610.                      for k = 1:row
  611.                          p = get(h_CMD_LVL(k,j),'Position');
  612.                          set(h_CMD_LVL(k,j),'Position',[p(1),p(2)+ytrans,p(3:4)]);
  613.                      end
  614.                  end
  615.                  p = get(tog_res,'Position');
  616.                  set(tog_res,'Position',[p(1),y_res,p(3:4)]);
  617.                  ytrans = y_res-p(2);
  618.                  p = get(pus_est,'Position');
  619.                  set(pus_est,'Position',[p(1),y_est,p(3:4)]);
  620.                  switch toolOPT
  621.                    case {'comp'}
  622.                      tmpHDL = [txt_nor;edi_nor;txt_npc;txt_zer;edi_zer;txt_zpc];
  623.                      for k = 1:length(tmpHDL)
  624.                          p = get(tmpHDL(k),'Position');
  625.                          set(tmpHDL(k),'Position',[p(1),p(2)+ytrans,p(3:4)]);
  626.                      end                  
  627.                  end
  628.                  set([fig;tmpHandles],'units',old_units);
  629.                  utthrw2d('visible',fig,ud.visible);
  630.                  if nargout>0
  631.                      varargout{1} = [pos_fra(1) , y_est , pos_fra([3 4])];
  632.                  end
  633.                case 'axes'
  634.                  [row,col] = size(argVal);
  635.                  ud.h_GRA_LVL(1,1:row,1:col) = argVal;
  636.                  set(fra,'Userdata',ud);
  637.                case 'handleori' , ud.handleORI = argVal; set(fra,'Userdata',ud);
  638.                case 'handlethr' , ud.handleTHR = argVal; set(fra,'Userdata',ud);
  639.                case 'handleres' , ud.handleRES = argVal; set(fra,'Userdata',ud);
  640.                case 'perfos'  
  641.                  switch toolOPT
  642.                    case {'comp'}
  643.                      set(edi_nor,'string',sprintf('%5.2f',argVal{1}));
  644.                      set(edi_zer,'string',sprintf('%5.2f',argVal{2}));
  645.                  end
  646.                case {'valthr','maxthr'}
  647.                  threshDEF = NaN*ones(3,ud.levmaxMAX);
  648.                  sizARG = size(argVal);
  649.                  NB_old = ud.levmax-ud.levmin+1;
  650.                  if (sizARG(1)==3) && (sizARG(2)>NB_old)
  651.                     Cbeg = 1; Cend = sizARG(2);
  652.                  else
  653.                     Cbeg = ud.levmin; Cend = ud.levmax;
  654.                  end
  655.                  threshDEF(:,Cbeg:Cend) = argVal;
  656.                  if isequal(argType,'valthr')
  657.                      ud.thrStruct.value = threshDEF;
  658.                  else
  659.                      ud.thrStruct.max = threshDEF;
  660.                  end
  661.                  set(fra,'Userdata',ud);
  662.            end
  663.         end
  664.     case 'get'
  665.         nbarg = length(varargin);
  666.         if nbarg<1 , return; end
  667.         for k = 1:nbarg
  668.            outType = lower(varargin{k});
  669.            switch outType
  670.                case 'position'
  671.                  pos_fra = get(fra,'Position');
  672.                  pos_est = get(pus_est,'Position');
  673.                  varargout{k} = [pos_fra(1) , pos_est(2) , pos_fra([3 4])];
  674.                case 'valthr' ,
  675.                  varargout{k} = ud.thrStruct.value(:,ud.levmin:ud.levmax);
  676.                case 'allvalthr' , varargout{k} = ud.thrStruct.value;                 
  677.                case 'maxthr'    , varargout{k} = ud.thrStruct.max;
  678.                case {'pus_den','pus_est','pus_com'} , varargout{k} = pus_est;
  679.                case 'handleori' , varargout{k} = ud.handleORI;
  680.                case 'handlethr' , varargout{k} = ud.handleTHR;
  681.                case 'handleres' , varargout{k} = ud.handleRES;
  682.            end
  683.         end
  684.     case 'update_methName'
  685.         numMeth = get(pop_met,'value');
  686.         switch toolOPT
  687.           case {'deno','esti'}
  688.             HDL_1 = [txt_BMS;sli_BMS];
  689.             HDL_2 = [txt_noi;pop_noi];
  690.             switch numMeth
  691.               case {1,5}
  692.                 invis  = HDL_1;   vis = HDL_2;
  693.                 radDef = rad_sof; radNoDef = rad_har;
  694.               case {2,3,4}
  695.                 invis  = HDL_2;   vis = HDL_1;
  696.                 radDef = rad_har; radNoDef = rad_sof;
  697.             end
  698.             set(sli_BMS,'value',3)
  699.             set(invis,'Visible','off')
  700.             set(vis,'Visible','on')
  701.             set(radDef,'Value',1,'Userdata',1);
  702.             set(radNoDef,'Value',0,'Userdata',0);
  703.           case {'comp'}
  704.             HDL_1 = [txt_BMS;sli_BMS];
  705.             HDL_2 = [];
  706.             switch numMeth
  707.               case {1,2,3} , invis = HDL_2; vis = HDL_1;
  708.               case {4,5,6} , invis = HDL_1; vis = HDL_2;
  709.             end
  710.             set(sli_BMS,'value',1.5);
  711.             set(invis,'Visible','off')
  712.             set(vis,'Visible','on')
  713.         end
  714.         utthrw2d('update_by_Caller',fig)
  715.     case 'update_DIR'
  716.         newDIR = get(pop_dir,'Value');
  717.         oldDIR = get(pop_dir,'Userdata');
  718.         if isequal(newDIR,oldDIR) , return; end
  719.         set(pop_dir,'Userdata',newDIR)
  720.         valTHR = ud.thrStruct.value(newDIR,:);
  721.         maxTHR = ud.thrStruct.max(newDIR,:);
  722.         for k = ud.levmin:ud.levmax
  723.             set(h_CMD_LVL(2,k),'Min',0,'Max',maxTHR(k),'Value',valTHR(k));
  724.             set(h_CMD_LVL(3,k),'String',sprintf('%1.4g',valTHR(k)));
  725.         end
  726.     case 'update_by_UIC'
  727.         level    = varargin{1};
  728.         type_hdl = varargin{2};
  729.         sli = h_CMD_LVL(2,level);
  730.         edi = h_CMD_LVL(3,level);
  731.         dir = get(pop_dir,'Value');
  732.         lHu = h_GRA_LVL(2,dir,level);
  733.         lHd = h_GRA_LVL(3,dir,level);
  734.         % Updating threshold.
  735.         %---------------------
  736.         switch type_hdl
  737.             case 'sli'
  738.               thresh = get(sli,'value');
  739.               set(edi,'string',sprintf('%1.4g',thresh));
  740.             case 'edi'
  741.               valstr = get(edi,'string');
  742.               [thresh,count,err] = sscanf(valstr,'%f');
  743.               if (count~=1) || ~isempty(err)
  744.                   thresh = get(sli,'Value');
  745.                   set(edi,'string',sprintf('%1.4g',thresh));
  746.                   return
  747.               else
  748.                   mi = get(sli,'Min');
  749.                   ma = get(sli,'Max');
  750.                   if     thresh<mi , thresh = mi;
  751.                   elseif thresh>ma , thresh = ma;
  752.                   end
  753.                   set(sli,'Value',thresh);
  754.                   set(edi,'string',sprintf('%1.4g',thresh));
  755.               end
  756.         end
  757.         xdata = [thresh thresh];
  758.         set(lHu,'Xdata', xdata);
  759.         if thresh<sqrt(eps) , xdata = [NaN NaN]; end
  760.         set(lHd,'Xdata',-xdata);
  761.         feval(calledFUN,'clear_GRAPHICS',fig);
  762.         utthrw2d('update_thrStruct',fig,dir,level,thresh);
  763.         if isequal(toolOPT,'comp') , utthrw2d('show_LVL_perfos',fig); end
  764.     case 'update_thrType'
  765.         rad = gcbo;
  766.         old = get(rad,'userdata');
  767.         if old==1 , set(rad,'Value',1); return; end
  768.         if isequal(rad,rad_sof)
  769.            type = 's'; other = rad_har;
  770.         else
  771.            type = 'h'; other = rad_sof;           
  772.         end
  773.         set(other,'Value',0,'Userdata',0);
  774.         set(rad,'Value',1,'Userdata',1);
  775.         feval(calledFUN,'clear_GRAPHICS',fig);
  776.     case 'update_by_Caller'
  777.         feval(calledFUN,'update_LVL_meth',fig);
  778.     case 'get_LVL_par'
  779.         numMeth = get(pop_met,'value');
  780.         meth    = wthrmeth(toolOPT,'shortnames',numMeth);
  781.         switch  toolOPT
  782.           case {'deno','esti'}             
  783.              valType = get(rad_sof,'value');
  784.              if valType==1 , sorh = 's'; else , sorh = 'h'; end
  785.              switch numMeth
  786.                case {1,5}
  787.                  valNoise = get(pop_noi,'value');
  788.                  switch valNoise
  789.                    case 1 , scal = 'sln';
  790.                    case 2 , scal = 'one';
  791.                    case 3 , scal = 'mln';
  792.                  end
  793.                case {2,3,4}, scal = get(sli_BMS,'value');
  794.              end
  795.              varargout = {numMeth,meth,scal,sorh};
  796.           case {'comp'}
  797.              sorh = 'h';
  798.              switch numMeth
  799.                case {1,2,3} , scal = get(sli_BMS,'value');
  800.                case {4,5,6} , scal = get(sli_BMS,'value'); % Not Used           
  801.              end
  802.              varargout = {numMeth,meth,scal,sorh};
  803.         end
  804.     case 'update_LVL_meth'
  805.         % called by : calledFUN('update_LVL_meth', ...)
  806.         %-------------------------------------------
  807.         valTHR = varargin{1};
  808.         NB_lev = size(valTHR,2);
  809.         maxTHR = utthrw2d('get',fig,'maxTHR');
  810.         maxTHR = maxTHR(:,ud.levmin:NB_lev);        
  811.         valTHR = min(valTHR,maxTHR);
  812.         
  813.         utthrw2d('set',fig,'valTHR',valTHR);
  814.         direct = get(pop_dir,'Value'); 
  815.         sli_lev = h_CMD_LVL(2,1:NB_lev);
  816.         edi_lev = h_CMD_LVL(3,1:NB_lev);        
  817.         for k = 1:NB_lev
  818.             thr  = valTHR(direct,k);
  819.             set(sli_lev(k),'Value',thr);
  820.             set(edi_lev(k),'string',sprintf('%1.4g',thr));            
  821.         end
  822.         for k = 1:NB_lev
  823.             for d=1:3
  824.                 thr = valTHR(d,k);
  825.                 thr = [thr thr];
  826.                 set(h_GRA_LVL(2,d,k),'Xdata', thr);
  827.                 set(h_GRA_LVL(3,d,k),'Xdata',-thr);
  828.             end
  829.         end
  830.     case 'show_LVL_perfos'
  831.         if isequal(toolOPT,'comp')
  832.             feval(calledFUN,'show_LVL_perfos',fig);
  833.         end
  834.     case 'update_thrStruct'
  835.         % called by : cbthrw2d
  836.         %----------------------
  837.         dir   = varargin{1};
  838.         level = varargin{2};
  839.         thr   = varargin{3};
  840.         ud.thrStruct.value(dir,level) = thr;
  841.         set(fra,'Userdata',ud);
  842.     case {'denoise','compress','estimate'}
  843.         feval(calledFUN,option,fig);
  844.     case 'clean_thr'
  845.         set(h_CMD_LVL(2,:),'Min',0,'Max',1,'Value',0.5);  % sli_lev;
  846.         set(h_CMD_LVL(3,:),'String','');                  % edi_lev
  847.         switch toolOPT
  848.           case {'deno','esti'} , 
  849.           case {'comp'} ,
  850.         end
  851.     case 'residuals'
  852.         wmoreres('create',fig,tog_res,ud.handleRES,ud.handleORI,ud.handleTHR,'blocPAR');
  853.     case 'plot_dec'
  854.         dirDef = get(pop_dir,'Value');
  855.         [thr_max,thr_val,ylim,direct,level,axeAct] = deal(varargin{2}{:});
  856.         if direct==dirDef
  857.             set(h_CMD_LVL(2,level),'Min',0,'Max',thr_max,'Value',thr_val);
  858.             set(h_CMD_LVL(3,level),'String',sprintf('%1.4g',thr_val));
  859.         end
  860.         colTHR = wtbutils('colors','linTHR');
  861.         l_min = line('Linestyle','--',...
  862.                   'Color',colTHR,...
  863.                   'EraseMode','xor',...
  864.                   'Xdata',[thr_val thr_val],...
  865.                   'Ydata',ylim,...
  866.                   'Parent',axeAct);
  867.         l_max = line('Linestyle','--',...
  868.                   'Color',colTHR,...
  869.                   'EraseMode','xor',...
  870.                   'Xdata',[-thr_val -thr_val],...
  871.                   'Ydata',ylim,...
  872.                   'Parent',axeAct);
  873.         setappdata(l_min,'selectPointer','V');
  874.         setappdata(l_max,'selectPointer','V');
  875.         if thr_val==0 , set(l_max,'Visible','Off'); end
  876.         maxval  = num2mstr(thr_max);
  877.         hdl_str = num2mstr(...
  878.                     [fig ; pop_dir ; direct ; level ; ...
  879.                      l_min; l_max; h_CMD_LVL(2:3,level)] ...
  880.                      );
  881.         cba_thr_min = ['cbthrw2d' '(''down'',' hdl_str ',' ...
  882.                                 int2str(+1) ',' maxval ');'];
  883.         cba_thr_max = ['cbthrw2d' '(''down'',' hdl_str ',' ...
  884.                                 int2str(-1) ',' maxval ');'];
  885.         set(l_min,'ButtonDownFcn',cba_thr_min)
  886.         set(l_max,'ButtonDownFcn',cba_thr_max)
  887.         h_GRA_LVL(2:3,direct,level) = [l_min , l_max];
  888.         ud.h_GRA_LVL = h_GRA_LVL;
  889.         set(fra,'Userdata',ud);
  890.     case 'demo'
  891.     % SPECIAL for DEMOS
  892.     %------------------
  893.     [tool,den_Meth,thr_Val] = deal(varargin{:});
  894.     shortnames = wthrmeth(toolOPT,'shortnames');
  895.     ind = strmatch(deblank(den_Meth),shortnames);
  896.     if isempty(ind) , return; end
  897.     set(pop_met,'Value',ind)
  898.     utthrw2d('update_methName',fig)
  899.     if ~isnan(thr_Val)
  900.         utthrw2d('set',fig,'valTHR',thr_Val);
  901.         thr_Val = utthrw2d('get',fig,'valTHR');
  902.         utthrw2d('update_LVL_meth',fig,thr_Val);
  903.     end
  904.     otherwise
  905.         errargt(mfilename,'Unknown Option','msg');
  906.         error('*');
  907. end
  908. %=============================================================================%
  909. % INTERNAL FUNCTIONS
  910. %=============================================================================%
  911. %-----------------------------------------------------------------------------%
  912. function varargout = wthrmeth(toolOPT,varargin)
  913. switch toolOPT
  914.   case {'deno','esti'}
  915.     thrMethods = {...
  916.         'Fixed form threshold',       'sqtwolog',    1; ...
  917.         'Penalize high',              'penalhi',     2; ...
  918.         'Penalize medium',            'penalme',     3; ...
  919.         'Penalize low',               'penallo',     4; ...
  920.         'Bal. sparsity-norm (sqrt)',  'sqrtbal_sn',  5  ...
  921.         };
  922.   case 'comp'
  923.     thrMethods = {...
  924.         'Scarce high',                'scarcehi',   1; ...
  925.         'Scarce medium',              'scarceme',   2; ...
  926.         'Scarce low',                 'scarcelo',   3; ...
  927.         'Balance sparsity-norm',      'bal_sn',     4; ...
  928.         'Remove near 0',              'rem_n0',     5; ...
  929.         'Bal. sparsity-norm (sqrt)',  'sqrtbal_sn', 6  ...
  930.         };
  931. end
  932. nbin = length(varargin);
  933. if nbin==0 , varargout{1} = thrMethods; return; end
  934. option = varargin{1};
  935. switch option
  936.   case 'names'
  937.      out = strvcat(1,thrMethods{:,1});
  938.      varargout{1} = out(2:end,:);
  939.      if nbin==2
  940.          num = varargin{2};
  941.          varargout{1} = deblank(varargout{1}(num,:));
  942.      end
  943.   case 'shortnames'
  944.      out = strvcat(1,thrMethods{:,2});
  945.      varargout{1} = out(2:end,:);
  946.      if nbin==2
  947.          num = varargin{2};
  948.          varargout{1} = deblank(varargout{1}(num,:));
  949.      end
  950.   case 'nums'
  951.      varargout{1} = cat(1,thrMethods{:,3});
  952. end
  953. %-----------------------------------------------------------------------------%
  954. function [pos_fra,dy_lev,y_res,y_est] = getPosFraThr(fra,nblevs,toolOPT)
  955. Def_Btn_Height = mextglob('get','Def_Btn_Height');
  956. d_lev = 2;
  957. bdy   = 4;
  958. pos_fra = get(fra,'Position');
  959. top_fra = pos_fra(2)+pos_fra(4);
  960. switch  toolOPT
  961.   case {'deno','esti'} , NB_Height = 7;
  962.   case {'comp'}        , NB_Height = 8;
  963. end
  964. h_ini   = (NB_Height-2)*bdy+NB_Height*Def_Btn_Height;
  965. h_fra   = h_ini+ nblevs*(Def_Btn_Height+d_lev);
  966. pos_fra(2) = top_fra-h_fra;
  967. pos_fra(4) = h_fra;
  968. dy_lev = d_lev+Def_Btn_Height;
  969. y_est  = pos_fra(2)-(3*Def_Btn_Height)/2-Def_Btn_Height/2;
  970. y_res  = y_est;
  971. %-----------------------------------------------------------------------------%
  972. function varargout = depOfMachine(varargin)
  973. btn_height = varargin{1};
  974. scrSize = get(0,'ScreenSize');
  975. if scrSize(4)<600
  976.     height = btn_height;
  977. elseif scrSize(4)<800
  978.     height = 3*btn_height/2;
  979. else
  980.     height = 3*btn_height/2;
  981. end
  982. varargout = {height};
  983. %-----------------------------------------------------------------------------%
  984. %=============================================================================%