📄 pet_create_datamat_ui.m
字号:
function pet_create_datamat_ui(varargin)
%
% USAGE: pet_create_datamat_ui(session_file)
%
% pet_create_datamat_ui - Creates a datamat file
%
if nargin == 0 | ~ischar(varargin{1})
session_file = varargin{1}{1};
init(session_file);
% uiwait; % wait for user finish
% 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,'MERGE_CONDITIONS'),
MergeConditions;
elseif strcmp(action,'ORIENT'),
orient;
elseif strcmp(action,'RUN_BUTTON'),
if (SaveDatamatOptions)
CreateDatamat;
end;
elseif strcmp(action,'CANCEL_BUTTON'),
% uiresume(gcf);
close(gcf);
elseif strcmp(action,'DELETE_FIG'),
delete_fig;
elseif strcmp(action,'EDIT_NORMAL_VOLUME')
msg = 'Please keep this check box checked unless you have a good reason not to do so.';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
end;
return;
%----------------------------------------------------------------------------
function init(session_file),
curr = pwd;
if isempty(curr)
curr = filesep;
end
curr_dir = curr;
session_win_hdl = gcf;
save_setting_status = 'on';
pet_create_datamat_pos = [];
try
load('pls_profile');
catch
end
if ~isempty(pet_create_datamat_pos) & strcmp(save_setting_status,'on')
pos = pet_create_datamat_pos;
else
w = 0.6;
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','Create PET Datamat', ...
'NumberTitle','off', ...
'Position', pos, ...
'deleteFcn','pet_create_datamat_ui(''DELETE_FIG'');', ...
'Menubar', 'none', ...
'WindowStyle','modal', ...
'Tag','STDatamatOptions', ...
'ToolBar','none');
x = 0.05;
y = 0.23;
w = 1 - 2*x;
h = 0.7;
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.8;
w = 1 - 2*x;
h = 0.07;
pos = [x y w h];
fnt = 0.7;
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-.1;
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', ...
'pet_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-.08;
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','pet_create_datamat_ui(''EDIT_BRAIN_REGION_FILE'');',...
'Tag','PredefineRegionFileEdit');
x = x+w+.02;
w = 0.16;
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', 'pet_create_datamat_ui(''BRAIN_REGION_FILE_BUTTON'');', ...
'Tag','PredefineRegionFileButton');
x = 0.1;
y = y-.1;
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','pet_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-.08;
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.25', ...
'TooltipString','Enter value between 0 and 1.', ...
'Callback','pet_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','pet_create_datamat_ui(''CONSIDER_ALL_VOXELS'');', ...
'Tag','ConsiderAllVoxels');
x = 0.1;
y = y-.12;
w = 0.39;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Mean Ratio Button
'Style','check', ...
'Units','normal', ...
'BackgroundColor',[0.7 0.7 0.7], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Value', 1, ...
'Position',pos, ...
'String','Normalize data with volume mean', ...
'Callback','pet_create_datamat_ui(''EDIT_NORMAL_VOLUME'');', ...
'Tag','MeanRatioChkButton');
x = x+w+0.02;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % Merge Conditions
'Style','push', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','Merge Conditions', ...
'Callback','pet_create_datamat_ui(''MERGE_CONDITIONS'');',...
'Tag','MergeConditions');
x = 0.05;
y = 0.1;
w = 0.4;
h = 0.07;
pos = [x y w h];
c = uicontrol('Parent',h0, ... % ORIENT Button
'Style','pushbutton', ...
'Units','normal', ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'Position',pos, ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -