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

波变换

开发平台:

Matlab

  1. function out1 = dw2dimgs(option,in2,in3,in4)
  2. %DW2DIMGS Discrete wavelet 2-D image selection.
  3. %   OUT1 = DW2DIMGS(OPTION,IN2,IN3,IN4)
  4. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
  5. %   Last Revision: 14-Dec-2000.
  6. %   Copyright 1995-2002 The MathWorks, Inc.
  7. %   $Revision: 1.14 $
  8. % Tag property of objects.
  9. %-------------------------
  10. tag_imgsel = 'Img_Select';
  11. tag_imgdec = 'Img_Dec';
  12. % Miscellaneous values.
  13. %----------------------
  14. [Col_BoxAxeSel,Col_Selected,BoxTitleSel_Col] = wtbutils('colors','dw2d');
  15. Width_LineSel = 3;
  16. if isequal(option,'get_img')
  17.     win_dw2dtool = get(0,'CurrentFigure');
  18. SelectType = get(win_dw2dtool,'SelectionType');
  19. if ~isequal(SelectType,'normal') , return; end 
  20. else
  21.     win_dw2dtool = in2;
  22. end
  23. img_hdl = findobj(win_dw2dtool,'type','image');
  24. switch option
  25.     case 'get_img'
  26.         sel_obj = get(win_dw2dtool,'currentobject');
  27.         Img_Dec = findobj(img_hdl,'tag',tag_imgdec);
  28.         obj_sel = findobj(img_hdl,'Tag',tag_imgsel);
  29.         ind     = find(sel_obj==[Img_Dec;obj_sel]);
  30.         if ~isempty(ind)
  31.             if ~isempty(obj_sel)
  32.                 set(obj_sel,'Tag',tag_imgdec);
  33.                 axe = get(obj_sel,'parent');
  34.                 set(axe,'Xcolor',Col_BoxAxeSel, ...
  35.                         'Ycolor',Col_BoxAxeSel, ...
  36.                         'LineWidth',0.5         ...
  37.                         );
  38.                 col_lab = get(win_dw2dtool,'DefaultAxesXColor');
  39.                 set(get(axe,'xlabel'),'Color',col_lab);
  40.                 if obj_sel==sel_obj , out1 = []; return; end
  41.             end
  42.             axe = get(sel_obj,'parent');
  43. axes(axe)
  44.             set(axe,...
  45.                     'Xcolor',BoxTitleSel_Col,   ...
  46.                     'Ycolor',BoxTitleSel_Col,   ...
  47.                     'LineWidth',Width_LineSel,  ...
  48.                     'Box','On'                  ...
  49.                     );
  50.             set(sel_obj,'Tag',tag_imgsel);
  51.             out1 = sel_obj;
  52.         end
  53.     case 'clean'
  54.         obj_sel = findobj(img_hdl,'Tag',tag_imgsel);
  55.         if ~isempty(obj_sel)
  56.             set(obj_sel,'Tag',tag_imgdec);
  57.             axe = get(obj_sel,'parent');
  58.             set(axe,'Xcolor',Col_BoxAxeSel, ...
  59.                     'Ycolor',Col_BoxAxeSel, ...
  60.                     'LineWidth',0.5         ...
  61.                     );
  62.             col_lab = get(win_dw2dtool,'DefaultAxesXColor');
  63.             set(get(axe,'xlabel'),'Color',col_lab);
  64.             out1 = [];
  65.         end
  66.     case 'cleanif'
  67.         % for view_dec
  68.         % in3 = new_lev_dec
  69.         % in4 = old_lev_dec
  70.         %----------------------------
  71.         obj_sel = findobj(img_hdl,'Tag',tag_imgsel);
  72.         if ~isempty(obj_sel)
  73.             us = get(obj_sel,'Userdata');
  74.             %---------------------------%
  75.             %- us = [0;k;m]
  76.             %- k = level ;
  77.             %- m = 1 : v ; m = 2 : d ;             
  78.             %- m = 3 : h ; m = 4 : a ;     
  79.             %----------------------------%
  80.             if (us(2)<=in3)
  81.                 if (in4>in3) | (us(3)<4) , return; end
  82.             end
  83.             set(obj_sel,'Tag',tag_imgdec);
  84.             axe = get(obj_sel,'parent');
  85.             set(axe,'Xcolor',Col_BoxAxeSel, ...
  86.                     'Ycolor',Col_BoxAxeSel, ...
  87.                     'LineWidth',0.5         ...
  88.                     );
  89.             col_lab = get(win_dw2dtool,'DefaultAxesXColor');
  90.             set(get(axe,'xlabel'),'Color',col_lab);
  91.         end
  92.     case 'get'
  93.         out1 = findobj(img_hdl,'Tag',tag_imgsel);
  94.     otherwise
  95.         errargt(mfilename,'Unknown Option','msg');
  96.         error('*');
  97. end