📄 fmri_session_profile_ui.m
字号:
function fmri_session_profile_ui(varargin)
%
% USAGE: fmri_session_profile_ui(varargin)
%
% fmri_session_profile_ui - create input condition GUI
%
if nargin == 0,
if exist('plslog.m','file')
plslog('Edit fMRI Session');
end
curr = pwd;
if isempty(curr)
curr = filesep;
end
start_dir = curr;
init;
setappdata(gcf,'CallingFigure',gcbf);
set(gcbf,'visible','off');
uiwait(gcf); % wait for user finish
close(gcf);
% cd(start_dir);
return;
end;
% clear the message line,
%
h = findobj(gcf,'Tag','MessageLine');
set(h,'String','');
action = upper(varargin{1});
if strcmp(action,'MENU_LOAD_PLS_SESSION_INFO'),
LoadSessionInfo;
ShowSessionInfo;
elseif strcmp(action,'MENU_SAVE_PLS_SESSION_INFO'),
SaveSessionInfo(0);
elseif strcmp(action,'MENU_SAVE_AS_PLS_SESSION_INFO'),
SaveSessionInfo(1);
elseif strcmp(action,'MENU_CLOSE_SESSION_INPUT'),
if (CloseSessionInput == 1);
uiresume;
end
elseif strcmp(action,'MENU_CLEAR_PLS_SESSION_INFO'),
ClearSessionInfo(0);
ShowSessionInfo;
elseif strcmp(action,'MENU_PATH_PLS_SESSION_INFO'),
PathSessionInfo(0);
ShowSessionInfo;
elseif strcmp(action,'MENU_MERGE_CONDITIONS'),
MergeConditions;
elseif strcmp(action,'MENU_CREATE_CONTRASTS'),
conditions = getappdata(gcf,'SessionConditions');
contrast_ui_fig = fmri_input_contrast_ui([],conditions);
waitfor(contrast_ui_fig);
elseif strcmp(action,'MENU_CREATE_ST_DATAMAT'),
CreateSTDatamat;
elseif strcmp(action,'MENU_MODIFY_BEHAV'),
ModifyBehav;
elseif strcmp(action,'MENU_MERGE_ST_DATAMAT'),
MergeSTDatamat;
elseif strcmp(action,'MENU_STD'),
datamat_prefix = getappdata(gcf,'SessionDatamatPrefix');
pls_data_path = getappdata(gcf,'SessionPLSDir');
if isempty(datamat_prefix) | isempty(pls_data_path)
msg = 'Please have session saved and datamat created';
uiwait(msgbox(msg,'Error'));
else
fmri_apply_std(1, datamat_prefix, pls_data_path);
end;
elseif strcmp(action,'EDIT_DESCRIPTION'),
description = deblank(strjust(get(gcbo,'String'),'left'));
set(gcbo,'String',description);
setappdata(gcf,'SessionDescription',description);
elseif strcmp(action,'EDIT_PLS_DATA_DIR'),
EditPLSDataDir;
elseif strcmp(action,'SELECT_PLS_DATA_DIR'),
SelectPLSDataDir;
elseif strcmp(action,'EDIT_DATAMAT_PREFIX'),
EditDatamatPrefix;
elseif strcmp(action,'EDIT_CONDITIONS_NUM'),
msg = 'Click the "Edit Conditions ..." button to set the condition names';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
elseif strcmp(action,'EDIT_CONDITIONS'),
EditConditions;
elseif strcmp(action,'EDIT_NUM_RUNS'),
EditRunNumber;
elseif strcmp(action,'EDIT_RUNS'),
EditRuns;
elseif strcmp(action,'DELETE_FIG'),
delete_fig;
elseif strcmp(action,'DELETE_FIGURE'),
try
load('pls_profile');
pls_profile = which('pls_profile.mat');
fmri_session_profile_pos = get(gcbf,'position');
save(pls_profile, '-append', 'fmri_session_profile_pos');
catch
end
calling_fig = getappdata(gcf,'CallingFigure');
set(calling_fig,'visible','on');
elseif strcmp(action,'MERGE_DATA_WITH_RUN_BUTTON'),
SelectMergeDataWithinRun;
elseif strcmp(action,'MERGE_DATA_ACROSS_RUNS_BUTTON'),
SelectMergeDataAcrossRuns;
end;
return;
%----------------------------------------------------------------------------
function init
curr = pwd;
if isempty(curr)
curr = filesep;
end
curr_dir = curr;
save_setting_status = 'on';
fmri_session_profile_pos = [];
try
load('pls_profile');
catch
end
if ~isempty(fmri_session_profile_pos) & strcmp(save_setting_status,'on')
pos = fmri_session_profile_pos;
else
w = 0.7;
h = 0.5;
x = (1-w)/2;
y = (1-h)/2;
pos = [x y w h];
end
h0 = figure('Color',[0.8 0.8 0.8], ...
'Units','normal', ...
'Name','', ...
'NumberTitle','off', ...
'Menubar', 'none', ...
'Position', pos, ...
'DeleteFcn','fmri_session_profile_ui(''DELETE_FIGURE'');', ...
'Tag','EditSessionInformation', ...
'ToolBar','none');
% numbers of inputing line excluding 'MessageLine'
num_inputline = 5;
factor_inputline = 1/(num_inputline+1);
% left label
x = 0.05;
y = (num_inputline-0) * factor_inputline;
w = 0.25;
h = 0.4 * factor_inputline;
pos = [x y w h];
fnt = 0.5;
c = uicontrol('Parent',h0, ... % Session Description Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'FontUnits','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','right', ...
'Position',pos, ...
'String','Session Description: ', ...
'Tag','SessionDescriptionLabel');
x = x+w+0.01;
w = 0.59;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Session Description Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'FontUnit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','', ...
'Callback','fmri_session_profile_ui(''EDIT_DESCRIPTION'');', ...
'Tag','SessionDescriptionEdit');
x = 0.05;
y = (num_inputline-1) * factor_inputline;
w = 0.25;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % PLS Data Directory Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','right', ...
'Position',pos, ...
'String','PLS Data Directory: ', ...
'visible','off', ...
'Tag','PLSDataDirectoryLabel');
x = x+w+0.01;
w = 0.43;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % PLS Data Directory Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','', ...
'Callback','fmri_session_profile_ui(''EDIT_PLS_DATA_DIR'');', ...
'visible','off', ...
'Tag','PLSDataDirectoryEdit');
x = x+w+0.01;
w = 0.15;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % PLS Data Directory Button
'Style','pushbutton', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','Browse ...', ...
'Callback','fmri_session_profile_ui(''SELECT_PLS_DATA_DIR'');', ...
'visible','off', ...
'Tag','PLSDataDirectoryButton');
x = 0.05;
y = (num_inputline-1) * factor_inputline;
w = 0.25;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Datamat Prefix Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','right', ...
'Position',pos, ...
'String','* Datamat Prefix: ', ...
'Tag','DatamatPrefixLabel');
x = x+w+0.01;
w = 0.3;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Datamat Prefix Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','', ...
'Callback','fmri_session_profile_ui(''EDIT_DATAMAT_PREFIX'');', ...
'Tag','DatamatPrefixEdit');
x = 0.05;
y = (num_inputline-2) * factor_inputline;
w = 0.25;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Merge Data Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','right', ...
'Position',pos, ...
'String','* Merge Data: ', ...
'Tag','MergeDataLabel');
x = x+w+0.01;
w = 0.3;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Merge Data Across Runs Button
'Style','radiobutton', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Value', 1, ...
'Position',pos, ...
'String','Across All Runs', ...
'Callback','fmri_session_profile_ui(''MERGE_DATA_ACROSS_RUNS_BUTTON'');', ...
'Tag','MergeDataAcrossRunsButton');
x = x+w;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Merge Data Within Run Button
'Style','radiobutton', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Value', 0, ...
'Position',pos, ...
'String','Within Each Run', ...
'Callback','fmri_session_profile_ui(''MERGE_DATA_WITH_RUN_BUTTON'');', ...
'Tag','MergeDataWithinRunButton');
x = 0.05;
y = (num_inputline-3) * factor_inputline;
w = 0.25;
h = 0.4 * factor_inputline;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number of Conditions Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','right', ...
'Position',pos, ...
'String','* Number of Conditions: ', ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -