📄 bfm_create_datamat_ui.m
字号:
function bfm_create_datamat_ui(varargin)
%
% USAGE: bfm_create_datamat_ui(session_file,num_runs,num_slices)
%
% bfm_create_datamat_ui - create datatmat options GUI
%
if (nargin == 3),
session_file = varargin{1};
num_runs = varargin{2};
num_slices = varargin{3};
init(session_file,num_runs,num_slices);
uiwait(gcf); % wait for user finish
progress_hdl=findobj(gcf,'tag','ProgressFigure');
gen_datamat_hdl=findobj(gcf,'tag','DatamatOptions');
% if (~isempty(progress_hdl) & ishandle(progress_hdl)) | ...
% (~isempty(gen_datamat_hdl) & ishandle(gen_datamat_hdl))
% close(gcf);
% end
if (~isempty(progress_hdl) & ishandle(progress_hdl))
close(progress_hdl);
end
if (~isempty(gen_datamat_hdl) & ishandle(gen_datamat_hdl))
close(gen_datamat_hdl);
end
return;
end;
% clear the message line,
%
h = findobj(gcf,'Tag','MessageLine');
set(h,'String','');
action = upper(varargin{1});
if strcmp(action,'PREDEFINE_BRAIN_REGION_BUTTON'),
SelectPredefineBrainRegion;
elseif strcmp(action,'EDIT_BRAIN_REGION_FILE'),
EditBrainRegionFile;
elseif strcmp(action,'BRAIN_REGION_FILE_BUTTON'),
SelectBrainRegionFile;
elseif strcmp(action,'AUTO_BRAIN_REGION_BUTTON'),
SelectAutoBrainRegion;
elseif strcmp(action,'CONSIDER_ALL_VOXELS'),
SelectConsiderAllVoxels;
elseif strcmp(action,'SET_THRESHOLD'),
SetThreshold;
elseif strcmp(action,'SET_MAX_STD_DEVIATION'),
SetMaxStdDeviation;
elseif strcmp(action,'MERGE_DATA_WITH_RUN_BUTTON'),
SelectMergeDataWithinRun;
elseif strcmp(action,'MERGE_DATA_ACROSS_RUNS_BUTTON'),
SelectMergeDataAcrossRuns;
elseif strcmp(action,'EDIT_SKIPPED_SCANS'),
SetScanSkipped;
elseif strcmp(action,'EDIT_RUN_INCLUDED'),
SetRunIncluded;
elseif strcmp(action,'EDIT_IGNORE_SLICES'),
SetIgnoreSlices;
elseif strcmp(action,'EDIT_TEMPORAL_WINDOW_SIZE'),
SetTemporalWindowSize
elseif strcmp(action,'ORIENT'),
orient;
elseif strcmp(action,'RUN_BUTTON'),
if (SaveDatamatOptions)
RunGenDatamat;
% uiresume(gcf);
end;
elseif strcmp(action,'CANCEL_BUTTON'),
setappdata(gcf,'STOptions',[]);
uiresume(gcf);
elseif strcmp(action,'DELETE_FIGURE'),
delete_fig;
elseif strcmp(action,'EDIT_NUM_BEHAVIOR')
msg = 'Click the "Edit Behavior Data ..." button to edit behavior data';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
elseif strcmp(action,'EDIT_NORMAL_VOLUME')
msg = 'Please keep this check box unchecked unless you have a good reason not to do so.';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
elseif strcmp(action,'EDIT_NORMAL_SIGNAL')
msg = 'Please keep this check box checked unless you have a good reason not to do so.';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
elseif strcmp(action,'EDIT_BEHAV_DATA_ALL')
EditBehavData_all;
elseif strcmp(action,'EDIT_BEHAV_DATA_EACH')
EditBehavData_each;
elseif strcmp(action,'EDIT_BEHAV_DATA_ALL_SINGLE')
EditBehavData_all_single;
elseif strcmp(action,'EDIT_BEHAV_DATA_EACH_SINGLE')
EditBehavData_each_single;
elseif strcmp(action,'SINGLESUBJECTBUTTON')
check_singlesubject;
elseif strcmp(action,'SELECT_BEHAV_DATA')
SelectBehavData;
end;
return;
%----------------------------------------------------------------------------
function init(session_file,num_runs,num_slices),
curr_dir = pwd;
session_win_hdl = gcf;
save_setting_status = 'on';
bfm_create_datamat_pos = [];
try
load('pls_profile');
catch
end
if ~isempty(bfm_create_datamat_pos) & strcmp(save_setting_status,'on')
pos = bfm_create_datamat_pos;
else
w = 0.6;
% h = 0.9;
h = 0.73;
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','Generate Datamat', ...
'NumberTitle','off', ...
'Position', pos, ...
'deleteFcn','bfm_create_datamat_ui(''DELETE_FIGURE'');', ...
'Menubar', 'none', ...
'WindowStyle','modal', ...
'Tag','DatamatOptions', ...
'ToolBar','none');
x = 0.05;
% y = 0.63;
y = 0.61;
w = 1 - 2*x;
% h = 0.33;
h = 0.35;
pos = [x y w h];
%-------- for Brain Region Frame
c = uicontrol('Parent',h0, ... % Brain Region Frame
'Style','frame', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'Position', pos, ...
'Value',0, ...
'Tag','BrainRegionFrame');
x = 0.1;
% y = 0.9;
y = 0.88;
w = 1 - 2*x;
% h = 0.04;
h = 0.05;
pos = [x y w h];
fnt = 0.65;
c = uicontrol('Parent',h0, ... % Brain Region Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'FontName', 'FixedWidth', ...
'FontAngle','italic', ...
'FontWeight','bold', ...
'HorizontalAlignment','left', ...
'Position', pos, ...
'String','Brain Region', ...
'Tag','BrainRegionLabel');
x = 0.1;
% y = y-.04;
y = y-.05;
w = 0.05;
pos = [x y w h];
fnt = fnt-0.1;
c = uicontrol('Parent',h0, ... % Predefine Region Button
'Style','radiobutton', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Value', 0, ...
'Position', pos, ...
'String','', ...
'Callback', ...
'bfm_create_datamat_ui(''PREDEFINE_BRAIN_REGION_BUTTON'');', ...
'Tag','PredefineRegionChkButton');
x = x+w;
w = 0.5;
y = y-.01;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Predefine Region Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position', pos, ...
'String','Use predefined brain region.', ...
'Tag','PredefineRegionLabel');
x = 0.2;
% y = y-.05;
y = y-.06;
w = 0.08;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Predefine Region File Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'ForegroundColor',[0.5 0.5 0.5], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','right', ...
'Position',pos, ...
'String','File:', ...
'TooltipString','The IMG file that specifies the brain region.', ...
'Tag','PredefineRegionFileLabel');
x = x+w+.02;
y = y+.01;
w = 0.42;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Predefine Region File Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','', ...
'Enable','off', ...
'Callback','bfm_create_datamat_ui(''EDIT_BRAIN_REGION_FILE'');',...
'Tag','PredefineRegionFileEdit');
x = x+w+.02;
w = 0.15;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Predefine Region File Button
'Style','pushbutton', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'Position',pos, ...
'String','Browse', ...
'Enable','off', ...
'Callback', 'bfm_create_datamat_ui(''BRAIN_REGION_FILE_BUTTON'');', ...
'Tag','PredefineRegionFileButton');
x = 0.1;
% y = y-.05;
y = y-.06;
w = 0.05;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Auto Region Button
'Style','radiobutton', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Value', 1, ...
'Position',pos, ...
'String','', ...
'Callback','bfm_create_datamat_ui(''AUTO_BRAIN_REGION_BUTTON'');', ...
'Tag','AutoRegionChkButton');
x = x+w;
y = y-.01;
w = 0.5;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Auto Region Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Define brain region automatically.', ...
'Tag','AutoRegionLabel');
x = 0.1;
% y = y-.05;
y = y-.06;
w = 0.18;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Auto Region Threshold Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','right', ...
'Position',pos, ...
'String','Threshold:', ...
'TooltipString','Voxels with values below 1/threshold of the max. value in the volumes will be removed.', ...
'Tag','AutoRegionThresholdLabel');
x = x+w+.02;
y = y+.01;
w = 0.1;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Auto Region Threshold Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','0.15', ...
'TooltipString','Enter value between 0 and 1.', ...
'Callback','bfm_create_datamat_ui(''SET_THRESHOLD'');', ...
'Tag','AutoRegionThresholdEdit');
x = x+w+0.11;
w = 0.4;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Consider all voxels as brain
'Style','check', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','Consider all voxels as brain', ...
'Callback','bfm_create_datamat_ui(''CONSIDER_ALL_VOXELS'');', ...
'Tag','ConsiderAllVoxels');
x = 0.1;
% y = y-.05-.01;
y = y-.06-.01;
w = 0.4;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Brain Region Max SD Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Max. standard deviation allowed:', ...
'TooltipString','The maximum absolution standard deviation allowed in the brain voxels.', ...
'visible', 'off', ...
'Tag','BrainRegionStdDevLabel');
x = x+w;
y = y+.01;
w = 0.1;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Brain Region Max SD Edit
'Style','edit', ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
'String','4', ...
'Callback','bfm_create_datamat_ui(''SET_MAX_STD_DEVIATION'');', ...
'visible', 'off', ...
'Tag','BrainRegionStdDevEdit');
x = 0.05;
% y = 0.12;
y = 0.14;
w = 1 - 2*x;
% h = 0.5;
h = 0.46;
pos = [x y w h];
%-------- for Datamat frame
c = uicontrol('Parent',h0, ... % Datamat Frame
'Units','normal', ...
'Style','frame', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'Position',pos, ...
'Value',0, ...
'Tag','DatamatFrame');
x = 0.1;
% y = 0.56;
y = 0.52;
w = 1 - 2*x;
% h = 0.04;
h = 0.05;
pos = [x y w h];
fnt = fnt+0.1;
c = uicontrol('Parent',h0, ... % Datamat Label
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'FontName', 'FixedWidth', ...
'FontAngle','italic', ...
'FontWeight','bold', ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Datamat', ...
'Tag','DatamatLabel');
fnt = fnt-0.1;
x = 0.1;
% y = y-.05;
y = y-.06;
w = 0.4;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Number of scans to be skipped
'Style','text', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -