📄 fmri_plot_corr.m
字号:
function fig = fmri_plot_corr(action,varargin)
%
% fmri_plot_corr(action,action_arg1,...)
% Application Data
%
% STDatamat
% SelectedCondition
% ObjPositin
% PlottedDatamat
% AxesBoundary
%
if ~exist('action','var') | isempty(action) % no action argument
return;
end;
fig = [];
if strcmp(action,'STARTUP')
PLSresultFile = varargin{1};
init(PLSresultFile);
gen_condition_chk_box(1);
SetObjPosition;
return;
elseif strcmp(action,'LINK') % call from other figure
PLSresultFile = varargin{1};
fig = init(PLSresultFile);
gen_condition_chk_box(1);
SetObjPosition;
figure(gcbf);
return;
end;
% clear the message line,
%
h = findobj(gcf,'Tag','MessageLine');
set(h,'String','');
if strcmp(action,'LoadSTDatamat')
selected_datamat = get(findobj(gcbf,'Tag','STDatamatPopup'),'Value');
gen_condition_chk_box(selected_datamat);
plot_datamatcorrs;
elseif strcmp(action,'change_group')
change_group;
elseif strcmp(action,'NewCoord')
new_coord = varargin{1};
new_xyz = varargin{2};
new_lag = varargin{3};
setappdata(gcf,'Coord',new_coord);
setappdata(gcf,'XYZ',new_xyz);
setappdata(gcf,'lag',new_lag);
plot_datamatcorrs;
elseif strcmp(action,'PlotBnPress')
coord = getappdata(gcf,'Coord');
plot_datamatcorrs;
elseif strcmp(action,'SliderMotion')
condition_update;
elseif strcmp(action,'ResizeFigure')
resize_fig;
elseif strcmp(action,'DeleteFigure')
delete_fig;
elseif strcmp(action,'MENU_PlotIndividualData')
make_datamat_popup(1);
elseif strcmp(action,'MENU_PlotGroupData')
make_datamat_popup(2);
elseif strcmp(action,'MENU_PlotAllData')
make_datamat_popup(3);
elseif strcmp(action,'MENU_NumPtsPlotted')
st_win_size = getappdata(gcf,'STWinSize');
win_size_str = num2str(st_win_size);
input_num_pts = inputdlg({'Number of points to be plotted'}, ...
'Input',1,{win_size_str});
if ~isempty(input_num_pts)
num_pts = str2num(input_num_pts{1});
if ~isempty(num_pts)
if (num_pts < 1) | (num_pts > st_win_size),
msg = 'ERROR: Invalid input number of points';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
else
setappdata(gcf,'NumPtsPlotted',num_pts);
end
end
end;
plot_datamatcorrs;
elseif strcmp(action,'MENU_CombinePlots')
curr_state = get(gcbo,'Userdata');
if (curr_state == 1), % currently combining plots
new_state = 0;
set(gcbo,'Label','Combine plots within conditions');
else
new_state = 1;
set(gcbo,'Label','Separate plots within conditions');
end;
set(gcbo,'Userdata',new_state);
fmri_plot_cond_stim_ui('COMBINE_PLOTS',new_state);
elseif strcmp(action,'MENU_NormalizePlots')
curr_state = get(gcbo,'Userdata');
if (curr_state == 1), % current plot is normalized plot
new_state = 0;
set(gcbo,'Label','Enable Data Normalization');
else
new_state = 1;
set(gcbo,'Label','Disable Data Normalization');
end;
set(gcbo,'Userdata',new_state);
plot_datamatcorrs;
elseif strcmp(action,'MENU_ExportData')
save_response_fn;
end;
return;
%--------------------------------------------------------------------------
%
function fig = init(PLSresultFile)
cond_selection = getappdata(gcf,'cond_selection');
result_file = get(findobj(gcf,'tag','ResultFile'),'UserData');
try
warning off;
load( result_file, 'bscan' );
warning on;
catch
end;
if exist('bscan','var') & ~isempty(bscan)
selected_conditions = find(cond_selection);
selected_conditions = selected_conditions(bscan);
cond_selection = zeros(1,length(cond_selection));
cond_selection(selected_conditions) = 1;
end
save_setting_status = 'on';
fmri_plot_corr_pos = [];
try
load('pls_profile');
catch
end
if ~isempty(fmri_plot_corr_pos) & strcmp(save_setting_status,'on')
pos = fmri_plot_corr_pos;
else
w = 0.8;
h = 0.7;
x = (1-w)/2;
y = (1-h)/2;
pos = [x y w h];
end
hh = figure('Units','normal', ...
'Name','Datamat Correlations', ...
'NumberTitle','off', ...
'Color', [0.8 0.8 0.8], ...
'DoubleBuffer','on', ...
'Menubar', 'none', ...
'DeleteFcn', 'fmri_plot_corr(''DeleteFigure'');', ...
'Position',pos, ...
'user','datamatcorrs', ...
'Tag','PlotRFFig');
% display 'ST datamat: '
%
x = 0.05;
y = 0.9;
w = 0.15;
h = 0.06;
pos = [x y w h];
fnt = 0.4;
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'text', ...
'Position', pos, ...
'HorizontalAlignment', 'left',...
'String', 'Datamat:', ...
'Tag', 'STDatamatLabel');
% create ST datamat popup menu
%
y = 0.84;
w = 0.22;
pos = [x y w h];
cb_fn = [ 'fmri_plot_corr(''change_group'');'];
popup_h = uicontrol('Parent',hh, ...
'units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'Style', 'popupmenu', ...
'Position', pos, ...
'HorizontalAlignment', 'left',...
'String', '', ...
'Value', 1, ...
'Tag', 'STDatamatPopup', ...
'Callback',cb_fn);
y = 0.18;
h = 0.62;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'frame', ...
'Position', pos, ...
'HorizontalAlignment', 'left',...
'Tag', 'CondFrame');
x = 0.09;
y = 0.76;
w = 0.14;
h = 0.06;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'text', ...
'Position', pos, ...
'HorizontalAlignment', 'center',...
'String', 'Conditions', ...
'Tag', 'ConditionLabel');
x = 0.05;
y = 0.08;
w = 0.1;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'Style', 'push', ...
'Position', pos, ...
'String', 'Plot', ...
'Enable', 'on', ...
'Tag', 'PlotButton', ...
'CallBack', 'fmri_plot_corr(''PlotBnPress'');');
x = x+w+.02;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'Style', 'push', ...
'Position', pos, ...
'String', 'Close', ...
'CallBack', 'close(gcf)', ...
'Tag', 'CloseButton');
x = 0.01;
y = 0;
w = 1;
h = 0.05;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ... % Message Line
'Style','text', ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor',[0.8 0.8 0.8], ...
'ForegroundColor',[0.8 0.0 0.0], ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','', ...
'Tag','MessageLine');
rri_file_menu(hh);
h_plot = uimenu('Parent',hh, ...
'Label','&Plot', ...
'Enable','on',...
'visible', 'off', ...
'Tag','PlotMenu');
h0 = uimenu('Parent',h_plot, ...
'Label','Plot individual ST datamat', ...
'Tag','PlotIndividualData', ...
'Callback','fmri_plot_corr(''MENU_PlotIndividualData'');');
h0 = uimenu('Parent',h_plot, ...
'Label','Plot group data', ...
'Tag','PlotGroupData', ...
'Callback','fmri_plot_corr(''MENU_PlotGroupData'');');
h0 = uimenu('Parent',h_plot, ...
'Label','Plot all data', ...
'Tag','PlotAllData', ...
'Callback','fmri_plot_corr(''MENU_PlotAllData'');');
h_option = uimenu('Parent',hh, ...
'Label','&Option', ...
'Tag','OptionMenu', ...
'Enable','off',...
'Visible','on');
h0 = uimenu('Parent',h_option, ...
'Label','Hide Average Plot', ...
'Tag','ToggleShowAvgMenu', ...
'visible', 'off', ...
'Callback','fmri_plot_cond_stim_ui(''TOGGLE_SHOW_AVERAGE'');');
h0 = uimenu('Parent',h_option, ...
'Label','Combine plots within conditions', ...
'Tag','CombinePlots', ...
'Userdata', 0, ...
'Callback','fmri_plot_corr(''MENU_CombinePlots'');');
h0 = uimenu('Parent',h_option, ...
'Label','Enable Data Normalization', ...
'Tag','NormalizePlots', ...
'Userdata', 0, ...
'Callback','fmri_plot_corr(''MENU_NormalizePlots'');');
h0 = uimenu('Parent',h_option, ...
'Label','Change plot dimension', ...
'Separator','on',...
'Tag','ChgPlotDims', ...
'Callback','fmri_plot_cond_stim_ui(''CHANGE_PLOT_DIMS'');');
h0 = uimenu('Parent',h_option, ...
'Label','Number of points to be plotted', ...
'Tag','NumPtsPlotted', ...
'Callback','fmri_plot_corr(''MENU_NumPtsPlotted'');');
h_option = uimenu('Parent',hh, ...
'Label','&Data', ...
'Tag','DataMenu', ...
'Enable','off',...
'Visible','on');
h0 = uimenu('Parent',h_option, ...
'Label','Export data', ...
'Tag','ExportData', ...
'Callback','fmri_plot_corr(''MENU_ExportData'');');
% set up object location records
%
x = 0.05;
y = 0.9;
w = 0.15;
h = 0.06;
obj(1).name = 'STDatamatLabel'; obj(1).pos = [x 1-y w h];
y = 0.84;
w = 0.22;
obj(2).name = 'STDatamatPopup'; obj(2).pos = [x 1-y w h];
x = 0.09;
y = 0.76;
w = 0.14;
h = 0.06;
obj(3).name = 'ConditionLabel'; obj(3).pos = [x 1-y w h];
y = 0.7;
obj(4).name = 'Condition1'; obj(4).pos = [x 1-y w h];
setappdata(hh,'ObjPosition',obj);
setappdata(hh,'cond_selection',cond_selection);
setappdata(gcf, 'sa', getappdata(gcbf, 'sa'));
% construct the popup label list
%
% get_st_datamat_filename(PLSresultFile);
% make_datamat_popup(1);
if (nargout >= 1),
fig = hh;
end;
load_datamatcorrs(PLSresultFile);
return;
%--------------------------------------------------------------------------
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -