📄 struct_plot_rf_task.m
字号:
function fig = struct_plot_rf_task(action,varargin)
%
% struct_plot_rf_task(action,action_arg1,...)
% Application Data
%
% STDatamat
% SelectedCondition
% ObjPositin
% PlottedDatamat
% AxesBoundary
%
if ~exist('action','var') | isempty(action) % no action argument
return;
end;
fig = [];
if strcmp(action,'STARTUP')
DatamatFileList = varargin{1};
init(DatamatFileList);
gen_condition_chk_box(1);
SetObjPosition;
return;
elseif strcmp(action,'LINK') % call from other figure
DatamatFileList = varargin{1};
fig = init(DatamatFileList);
gen_condition_chk_box(1);
SetObjPosition;
figure(gcbf);
return;
end;
% clear the message line,
%
% h = findobj(gcf,'Tag','MessageLine');
% set(h,'String','');
if strcmp(action,'LoadSTDatamat')
selected_datamat = get(findobj(gcbf,'Tag','STDatamatPopup'),'Value');
gen_condition_chk_box(selected_datamat);
if ~getappdata(gcbf,'actualHRF') %getappdata(gcbf,'isbehav')
plot_datamatcorrs;
else
plot_response_fn;
end
elseif strcmp(action,'NewCoord')
new_coord = varargin{1};
new_xyz = varargin{2};
setappdata(gcf,'Coord',new_coord);
setappdata(gcf,'XYZ',new_xyz);
setappdata(gcf, 'axis_scale', []);
if ~getappdata(gcbf,'actualHRF') %getappdata(gcbf,'isbehav')
plot_datamatcorrs;
else
plot_response_fn;
end
elseif strcmp(action,'PlotBnPress')
set(gcf,'pointer','watch');
coord = getappdata(gcf,'Coord');
plot_response_fn;
set(gcf,'pointer','arrow');
elseif strcmp(action,'SliderMotion')
condition_update;
elseif strcmp(action,'ResizeFigure')
resize_fig;
elseif strcmp(action,'DeleteFigure')
delete_fig;
elseif strcmp(action,'MENU_ExportData')
save_response_fn;
elseif strcmp(action,'MENU_ExportBehavData')
save_response_fn2;
elseif strcmp(action,'MENU_ExportDataBehav')
save_response_behav;
end;
return;
%--------------------------------------------------------------------------
%
function fig = init(DatamatFileList)
cond_selection = getappdata(gcf,'cond_selection');
CallBackFig = gcbf;
result_file = get(findobj(gcf,'tag','ResultFile'),'UserData');
try
warning off;
load( result_file, 'bscan' );
warning on;
catch
end;
if exist('bscan','var') & ~isempty(bscan) & ~getappdata(gcbf,'actualHRF')
selected_conditions = find(cond_selection);
selected_conditions = selected_conditions(bscan);
cond_selection = zeros(1,length(cond_selection));
cond_selection(selected_conditions) = 1;
end
save_setting_status = 'on';
struct_plot_rf_task_pos = [];
try
load('pls_profile');
catch
end
if ~isempty(struct_plot_rf_task_pos) & strcmp(save_setting_status,'on')
pos = struct_plot_rf_task_pos;
else
w = 0.8;
h = 0.7;
x = (1-w)/2;
y = (1-h)/2;
pos = [x y w h];
end
hh = figure('Units','normal', ...
'Name','Voxel Intensity Plot', ...
'Menubar', 'none', ...
'NumberTitle','off', ...
'Color', [0.8 0.8 0.8], ...
'DoubleBuffer','on', ...
'DeleteFcn', 'struct_plot_rf_task(''DeleteFigure'');', ...
'Position',pos, ...
'Tag','PlotRFFig');
% display 'Neighborhood Size: '
%
x = 0.05;
y = 0.9;
w = 0.22;
h = 0.05;
pos = [x y w h];
fnt = 0.5;
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'text', ...
'Position', pos, ...
'HorizontalAlignment', 'left',...
'String', 'Neighborhood Size: ', ...
'Tag', 'neighborhoodLabel');
% edit 'Neighborhood Size: '
%
y = 0.85;
w = 0.04;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor', [1 1 1], ...
'Style', 'edit', ...
'Position', pos, ...
'HorizontalAlignment', 'left',...
'String', '0', ...
'tooltipstring', 'Use average intensity of its neighborhood voxels for intensity of this voxel. Neighborhood size is number of voxels from this voxel.', ...
'CallBack', 'struct_plot_rf_task(''PlotBnPress'');', ...
'Tag', 'neighborhoodEdit');
x = x + w + 0.01;
w = 0.12;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'text', ...
'Position', pos, ...
'HorizontalAlignment', 'right',...
'String', 'has neighbor #:', ...
'Tag', 'neighbornumberLabel');
x = x + w + 0.01;
w = 0.04;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'text', ...
'Position', pos, ...
'HorizontalAlignment', 'right',...
'String', '1', ...
'Tag', 'neighbornumberEdit');
% display 'Datamat: '
%
x = 0.05;
y = 0.77;
w = 0.22;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'text', ...
'Position', pos, ...
'HorizontalAlignment', 'left',...
'String', 'Datamat:', ...
'Tag', 'STDatamatLabel');
% create Datamat popup menu
%
y = 0.72;
pos = [x y w h];
cb_fn = [ 'struct_plot_rf_task(''LoadSTDatamat'');'];
popup_h = uicontrol('Parent',hh, ...
'units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'Style', 'popupmenu', ...
'Position', pos, ...
'HorizontalAlignment', 'left',...
'String', '', ...
'Value', 1, ...
'Tag', 'STDatamatPopup', ...
'Callback',cb_fn);
y = 0.18;
h = 0.5;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'frame', ...
'Position', pos, ...
'HorizontalAlignment', 'left',...
'Tag', 'CondFrame');
x = 0.09;
y = 0.64;
w = 0.14;
h = 0.05;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor', [0.8 0.8 0.8], ...
'Style', 'text', ...
'Position', pos, ...
'HorizontalAlignment', 'center',...
'String', 'Conditions', ...
'Tag', 'ConditionLabel');
x = 0.05;
y = 0.08;
w = 0.1;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'Style', 'push', ...
'Position', pos, ...
'String', 'Plot', ...
'Enable', 'off', ...
'visible', 'off', ...
'Tag', 'PlotButton', ...
'CallBack', 'struct_plot_rf_task(''PlotBnPress'');');
x = 0.1;
y = 0.08;
w = 0.12;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'Style', 'push', ...
'Position', pos, ...
'String', 'Close', ...
'CallBack', 'close(gcf)', ...
'Tag', 'CloseButton');
x = 0.01;
y = 0;
w = 1;
h = 0.05;
pos = [x y w h];
h0 = uicontrol('Parent',hh, ... % Message Line
'Style','text', ...
'Units','normal', ...
'FontUnits', 'normal', ...
'FontSize', fnt, ...
'BackgroundColor',[0.8 0.8 0.8], ...
'ForegroundColor',[0.8 0.0 0.0], ...
'HorizontalAlignment','left', ...
'Position',pos, ...
'String','', ...
'Tag','MessageLine');
% file menu
%
rri_file_menu(hh);
h_plot = uimenu('Parent',hh, ...
'Label','&Plot', ...
'Enable','on',...
'visible', 'off', ...
'Tag','PlotMenu');
h0 = uimenu('Parent',h_plot, ...
'Label','Plot individual datamat', ...
'Tag','PlotIndividualData', ...
'Callback','struct_plot_rf_task(''MENU_PlotIndividualData'');');
h0 = uimenu('Parent',h_plot, ...
'Label','Plot group data', ...
'Tag','PlotGroupData', ...
'visible', 'off', ...
'Callback','struct_plot_rf_task(''MENU_PlotGroupData'');');
h0 = uimenu('Parent',h_plot, ...
'Label','Plot all data', ...
'Tag','PlotAllData', ...
'Callback','struct_plot_rf_task(''MENU_PlotAllData'');');
h_option = uimenu('Parent',hh, ...
'Label','&Data', ...
'Tag','DataMenu', ...
'Enable','on',...
'Visible','off');
h0 = uimenu('Parent',h_option, ...
'Label','Export data', ...
'Tag','ExportData', ...
'Callback','struct_plot_rf_task(''MENU_ExportData'');');
h0 = uimenu('Parent',h_option, ...
'Label','Export data for behav analysis', ...
'Tag','ExportBehavData', ...
'visible', 'off', ...
'Callback','struct_plot_rf_task(''MENU_ExportBehavData'');');
h_option = uimenu('Parent',hh, ...
'Label','&Data', ...
'Tag','DataMenuBehav', ...
'Enable','on',...
'Visible','off');
h0 = uimenu('Parent',h_option, ...
'Label','Export data', ...
'Tag','ExportDataBehav', ...
'Callback','struct_plot_rf_task(''MENU_ExportDataBehav'');');
% set up object location records
%
x = 0.05;
y = 0.77;
w = 0.15;
h = 0.05;
obj(1).name = 'STDatamatLabel'; obj(1).pos = [x 1-y w h];
y = 0.72;
w = 0.22;
obj(2).name = 'STDatamatPopup'; obj(2).pos = [x 1-y w h];
x = 0.09;
y = 0.64;
w = 0.14;
h = 0.05;
obj(3).name = 'ConditionLabel'; obj(3).pos = [x 1-y w h];
y = 0.58;
obj(4).name = 'Condition1'; obj(4).pos = [x 1-y w h];
setappdata(hh,'ObjPosition',obj);
setappdata(hh,'CallBackFig',CallBackFig');
setappdata(CallBackFig,'VoxelIntensityFig',hh);
setappdata(hh,'VoxelIntensityFig',hh);
st_coords = getappdata(gcbf, 'BLVCoords');
if isempty(st_coords)
st_coords = getappdata(gcbf, 'BSRatioCoords');
end
setappdata(hh,'STCoords',st_coords);
setappdata(hh,'cond_selection',cond_selection);
% construct the popup label list
%
get_st_datamat_filename(DatamatFileList);
make_datamat_popup(1);
if (nargout >= 1),
fig = hh;
end;
setappdata(gcf, 'sa', getappdata(gcbf, 'sa'));
setappdata(gcf, 'isbehav', getappdata(gcbf,'isbehav'));
setappdata(gcf, 'actualHRF', getappdata(gcbf,'actualHRF'));
if ~getappdata(gcbf,'actualHRF') %getappdata(gcbf,'isbehav')
set(gcf, 'name', 'Datamat Correlations');
setappdata(gcf, 'datamatcorrs_lst', ...
getappdata(gcbf, 'datamatcorrs_lst'));
end
return;
%--------------------------------------------------------------------------
%
function gen_condition_chk_box(selected_idx)
st_files = getappdata(gcf,'STFiles');
session_info = st_files{selected_idx}.profile;
selected_conditions = st_files{selected_idx}.selected_conditions;
num_cond = sum(selected_conditions);
cname = session_info.condition(find(selected_conditions));
% display 'Conditions: '
%
h0 = findobj(gcf,'Tag','ConditionLabel');
if ~isempty(h0) % no condition has been defined yet
cond_h = get(h0,'UserData');
for i=1:length(cond_h);
delete(cond_h(i)); % remove the old conditions
end;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -