📄 gui_eeg_colormap.m
字号:
function [p] = gui_eeg_colormap(parent)
% GUI_EEG_COLORMAP - display colormaps for eeg_toolbox
%
% Useage: [p] = gui_eeg_colormap([parent])
%
% $Revision: 1.2 $ $Date: 2003/03/02 03:20:44 $
% Licence: GNU GPL, no express or implied warranties
% History: 10/2002, Darren.Weber@flinders.edu.au
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% reset the gui_struct parent field to the handles of the input gui_struct
if exist('parent','var'),
COLORMAP.parent.gui = parent;
ParentUserdata = get(parent,'Userdata');
COLORMAP.p = ParentUserdata.p;
else
error('No parent gui parameter supplied');
end
% GUI General Parameters
GUIwidth = 200;
GUIheight = 200;
GUI = figure('Name','EEG Color Maps','Tag','COLORMAP',...
'NumberTitle','off','HandleVisibility','callback',...
'MenuBar','none','Position',[1 1 GUIwidth GUIheight]);
movegui(GUI,'center');
COLORMAP.gui = GUI;
Font.FontName = 'Helvetica';
Font.FontUnits = 'Pixels';
Font.FontSize = 12;
Font.FontWeight = 'normal';
Font.FontAngle = 'normal';
% Colormap style
switch COLORMAP.p.colorMap.style
case 'Red/Blue/White', Cmap = 1; COLORMAP.p = eeg_colormap(COLORMAP.p);
case 'Red/Blue', Cmap = 2; COLORMAP.p = eeg_colormap(COLORMAP.p);
case 'Gray', Cmap = 3; COLORMAP.p = eeg_colormap(COLORMAP.p);
otherwise,
Cmap = 4;
if isempty(COLORMAP.p.colorMap.map),
COLORMAP.p.colorMap.style = 'default';
COLORMAP.p = eeg_colormap(COLORMAP.p);
end
end
G.Title_style = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font,...
'Position',[.05 .8 .9 .1],...
'HorizontalAlignment', 'left',...
'String',' Map Style');
G.PcolorMap = uicontrol('Tag','PcolorMap','Parent',GUI,'Style','popupmenu',...
'Units','Normalized',Font,...
'Position',[.05 .7 .9 .1],...
'String',{'Red/Blue/White' 'Red/Blue' 'Gray' 'default'},'Value',Cmap,...
'Callback',strcat('COLORMAP = get(gcbf,''Userdata'');',...
'COLORMAP.p.colorMap.style = popupstr(COLORMAP.handles.PcolorMap);',...
'switch COLORMAP.p.colorMap.style, ',...
'case {''Gray'',''default''},',...
'set(COLORMAP.handles.ECmapExponent,''Enable'',''off'');',...
'otherwise, ',...
'set(COLORMAP.handles.ECmapExponent,''Enable'',''on'');',...
'end; ',...
'COLORMAP.p = eeg_colormap(COLORMAP.p);',...
'set(COLORMAP.gui,''Userdata'',COLORMAP); clear COLORMAP;'));
% Cmap Length
toolstr = 'Length of the map matrix used for colormap command (integer values only).';
G.Title_length = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font,...
'Position',[.05 .5 .6 .1],...
'HorizontalAlignment', 'left',...
'String',' Map Length',...
'TooltipString', toolstr);
G.ECmapLength = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font,...
'Position',[.65 .5 .3 .1],...
'String',num2str(COLORMAP.p.colorMap.length),...
'TooltipString', toolstr,...
'Callback',strcat('COLORMAP = get(gcbf,''Userdata'');',...
'COLORMAP.p.colorMap.length = str2num(get(COLORMAP.handles.ECmapLength,''String''));',...
'set(COLORMAP.gui,''Userdata'',COLORMAP); clear COLORMAP;'));
% Cmap Exponent
toolstr = 'Enhance extreme values with larger exponents (integer values only, not used for Gray or default).';
G.Title_length = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font,...
'Position',[.05 .4 .6 .1],...
'HorizontalAlignment', 'left',...
'TooltipString',toolstr,...
'String',' Map Exponent');
G.ECmapExponent = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font,...
'Position',[.65 .4 .3 .1],...
'String',num2str(COLORMAP.p.colorMap.exp),...
'TooltipString',toolstr,...
'Callback',strcat('COLORMAP = get(gcbf,''Userdata'');',...
'COLORMAP.p.colorMap.exp = str2num(get(COLORMAP.handles.ECmapExponent,''String''));',...
'set(COLORMAP.gui,''Userdata'',COLORMAP); clear COLORMAP;'));
% Cmap Cmin
toolstr = ' 0 <= color min < color max (float values)';
G.Title_cmin = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font,...
'Position',[.05 .3 .6 .1],...
'HorizontalAlignment', 'left',...
'String',' Map Color Min',...
'TooltipString',toolstr);
G.ECmapCmin = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font,...
'Position',[.65 .3 .3 .1],...
'String',num2str(COLORMAP.p.colorMap.Cmin),...
'TooltipString',toolstr,...
'Callback',strcat('COLORMAP = get(gcbf,''Userdata'');',...
'COLORMAP.p.colorMap.Cmin = str2num(get(COLORMAP.handles.ECmapCmin,''String''));',...
'set(COLORMAP.gui,''Userdata'',COLORMAP); clear COLORMAP;'));
% Cmap Cmax
toolstr = ' color min < color max <= 1 (float values)';
G.Title_cmax = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font,...
'Position',[.05 .2 .6 .1],...
'HorizontalAlignment', 'left',...
'String',' Map Color Max',...
'TooltipString',toolstr);
G.ECmapCmax = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font,...
'Position',[.65 .2 .3 .1],...
'String',num2str(COLORMAP.p.colorMap.Cmax),...
'TooltipString', toolstr,...
'Callback',strcat('COLORMAP = get(gcbf,''Userdata'');',...
'COLORMAP.p.colorMap.Cmax = str2num(get(COLORMAP.handles.ECmapCmax,''String''));',...
'set(COLORMAP.gui,''Userdata'',COLORMAP); clear COLORMAP;'));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Font.FontWeight = 'bold';
% Plot and Return the colormap!
G.Bplot = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
'Position',[.05 .01 .29 .1],...
'String','PLOT','BusyAction','queue',...
'TooltipString','Plot the colormap (using rgbplot and colorbar).',...
'BackgroundColor',[0.0 0.5 0.0],...
'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
'Callback',strcat('COLORMAP = get(gcbf,''Userdata'');',...
'COLORMAP.p.colorMap.plot = 1;',...
'p = eeg_colormap(COLORMAP.p);',...
'COLORMAP.p.colorMap.plot = 0;',...
'set(COLORMAP.gui,''Userdata'',COLORMAP); clear COLORMAP;'));
% Return the colormap!
G.Bdone = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
'Position',[.35 .01 .29 .1],...
'String','RETURN','BusyAction','queue',...
'TooltipString','Return the colormap and parameters.',...
'BackgroundColor',[0.0 0.5 0.0],...
'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
'Callback',strcat('COLORMAP = get(gcbf,''Userdata'');',...
'p = gui_updateparent(COLORMAP);',...
'close gcbf; clear COLORMAP;'));
% Cancel
G.Bquit = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
'Position',[.65 .01 .3 .1],...
'String','CANCEL','BusyAction','queue',...
'BackgroundColor',[0.75 0.0 0.0],...
'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
'Callback','close gcbf;');
% Update the gui_struct handles for this gui
COLORMAP.handles = G;
set(COLORMAP.gui,'Userdata',COLORMAP);
p = COLORMAP.p;
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -