📄 fmri_session_profile_ui.m
字号:
'Tag','NumberConditionsLabel');
x = x+w+0.01;
w = 0.07;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number of Conditions Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[0.9 0.9 0.9], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','0', ...
'Enable','Inactive', ...
'ButtonDownFcn','fmri_session_profile_ui(''EDIT_CONDITIONS_NUM'');', ...
'Tag','NumberConditionsEdit');
x = x+w+0.01;
w = 0.22;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number of Conditions Button
'Style','pushbutton', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','Edit Conditions ...', ...
'Callback','fmri_session_profile_ui(''EDIT_CONDITIONS'');', ...
'Tag','NumberConditionsButton');
x = x+w+0.04;
w = 0.25;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Create ST Datamat
'Style','pushbutton', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','Create ST Datamat ...', ...
'Callback','fmri_session_profile_ui(''MENU_CREATE_ST_DATAMAT'');', ...
'Tag','CreateSTDatamatButton');
x = 0.05;
y = (num_inputline-4) * factor_inputline;
w = 0.25;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number of Runs Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','right', ...
'Position',pos, ...
'String','* Number of Runs: ', ...
'Tag','NumberRunsLabel');
x = x+w+0.01;
w = 0.07;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number of Runs Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit', 'normal',...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','0', ...
'Callback','fmri_session_profile_ui(''EDIT_NUM_RUNS'');', ...
'Tag','NumberRunsEdit');
x = x+w+0.01;
w = 0.22;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number of Runs Button
'Style','pushbutton', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','Edit Runs ...', ...
'Enable','off', ...
'Callback','fmri_session_profile_ui(''EDIT_RUNS'');', ...
'Tag','NumberRunsButton');
x = x+w+0.04;
w = 0.25;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Close Button
'Style','pushbutton', ...
'Units','normal', ...
'FontUnits','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','CLOSE', ...
'Callback','fmri_session_profile_ui(''DELETE_FIG'');', ...
'Tag','CloseButton');
x = 0.01;
y = 0;
w = 1;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Message Line
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'ForegroundColor',[0.8 0.0 0.0], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','', ...
'Tag','MessageLine');
% menu bar
%
h_file = uimenu('Parent',h0, ...
'Label', '&File', ...
'Tag', 'FileMenu');
m1 = uimenu(h_file, ...
'Label', '&Load', ...
'Callback','fmri_session_profile_ui(''MENU_LOAD_PLS_SESSION_INFO'');', ...
'Tag', 'LoadPLSsession');
m1 = uimenu(h_file, ...
'Label', '&Save', ...
'Callback','fmri_session_profile_ui(''MENU_SAVE_PLS_SESSION_INFO'');', ...
'Tag', 'SavePLSsession');
m1 = uimenu(h_file, ...
'Label', 'S&ave as', ...
'Callback','fmri_session_profile_ui(''MENU_SAVE_AS_PLS_SESSION_INFO'');', ...
'Tag', 'SaveAsPLSsession');
m1 = uimenu(h_file, ...
'Label', '&Close', ...
'Callback','fmri_session_profile_ui(''MENU_CLOSE_SESSION_INPUT'');', ...
'Tag', 'CloseSsessionInput');
h_file = uimenu('Parent',h0, ...
'Label', '&Edit', ...
'Tag', 'EditMenu');
m1 = uimenu(h_file, ...
'Label', 'Change Data Paths', ...
'Callback','fmri_session_profile_ui(''MENU_PATH_PLS_SESSION_INFO'');', ...
'Enable','off', ...
'Tag', 'PathPLSsessionMenu');
m1 = uimenu(h_file, ...
'separator', 'on', ...
'Label', '&Clear Session', ...
'Callback','fmri_session_profile_ui(''MENU_CLEAR_PLS_SESSION_INFO'');', ...
'Tag', 'ClearPLSsessionMenu');
m1 = uimenu(h_file, ...
'Label', '&Merge Conditions', ...
'Callback','fmri_session_profile_ui(''MENU_MERGE_CONDITIONS'');', ...
'Enable','off', ...
'Tag', 'MergeConditionsMenu');
m1 = uimenu(h_file, ...
'Label', 'C&reate Contrasts', ...
'Callback','fmri_session_profile_ui(''MENU_CREATE_CONTRASTS'');', ...
'visible', 'off', ...
'Tag', 'CreateContrastsMenu');
h_file = uimenu('Parent',h0, ...
'Label', '&Datamat', ...
'Tag', 'DatamatMenu');
m1 = uimenu(h_file, ...
'Label', '&Create ST Datamat', ...
'Callback','fmri_session_profile_ui(''MENU_CREATE_ST_DATAMAT'');', ...
'Tag', 'CreateDatamatMenu');
m1 = uimenu(h_file, ...
'Label', 'Input Seed PLS Behav Data and Modify Datamat', ...
'Callback','fmri_session_profile_ui(''MENU_MODIFY_BEHAV'');', ...
'Enable','off', ...
'visible', 'off', ...
'Tag', 'ModifyBehavMenu');
m1 = uimenu(h_file, ...
'Label', 'Apply STD to Datamat', ...
'Callback','fmri_session_profile_ui(''MENU_STD'');', ...
'enable','off', ...
'visible', 'off', ...
'Tag', 'STDDatamatMenu');
% m1 = uimenu(h_file, ...
% 'Label', '&Merge ST Datamat', ...
% 'Callback','fmri_session_profile_ui(''MENU_MERGE_ST_DATAMAT'');', ...
% 'Tag', 'MergeDatamatMenu');
% Help submenu
%
Hm_topHelp = uimenu('Parent',h0, ...
'Label', '&Help', ...
'Tag', 'Help');
% 'Callback','rri_helpfile_ui(''fmri_session_profile_hlp.txt'',''How to use SESSION PROFILE'');', ...
Hm_how = uimenu('Parent',Hm_topHelp, ...
'Label', '&How to use this window?', ...
'Callback','web([''file:///'', which(''UserGuide.htm''), ''#_Toc128820719'']);', ...
'visible', 'on', ...
'Tag', 'How');
Hm_new = uimenu('Parent',Hm_topHelp, ...
'Label', '&What''s new', ...
'Callback','rri_helpfile_ui(''whatsnew.txt'',''What''''s new'');', ...
'Tag', 'New');
Hm_about = uimenu('Parent',Hm_topHelp, ...
'Label', '&About this program', ...
'Tag', 'About', ...
'Tag', 'About', ...
'CallBack', 'plsgui_version');
setappdata(h0,'curr_dir',curr_dir);
ClearSessionInfo(1);
return; % init
%----------------------------------------------------------------------------
function ClearSessionInfo(init_flag)
% init_flag = 0 for clear operation
% init_flag = 1 for initialization
%
if (init_flag == 0 & ChkModified == 0)
return; % error
end;
curr = getappdata(gcf,'curr_dir');
session_info.description = '';
session_info.pls_data_path = curr;
session_info.datamat_prefix = '';
session_info.num_conditions = 0;
session_info.condition = [];
session_info.condition_baseline = {};
session_info.num_conditions0 = 0;
session_info.condition0 = [];
session_info.condition_baseline0 = {};
session_info.num_runs = 0;
session_info.run = [];
session_info.across_run = 1;
SetSessionInfo(session_info,'')
set(findobj(gcf,'Tag','STDDatamatMenu'),'enable','off');
set(findobj(gcf,'Tag','ModifyBehavMenu'),'enable','off');
set(findobj(gcf,'Tag','PathPLSsessionMenu'),'enable','off');
return; % ClearSessionInfo
%----------------------------------------------------------------------------
function LoadSessionInfo()
if ~isempty(getappdata(gcf,'OldSessionInfo'))
if (ChkModified == 0)
return; % error
end;
end;
[filename, pathname] = uigetfile( '*_fMRIsession.mat', 'Load a PLS session file');
if isequal(filename,0) | isequal(pathname,0)
return;
end;
cd(pathname);
session_file = fullfile(pathname, filename);
try
pls_session = load(session_file);
catch
msg = 'ERROR: Cannot load the session information';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
return;
end;
if ~exist(pls_session.session_info.pls_data_path,'dir') | ~exist(pls_session.session_info.run(1).data_path,'dir')
msg = 'Invalid path inside. Click Edit menu to Change Data Paths';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
end
% move to the PLS directory
%
pls_dir = pls_session.session_info.pls_data_path;
if ( exist(pls_dir,'dir') == 7 ) % specified directory exists
% cd(pls_dir);
else
% msg = 'WARNING: The PLS directory does not exist!';
% set(findobj(gcf,'Tag','MessageLine'),'String',msg);
end;
SetSessionInfo(pls_session.session_info,session_file)
set(findobj(gcf,'Tag','STDDatamatMenu'),'enable','on');
set(findobj(gcf,'Tag','ModifyBehavMenu'),'enable','on');
set(findobj(gcf,'Tag','PathPLSsessionMenu'),'enable','on');
return; % LoadSessionInfo
%----------------------------------------------------------------------------
function status = SaveSessionInfo(save_as_flag)
% save_as_flag = 0, save to the loaded file
% save_as_flag = 1, save to a new file
%
status = 0;
if ~exist('save_as_flag','var')
save_as_flag = 0;
end;
[session_info,session_file,old_session_info] = GetSessionInfo;
if isempty(session_info.pls_data_path),
msg = sprintf('PLS directory has to be specified before saving.');
set(findobj(gcf,'Tag','MessageLine'),'String',['ERROR: ', msg]);
return;
end;
if isempty(session_info.datamat_prefix),
msg = sprintf('A datamat prefix needs to be specified before saving.');
set(findobj(gcf,'Tag','MessageLine'),'String',['ERROR: ', msg]);
return;
end;
num_conditions = session_info.num_conditions0;
num_runs = session_info.num_runs;
if num_conditions == 0 | num_runs == 0
msg = sprintf('Need both Condition & Run information.');
set(findobj(gcf,'Tag','MessageLine'),'String',['ERROR: ', msg]);
return;
end
if ( length(session_info.run) >= num_runs )
session_info.run = session_info.run(1:num_runs);
else
msg = sprintf('Run number exceed existing run.');
set(findobj(gcf,'Tag','MessageLine'),'String',['ERROR: ', msg]);
return;
end;
% check if there is any empty condition across run
%
for i = 1:num_runs
run_cond(i,:) = cellfun('isempty', session_info.run(i).evt_onsets);
run_cond(i,:) = ~run_cond(i,:);
end
% run_cond = sum(run_cond, 1);
if ~isempty(find(run_cond == 0))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -