function handle=cbar %CBAR Inizialize the menu bar % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % global smc sct I Handlefig CB_imagemode global ed_zrange1 ed_zrange2 ed_colormap ed_contrast ed_offset global Uibgcolor MapNum FontName FontSize FontWeight pos=get(gca, 'position'); pos(1)=pos(1)-0.6*pos(1); pos(2)=pos(2)+pos(4)/1.85; pos(3)=pos(3)/20; pos(4)=pos(4)/2.2; frame = uicontrol(Handlefig, 'Style', 'frame',... 'Units', 'Normalized',... 'Position', [0 0.110 0.12 0.4],... 'Tag', 'cmapui',... 'BackgroundColor', Uibgcolor); txt_zrange = uicontrol(Handlefig, 'Style', 'text',... 'String', 'Zrange',... 'Units', 'normalized',... 'Position', [0.01 0.47 0.10, 0.03],... 'Tag', 'cmapui',... 'BackgroundColor', Uibgcolor); ed_zrange2 = uicontrol(Handlefig, 'Style', 'edit',... 'String', '',... 'Units', 'normalized',... 'Position', [0.01 0.44 0.10, 0.03],... 'HorizontalAlignment', 'center',... 'Tag', 'cmapui',... 'CallBack', 'showimage'); ed_zrange1 = uicontrol(Handlefig, 'Style', 'edit',... 'String', '',... 'Units', 'normalized',... 'Position', [0.01 0.405 0.10, 0.03],... 'HorizontalAlignment', 'center',... 'Tag', 'cmapui',... 'CallBack', 'showimage'); txt_contrast = uicontrol(Handlefig, 'Style', 'text',... 'String', 'Contrast',... 'Units', 'normalized',... 'Position', [0.01 0.345 0.10, 0.03],... 'Tag', 'cmapui',... 'BackgroundColor', Uibgcolor); ed_contrast=uicontrol(Handlefig, 'Style', 'edit',... 'String', '0',... 'Units', 'normalized',... 'position', [0.01 0.32 0.10, 0.03],... 'Value', 0,... 'UserData', 0,... 'HorizontalAlignment', 'center',... 'Tag', 'cmapui',... 'CallBack', 'global ed_contrast;editstr2value(ed_contrast,0,10);set(get(ed_contrast, ''userdata''), ''Value'', get(ed_contrast, ''value''));setmap(getmap);'); sct=uicontrol(Handlefig, 'Style', 'slider',... 'Units', 'normalized',... 'position', [0.01 0.30 0.10, 0.02],... 'Min', 0,... 'Max', 10,... 'Value', 0,... 'String', 'Contrast',... 'Tag', 'cmapui',... 'CallBack', 'set(ed_contrast, ''value'', get(get(ed_contrast, ''userdata''), ''Value''), ''string'', num2str(get(get(ed_contrast, ''userdata''), ''Value'')));setmap(getmap);'); txt_offset = uicontrol(Handlefig, 'Style', 'text',... 'String', 'Offset',... 'Units', 'normalized',... 'Tag', 'cmapui',... 'Position', [0.01 0.255 0.10, 0.03],... 'BackgroundColor', Uibgcolor); ed_offset=uicontrol(Handlefig, 'Style', 'edit',... 'String', '0',... 'Units', 'normalized',... 'position', [0.01 0.23 0.10, 0.03],... 'Value', 0,... 'UserData', 0,... 'Tag', 'cmapui',... 'HorizontalAlignment', 'center',... 'CallBack', 'global ed_offset;editstr2value(ed_offset,-10,10);set(get(ed_offset, ''userdata''), ''Value'', get(ed_offset, ''value''));setmap(getmap);'); smc=uicontrol(Handlefig, 'Style', 'slider',... 'Units', 'normalized',... 'position', [0.01 0.21 0.10, 0.02],... 'Min', -10,... 'Max', 10,... 'Value', 0,... 'Tag', 'cmapui',... 'CallBack', 'set(ed_offset, ''value'', get(get(ed_offset, ''userdata''), ''Value''), ''string'', num2str(get(get(ed_offset, ''userdata''), ''Value'')));setmap(getmap);'); txt_colormap = uicontrol(Handlefig, 'Style', 'text',... 'String', 'Colormap',... 'Units', 'normalized',... 'Tag', 'cmapui',... 'Position', [0.01 0.165 0.10, 0.03],... 'BackgroundColor', Uibgcolor); ed_colormap=uicontrol(Handlefig, 'Style', 'edit',... 'String', int2str(MapNum),... 'Units', 'normalized',... 'position', [0.035 0.14 0.05, 0.03],... 'Value', MapNum,... 'UserData', 0,... 'Tag', 'cmapui',... 'HorizontalAlignment', 'center',... 'CallBack', 'global ed_colormap;editstr2value(ed_colormap,1,30);setmap(get(ed_colormap, ''value''));'); uicontrol(Handlefig, 'Style', 'push',... 'String', '-',... 'Units', 'normalized',... 'position', [0.01 0.14 0.025, 0.028],... 'Tag', 'cmapui',... 'HorizontalAlignment', 'center',... 'CallBack', 'set(ed_colormap, ''string'', int2str(get(ed_colormap, ''value'')-1));editstr2value(ed_colormap,1,30);setmap(get(ed_colormap, ''value''));'); uicontrol(Handlefig, 'Style', 'push',... 'String', '+',... 'Units', 'normalized',... 'position', [0.085 0.14 0.025, 0.028],... 'Tag', 'cmapui',... 'HorizontalAlignment', 'center',... 'CallBack', 'set(ed_colormap, ''string'', int2str(get(ed_colormap, ''value'')+1));editstr2value(ed_colormap,1,30);setmap(get(ed_colormap, ''value''));'); set(ed_contrast, 'userdata', sct); set(ed_offset, 'userdata', smc); setmap(MapNum); return; ax=makecolorbar('vert'); set(ax, 'position', pos, 'XTick', [], 'YTick', []); ch=get(ax, 'children'); for i=1:length(ch) if strcmp(get(ch(i), 'type'), 'text') == 1 set(ch(i), 'String', '') end end z1_txt=text('units', 'normalized', 'Horiz', 'center', 'FontName', FontName, 'FontSize', FontSize, 'FontWeight', FontWeight); set(z1_txt, 'pos', [-0.091 0.515]); z2_txt=text('units', 'normalized', 'Horiz', 'center', 'FontName', FontName, 'FontSize', FontSize, 'FontWeight', FontWeight); set(z2_txt, 'pos', [-0.091 1.045]); set(ax, 'UserData', [z1_txt z2_txt]); if nargout>0, handle = ax; end return