📄 fmri_input_run_ui.m
字号:
function [new_run_info, num_runs] = fmri_input_run_ui(varargin)
%
% USAGE: new_run_info = fmri_input_run_ui(run_info,num_runs,conditions)
%
% fmri_input_run_ui - create input condition GUI
% fmri_input_run_ui('SAVE_BUTTON_PRESSED') - save session information
% fmri_input_run_ui('CANCEL_BUTTON_PRESSED') - cancel all changes
%
if (nargin == 0) | ~ischar(varargin{1})
run_info = varargin{1};
num_runs = varargin{2};
conditions = varargin{3};
init(run_info,num_runs,conditions);
uiwait(gcf); % wait for user finish
new_run_info = getappdata(gcf,'SessionRunInfo');
num_runs = getappdata(gcf,'TotalRuns');
close(gcf);
return;
end;
% clear the message line,
%
h = findobj(gcf,'Tag','MessageLine');
set(h,'String','');
action = upper(varargin{1});
if strcmp(action,'SELECT_DATA_FILE'),
SelectDataFile;
elseif strcmp(action,'EDIT_DATA_DIRECTORY');
EditDataDirectory;
elseif strcmp(action,'EDIT_ONSETS'),
EditOnsets;
elseif strcmp(action,'EDIT_REPLICATE'),
EditReplicate;
elseif strcmp(action,'EDIT_NUM_SCANS'),
EditNumScans;
elseif strcmp(action,'MOVE_SLIDER'),
MoveSlider;
elseif strcmp(action,'RESIZE_FIGURE'),
SetObjectPositions;
elseif strcmp(action,'LOAD_TXT'),
LoadTxt;
elseif strcmp(action,'SAVE_TXT'),
SaveTxt;
elseif strcmp(action,'CLEAR_RUN'),
ClearRunInfo;
elseif strcmp(action,'DELETE_RUN'),
DeleteRunInfo;
elseif strcmp(action,'RUN_EDIT'),
ShowRunInfo(str2num(get(findobj(gcf,'Tag','NumRunEdit'),'String')));
elseif strcmp(action,'PREVIOUS_BUTTON_PRESSED'),
if CheckRunInfo
ShowRunInfo(str2num(get(findobj(gcf,'Tag','NumRunEdit'),'String')) - 1);
end
elseif strcmp(action,'NEXT_BUTTON_PRESSED'),
if CheckRunInfo
ShowRunInfo(str2num(get(findobj(gcf,'Tag','NumRunEdit'),'String')) + 1);
end
elseif strcmp(action,'CANCEL_BUTTON_PRESSED'),
setappdata(gcf,'SessionRunInfo',[]);
uiresume(gcbf);
elseif strcmp(action,'DONE_BUTTON_PRESSED'),
if ~CheckRunInfo
return;
end
curr_run = getappdata(gcf,'CurrRun'); % save the current run info
SaveRunInfo(curr_run);
if(check_run_ok)
uiresume(gcbf);
end
elseif strcmp(action,'DELETE_FIG'),
delete_fig;
elseif strcmp(action,'PLOT_HRF'),
plot_hrf;
elseif strcmp(action,'PLOT_ONSET'),
plot_onset;
end;
return;
%----------------------------------------------------------------------------
function init(run_info,num_runs,conditions),
save_setting_status = 'on';
fmri_input_run_pos = [];
try
load('pls_profile');
catch
end
if ~isempty(fmri_input_run_pos) & strcmp(save_setting_status,'on')
pos = fmri_input_run_pos;
else
w = 0.6;
h = 0.8;
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', ...
'Menubar','none', ...
'Name','Run Information', ...
'NumberTitle','off', ...
'Position', pos, ...
'deletefcn','fmri_input_run_ui(''DELETE_FIG'');', ...
'WindowStyle', 'normal', ...
'Tag','InputRunFigure', ...
'ToolBar','none');
left_margin = .08;
text_height = .05;
x = left_margin - .02;
y = .9;
w = 1-2*left_margin;
h = text_height;
pos = [x y w h];
fnt = 0.7;
c = uicontrol('Parent',h0, ... % Run Index
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'FontName', 'FixedWidth', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'FontAngle','italic', ...
'FontWeight','bold', ...
'HorizontalAlignment','left', ...
'Position', pos, ...
'String','Run #1', ...
'Tag','RunIndex');
x = left_margin;
y = y-.06;
w = .25;
pos = [x y w h];
fnt = fnt-0.2;
c = uicontrol('Parent',h0, ... % Number of Scans Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Number of Scans:', ...
'Tag','NumScansLabel');
x = x+w+.01;
w = .1;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number of Scans Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','0', ...
'Callback','fmri_input_run_ui(''EDIT_NUM_SCANS'');', ...
'Tag','NumScansEdit');
x = left_margin;
y = y-.06;
w = .2;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Data Directory Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Data Directory:', ...
'Tag','DataDirectoryLabel');
x = x+w+.01;
w = 1-left_margin - x;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Data Directory Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[0.9 0.9 0.9], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position', pos, ...
'Enable','on', ...
'String','', ...
'Callback','fmri_input_run_ui(''EDIT_DATA_DIRECTORY'');', ...
'Tag','DataDirectoryEdit');
x = left_margin;
y = y-.06;
w = .15;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Data File Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit', 'normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Data Files:', ...
'Tag','DataFileLabel');
x = x+w+.01;
w = 1-left_margin - x -.16;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Data File Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[0.9 0.9 0.9], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'Enable','inactive', ...
'String','', ...
'Tag','DataFileEdit');
x = x+w+.01;
w = .15;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Data File Button
'Style','pushbutton', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','Browse ...', ...
'Callback','fmri_input_run_ui(''SELECT_DATA_FILE'');', ...
'Tag','DataFileButton');
x = 0;
y = .65;
w = 1;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Event Onsets Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'FontWeight','bold', ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','Event Onsets (TR)', ...
'Tag','EventOnsetsLabel');
x = left_margin;
y = .2;
w = 1-left_margin - x;
h = .45;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Event Onset Frame
'Style','frame', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'Position',pos, ...
'Tag','EventOnsetFrame');
w = .03;
x = 1 - left_margin - w - 0.001;
y = y + 0.001;
h = h - 0.002;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Onset Slider
'Style','slider', ...
'Units','normal', ...
'Min', 0, ...
'Max', 1, ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'Callback','fmri_input_run_ui(''MOVE_SLIDER'');', ...
'Tag','EventOnsetSlider');
x = left_margin+.02;
y = .58;
w = 1-x*2-0.05;
h = text_height;
pos = [x y w h];
t1 = uicontrol('Parent',h0, ... % Condition Name Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal',...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Condition #1', ...
'Tag','ConditionNameLabel');
x = left_margin+.05;
y = y-0.05;
w = 0.1;
pos = [x y w h];
t3 = uicontrol('Parent',h0, ... % Onset Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal',...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Onsets:', ...
'visible', 'off', ...
'Tag','EventOnsetLabel');
x = x+w+0.01;
w = 1-x-left_margin-0.08;
pos = [x y w h];
t2 = uicontrol('Parent',h0, ... % Onset Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal',...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','... onsets ...', ...
'Callback','fmri_input_run_ui(''EDIT_ONSETS'');', ...
'Tag','EventOnsetEdit');
x = left_margin;
y = .14;
w = .65;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Replicate Label
'Style','check', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'FontWeight','normal', ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Replicate trial Information across run', ...
'value',1, ...
'Callback','fmri_input_run_ui(''EDIT_REPLICATE'');', ...
'Tag','ReplicateLabel');
x = 1 - left_margin - .15;
y = .12;
w = .1;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Run Edit Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal',...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','Run', ...
'Tag','RunEditLabel');
x = 1 - left_margin - .2;
y = y-.05;
w = .05;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Previous
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','<<', ...
'Enable','off', ...
'Callback','fmri_input_run_ui(''PREVIOUS_BUTTON_PRESSED'');', ...
'Tag','PREVIOUSButton');
x = 1 - left_margin - .15;
w = .1;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number Run Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','1',...
'Callback','fmri_input_run_ui(''RUN_EDIT'');', ...
'Tag','NumRunEdit');
x = 1 - left_margin - .05;
w = .05;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Next
'Units','normal', ...
'fontunit','normal',...
'FontSize',fnt, ...
'Position',pos, ...
'String','>>', ...
'Enable','off', ...
'Callback','fmri_input_run_ui(''NEXT_BUTTON_PRESSED'');', ...
'Tag','NEXTButton');
x = left_margin;
w = .15;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % DONE
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','DONE', ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -