📄 fmri_analysis_ui.m
字号:
total_profiles = -1;
return;
end;
end
return; % ValidateConditions
%----------------------------------------------------------------------------
function ExecutePLS(),
PLSoptions = getappdata(gcf,'PLSoptions');
progress_hdl = rri_progress_status('','Create','PLS Analysis');
progress_merge_factor = 1 / (PLSoptions.TotalNumberProfiles * 2);
setappdata(progress_hdl,'ProgressScale',progress_merge_factor * 0.2);
setappdata(progress_hdl,'ProgressStart',0);
if exist('plslog.m','file')
switch (PLSoptions.ContrastMethod)
case 1
plslog('fMRI Mean-Centering Analysis');
case 2
plslog('fMRI Old Analysis');
case 3
plslog('fMRI Non-Rotated Analysis');
case 4
plslog('fMRI Behavior Analysis');
case 5
plslog('fMRI Multiblock Analysis');
end
end
switch (PLSoptions.ContrastMethod)
case {1}
fmri_pls_analysis(PLSoptions.profiles, [], ...
PLSoptions.num_perm, ...
PLSoptions.num_boot, ...
PLSoptions.Clim, ...
PLSoptions.posthoc, ...
PLSoptions.save_datamat, ...
PLSoptions.group_analysis, ...
PLSoptions.cond_selection, ...
PLSoptions.behavname, ...
PLSoptions.behavdata, ...
PLSoptions.behavdata_lst, ...
PLSoptions.bscan);
case {2}
fmri_pls_analysis(PLSoptions.profiles, 'HELMERT', ...
PLSoptions.num_perm, ...
PLSoptions.num_boot, ...
PLSoptions.Clim, ...
PLSoptions.posthoc, ...
PLSoptions.save_datamat, ...
PLSoptions.group_analysis, ...
PLSoptions.cond_selection, ...
PLSoptions.behavname, ...
PLSoptions.behavdata, ...
PLSoptions.behavdata_lst, ...
PLSoptions.bscan);
case {3}
fmri_pls_analysis(PLSoptions.profiles, PLSoptions.ContrastFile, ...
PLSoptions.num_perm, ...
PLSoptions.num_boot, ...
PLSoptions.Clim, ...
PLSoptions.posthoc, ...
PLSoptions.save_datamat, ...
PLSoptions.group_analysis, ...
PLSoptions.cond_selection, ...
PLSoptions.behavname, ...
PLSoptions.behavdata, ...
PLSoptions.behavdata_lst, ...
PLSoptions.bscan);
case {4}
close(progress_hdl);
fmri_pls_analysis(PLSoptions.profiles, 'BEHAV', ...
PLSoptions.num_perm, ...
PLSoptions.num_boot, ...
PLSoptions.Clim, ...
PLSoptions.posthoc, ...
PLSoptions.save_datamat, ...
PLSoptions.group_analysis, ...
PLSoptions.cond_selection, ...
PLSoptions.behavname, ...
PLSoptions.behavdata, ...
PLSoptions.behavdata_lst, ...
PLSoptions.bscan);
case {5}
close(progress_hdl);
fmri_pls_analysis(PLSoptions.profiles, 'MULTIBLOCK', ...
PLSoptions.num_perm, ...
PLSoptions.num_boot, ...
PLSoptions.Clim, ...
PLSoptions.posthoc, ...
PLSoptions.save_datamat, ...
PLSoptions.group_analysis, ...
PLSoptions.cond_selection, ...
PLSoptions.behavname, ...
PLSoptions.behavdata, ...
PLSoptions.behavdata_lst, ...
PLSoptions.bscan);
end;
if exist('progress_hdl','var') & ishandle(progress_hdl)
close(progress_hdl);
end
uiresume(gcf);
return; % ExecutePLS
%----------------------------------------------------------------------------
function SelectMean;
if get(findobj(gcf,'Tag','SelectMean'),'Value') == 0 % click itself
set(findobj(gcf,'Tag','SelectMean'),'Value',1);
else
% set(findobj(gcf,'Tag','SelectHelmert'),'Value',0);
set(findobj(gcf,'Tag','SelectContrastData'),'Value',0);
set(findobj(gcf,'Tag','SelectBehavData'),'Value',0);
set(findobj(gcf,'Tag','SelectMultiblockData'),'Value',0);
set(findobj(gcf,'Tag','ContrastFileEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ContrastDataLabel'),'Enable','off');
set(findobj(gcf,'Tag','ContrastFileEdit'),'Enable','off');
set(findobj(gcf,'Tag','ContrastFileButton'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ModifyBehavdataMenu'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataLabel'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataEdit'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataBn'),'Enable','off');
set(findobj(gcf,'Tag','ClimEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ClimLabel'),'Enable','off');
set(findobj(gcf,'Tag','ClimEdit'),'Enable','off');
set(findobj(gcf,'Tag','MultiblockDeselectConditionMenu'),'Enable','off');
num_group = str2num(get(findobj(gcf,'Tag','NumberGroupEdit'), 'String'));
if num_group > 1
set(findobj(gcf,'Tag','GroupAnalysisRadiobutton'), 'Value', 1, 'enable', 'inactive');
else
set(findobj(gcf,'Tag','GroupAnalysisRadiobutton'), 'Value', 1, 'enable', 'on');
end
end
return; % SelectMean
%----------------------------------------------------------------------------
function SelectHelmert;
if get(findobj(gcf,'Tag','SelectHelmert'),'Value') == 0 % click itself
set(findobj(gcf,'Tag','SelectHelmert'),'Value',1);
else
set(findobj(gcf,'Tag','SelectMean'),'Value',0);
set(findobj(gcf,'Tag','SelectContrastData'),'Value',0);
set(findobj(gcf,'Tag','SelectBehavData'),'Value',0);
set(findobj(gcf,'Tag','SelectMultiblockData'),'Value',0);
set(findobj(gcf,'Tag','ContrastFileEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ContrastDataLabel'),'Enable','off');
set(findobj(gcf,'Tag','ContrastFileEdit'),'Enable','off');
set(findobj(gcf,'Tag','ContrastFileButton'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ModifyBehavdataMenu'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataLabel'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataEdit'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataBn'),'Enable','off');
set(findobj(gcf,'Tag','ClimEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ClimLabel'),'Enable','off');
set(findobj(gcf,'Tag','ClimEdit'),'Enable','off');
set(findobj(gcf,'Tag','MultiblockDeselectConditionMenu'),'Enable','off');
num_group = str2num(get(findobj(gcf,'Tag','NumberGroupEdit'), 'String'));
if num_group > 1
set(findobj(gcf,'Tag','GroupAnalysisRadiobutton'), 'Value', 1, 'enable', 'inactive');
else
set(findobj(gcf,'Tag','GroupAnalysisRadiobutton'), 'Value', 1, 'enable', 'on');
end
end
return; % SelectHelmert
%----------------------------------------------------------------------------
function SelectContrastData;
if get(findobj(gcf,'Tag','SelectContrastData'),'Value') == 0 % click itself
set(findobj(gcf,'Tag','SelectContrastData'),'Value',1);
else
set(findobj(gcf,'Tag','SelectMean'),'Value',0);
% set(findobj(gcf,'Tag','SelectHelmert'),'Value',0);
set(findobj(gcf,'Tag','SelectBehavData'),'Value',0);
set(findobj(gcf,'Tag','SelectMultiblockData'),'Value',0);
set(findobj(gcf,'Tag','ContrastFileEdit'),'BackGroundColor',[1 1 1]);
set(findobj(gcf,'Tag','ContrastDataLabel'),'Enable','on');
set(findobj(gcf,'Tag','ContrastFileEdit'),'Enable','on');
set(findobj(gcf,'Tag','ContrastFileButton'),'Enable','on');
set(findobj(gcf,'Tag','PosthocDataEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ModifyBehavdataMenu'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataLabel'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataEdit'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataBn'),'Enable','off');
set(findobj(gcf,'Tag','ClimEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ClimLabel'),'Enable','off');
set(findobj(gcf,'Tag','ClimEdit'),'Enable','off');
set(findobj(gcf,'Tag','MultiblockDeselectConditionMenu'),'Enable','off');
set(findobj(gcf,'Tag','GroupAnalysisRadiobutton'), 'Value', 1, 'enable', 'off');
end
return; % SelectContrastData
%----------------------------------------------------------------------------
function SelectBehavData;
if get(findobj(gcf,'Tag','SelectBehavData'),'Value') == 0 % click itself
set(findobj(gcf,'Tag','SelectBehavData'),'Value',1);
else
set(findobj(gcf,'Tag','SelectMean'),'Value',0);
% set(findobj(gcf,'Tag','SelectHelmert'),'Value',0);
set(findobj(gcf,'Tag','SelectContrastData'),'Value',0);
set(findobj(gcf,'Tag','SelectMultiblockData'),'Value',0);
set(findobj(gcf,'Tag','ContrastFileEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ContrastDataLabel'),'Enable','off');
set(findobj(gcf,'Tag','ContrastFileEdit'),'Enable','off');
set(findobj(gcf,'Tag','ContrastFileButton'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataEdit'),'BackGroundColor',[1 1 1]);
set(findobj(gcf,'Tag','ModifyBehavdataMenu'),'Enable','on');
set(findobj(gcf,'Tag','PosthocDataLabel'),'Enable','on');
set(findobj(gcf,'Tag','PosthocDataEdit'),'Enable','on');
set(findobj(gcf,'Tag','PosthocDataBn'),'Enable','on');
num_boot = str2num(get(findobj(gcf,'Tag','NumBootstrapEdit'),'String'));
if ~isempty(num_boot) & num_boot ~= 0
set(findobj(gcf,'Tag','ClimEdit'),'BackGroundColor',[1 1 1]);
set(findobj(gcf,'Tag','ClimLabel'),'Enable','on');
set(findobj(gcf,'Tag','ClimEdit'),'Enable','on');
end
set(findobj(gcf,'Tag','MultiblockDeselectConditionMenu'),'Enable','off');
set(findobj(gcf,'Tag','GroupAnalysisRadiobutton'), 'Value', 1, 'enable', 'off');
end
return; % SelectBehavData
%----------------------------------------------------------------------------
function SelectMultiblockData;
if get(findobj(gcf,'Tag','SelectMultiblockData'),'Value') == 0 % click itself
set(findobj(gcf,'Tag','SelectMultiblockData'),'Value',1);
else
set(findobj(gcf,'Tag','SelectMean'),'Value',0);
% set(findobj(gcf,'Tag','SelectHelmert'),'Value',0);
set(findobj(gcf,'Tag','SelectContrastData'),'Value',0);
set(findobj(gcf,'Tag','SelectBehavData'),'Value',0);
set(findobj(gcf,'Tag','ContrastFileEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ContrastDataLabel'),'Enable','off');
set(findobj(gcf,'Tag','ContrastFileEdit'),'Enable','off');
set(findobj(gcf,'Tag','ContrastFileButton'),'Enable','off');
set(findobj(gcf,'Tag','PosthocDataEdit'),'BackGroundColor',[1 1 1]);
set(findobj(gcf,'Tag','ModifyBehavdataMenu'),'Enable','on');
set(findobj(gcf,'Tag','PosthocDataLabel'),'Enable','on');
set(findobj(gcf,'Tag','PosthocDataEdit'),'Enable','on');
set(findobj(gcf,'Tag','PosthocDataBn'),'Enable','on');
num_boot = str2num(get(findobj(gcf,'Tag','NumBootstrapEdit'),'String'));
if ~isempty(num_boot) & num_boot ~= 0
set(findobj(gcf,'Tag','ClimEdit'),'BackGroundColor',[1 1 1]);
set(findobj(gcf,'Tag','ClimLabel'),'Enable','on');
set(findobj(gcf,'Tag','ClimEdit'),'Enable','on');
end
set(findobj(gcf,'Tag','MultiblockDeselectConditionMenu'),'Enable','on');
set(findobj(gcf,'Tag','GroupAnalysisRadiobutton'), 'Value', 1, 'enable', 'off');
end
return; % SelectMultiblockData
%----------------------------------------------------------------------------
function EditNumBoot
% contain behavpls
%
if get(findobj(gcf,'Tag','SelectBehavData'),'Value') == 1 | ...
get(findobj(gcf,'Tag','SelectMultiblockData'),'Value') == 1
num_boot = str2num(get(findobj(gcf,'Tag','NumBootstrapEdit'),'String'));
if ~isempty(num_boot) & num_boot ~= 0
set(findobj(gcf,'Tag','ClimEdit'),'BackGroundColor',[1 1 1]);
set(findobj(gcf,'Tag','ClimLabel'),'Enable','on');
set(findobj(gcf,'Tag','ClimEdit'),'Enable','on');
else
set(findobj(gcf,'Tag','ClimEdit'),'BackGroundColor',[0.9 0.9 0.9]);
set(findobj(gcf,'Tag','ClimLabel'),'Enable','off');
set(findobj(gcf,'Tag','ClimEdit'),'Enable','off');
end
end
return; % EditNumBoot
%----------------------------------------------------------------------------
function EditPosthocDataFile
posthoc_data_file = deblank(strjust(get(gcbo,'String'),'left'));
set(gcbo,'String',posthoc_data_file);
if ~isempty(posthoc_data_file)
if ( exist(posthoc_data_file,'file') == 2 ) % specified file exists
setappdata(gcf,'posthoc_data_file',posthoc_data_file);
return;
end;
if ( exist(posthoc_data_file,'dir') == 7 ) % it is a directory!
msg = 'ERROR: The specified file is a direcotry!';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
setappdata(gcf,'posthoc_data_file','');
return;
end;
else
% msg = 'ERROR: Invalid input file!';
% set(findobj(gcf,'Tag','MessageLine'),'String',msg);
setappdata(gcf,'posthoc_data_file','');
return;
end;
return; % EditPosthocDataFile
%----------------------------------------------------------------------------
function SelectPosthocDataFile
h = findobj(gcf,'Tag','PosthocDataEdit');
[filename,pathname]=uigetfile('*.*','Select Posthoc Data File');
if isequal(filename,0) | isequal(pathname,0)
return;
end;
posthoc_data_file = [pathname, filename];
set(h,'String',posthoc_data_file);
set(h,'TooltipString',posthoc_data_file);
setappdata(gcf,'posthoc_data_file',posthoc_data_file);
return; % SelectPosthocDataFile
%----------------------------------------------------------------------------
function deselect_condition
curr_profiles = getappdata(gcf,'CurrGroupProfiles');
if isempty(curr_profiles)
msg = 'Group need to be added before you can deselect condition';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
return;
end
tmp = load(curr_profiles{1}.name{1});
condition = tmp.session_info.condition;
cond_selection = getappdata(gcf,'cond_selection');
new_cond_selection = rri_deselect_cond_ui(condition, cond_selection);
if ~isequal(new_cond_selection, cond_selection)
setappdata(gcf,'cond_selection',new_cond_selection);
setappdata(gcf,'behavname',{});
setappdata(gcf,'behavdata',[]);
setappdata(gcf,'behavdata_lst',{});
setappdata(gcf, 'bscan', []);
end
return; % deselect_condition
%----------------------------------------------------------------------------
function modify_behavdata
curr_profiles = getappdata(gcf,'CurrGroupProfiles');
if isempty(curr_profiles)
msg = 'Group need to be added before you can modify behavior data';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
return;
end
cond_selection = getappdata(gcf,'cond_selection');
behavname = getappdata(gcf,'behavname');
behavdata = getappdata(gcf,'behavdata');
behavdata_lst = getappdata(gcf,'behavdata_lst');
new_evt_list = getappdata(gcf,'new_evt_list');
newdata_lst = getappdata(gcf,'newdata_lst');
if isempty(behavdata)
[status,behavname,behavdata,behavdata_lst,new_evt_list,newdata_lst] = ...
fmri_get_behavior(curr_profiles, cond_selection);
else
status = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -