?? bfm_plot_datamatcorrs.m
字號:
function fig = bfm_plot_datamatcorrs(action,varargin)
%
% USAGE: fig = bfm_plot_datamatcorrs(action,varargin)
%
if ~exist('action','var') | isempty(action)
% [PLSresultFile,PLSresultFilePath] = ...
% uigetfile('*_BfMRIresult.mat','Open PLS Result');
% if (PLSresultFilePath == 0), return; end;
% PLSResultFile = fullfile(PLSresultFilePath,PLSresultFile);
h = findobj(gcbf,'Tag','ResultFile');
PLSResultFile = get(h,'UserData');
msg = 'Loading Datamat Correlations Data ... Please wait!';
h = rri_wait_box(msg, [0.5 0.1]);
fig_h = init(PLSResultFile);
setappdata(gcf,'CallingFigure',gcbf);
% set(gcbf,'visible','off');
rot_amount = load_pls_result;
bfm_plot_datamatcorrs('Rotation', rot_amount);
if (nargout > 0),
fig = fig_h;
end;
delete(h);
dims = getappdata(gcf,'STDims');
origin = getappdata(gcf,'STOrigin');
if origin(1) < 1, origin(1) = 1; end
if origin(2) < 1, origin(2) = 1; end
if origin(3) < 1, origin(3) = 1; end
if origin(1) > dims(1), origin(1) = dims(1); end
if origin(2) > dims(2), origin(2) = dims(2); end
if origin(3) > dims(4), origin(3) = dims(4); end
h = findobj(gcf,'Tag','XYZVoxel');
set(h, 'string', num2str(origin));
h = findobj(gcf,'Tag','MessageLine');
set(h,'String','');
EditXYZ;
return;
end;
% clear the message line,
%
h = findobj(gcf,'Tag','MessageLine');
set(h,'String','');
if (strcmp(action,'PlotBnPress'))
ShowResult(0,1); % display brainlv inside the Plot BLV figure
elseif (strcmp(action,'PlotOnNewFigure'))
ShowResult(1,0); % display brainlv in a new figure;
elseif (strcmp(action,'Zooming'))
zoom_on_state = get(gcbo,'Userdata');
if (zoom_on_state == 1)
zoom on;
set(gcbo,'Userdata',0,'Label','&Zoom off');
set(gcf,'pointer','crosshair');
else
zoom off;
set(gcbo,'Userdata',1,'Label','&Zoom on');
set(gcf,'pointer','arrow');
end;
elseif (strcmp(action,'Toggle_View'))
ToggleView;
ShowResult(0,1);
elseif (strcmp(action,'Rotation'))
p_img = getappdata(gcf,'p_img');
if ~isempty(p_img)
p_img = [-1 -1];
setappdata(gcf,'p_img',p_img);
end
setappdata(gcf,'img_xhair',[]);
rot_amount = varargin{1};
setappdata(gcf,'RotateAmount',rot_amount);
switch mod(rot_amount,4)
case {0}, % 0 degree
h = findobj(gcf,'Tag','Rotate0Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate90Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate180Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate270Menu');
set(h,'Checked','on');
case {1}, % 90 degree by default
h = findobj(gcf,'Tag','Rotate0Menu');
set(h,'Checked','on');
h = findobj(gcf,'Tag','Rotate90Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate180Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate270Menu');
set(h,'Checked','off');
case {2}, % 180 degree
h = findobj(gcf,'Tag','Rotate0Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate90Menu');
set(h,'Checked','on');
h = findobj(gcf,'Tag','Rotate180Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate270Menu');
set(h,'Checked','off');
case {3}, % 270 degree
h = findobj(gcf,'Tag','Rotate0Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate90Menu');
set(h,'Checked','off');
h = findobj(gcf,'Tag','Rotate180Menu');
set(h,'Checked','on');
h = findobj(gcf,'Tag','Rotate270Menu');
set(h,'Checked','off');
end;
ShowResult(0,0);
EditXYZ;
elseif (strcmp(action,'EditGroup'))
EditGroup;
ShowResult(0,1);
elseif (strcmp(action,'EditBehav'))
EditBehav;
ShowResult(0,1);
elseif (strcmp(action,'EditLV'))
EditLV;
ShowResult(0,1);
elseif (strcmp(action,'EditBSLV'))
EditBSLV;
ShowResult(0,1);
elseif (strcmp(action,'EditMin'))
g_idx = getappdata(gcbf,'CurrGroupIdx');
c_idx = getappdata(gcbf,'CurrLVIdx');
b_idx = getappdata(gcbf,'CurrBehavIdx');
data = getappdata(gcbf,'BLVData');
thresh = getappdata(gcbf,'BLVThreshold');
setting = getappdata(gcbf,'setting');
old_min_blv = setting.min_blv{g_idx,c_idx,b_idx};
if str2num(get(gco,'string')) < min(data{g_idx,b_idx}(:,c_idx)) | str2num(get(gco,'string')) > thresh
msg = ['Valid number should be within [' num2str([min(data{g_idx,b_idx}(:,c_idx)) thresh]) ']'];
set(findobj(gcbf,'Tag','MessageLine'),'String',msg);
set(gco,'string',num2str(old_min_blv));
return;
end
bfm_plot_datamatcorrs('PlotBnPress');
elseif (strcmp(action,'EditMax'))
g_idx = getappdata(gcbf,'CurrGroupIdx');
c_idx = getappdata(gcbf,'CurrLVIdx');
b_idx = getappdata(gcbf,'CurrBehavIdx');
data = getappdata(gcbf,'BLVData');
thresh = getappdata(gcbf,'BLVThreshold');
setting = getappdata(gcbf,'setting');
old_max_blv = setting.max_blv{g_idx,c_idx,b_idx};
if str2num(get(gco,'string')) > max(data{g_idx,b_idx}(:,c_idx)) | str2num(get(gco,'string')) < thresh
msg = ['Valid number should be within [' num2str([thresh max(data{g_idx,b_idx}(:,c_idx))]) ']'];
set(findobj(gcbf,'Tag','MessageLine'),'String',msg);
set(gco,'string',num2str(old_max_blv));
return;
end
bfm_plot_datamatcorrs('PlotBnPress');
elseif (strcmp(action,'UpdatePValue'))
UpdatePValue;
ShowResult(0,1);
elseif (strcmp(action,'SelectPixel'))
SelectPixel;
elseif (strcmp(action,'DeleteNewFigure'))
try
load('pls_profile');
pls_profile = which('pls_profile.mat');
bfm_plot_datamatcorrs_newfig_pos = get(gcbf,'position');
save(pls_profile, '-append', 'bfm_plot_datamatcorrs_newfig_pos');
catch
end
elseif (strcmp(action,'DeleteFigure'))
try
load('pls_profile');
pls_profile = which('pls_profile.mat');
bfm_plot_datamatcorrs_pos = get(gcbf,'position');
save(pls_profile, '-append', 'bfm_plot_datamatcorrs_pos');
catch
end
old_setting = getappdata(gcbf,'old_setting');
setting = getappdata(gcbf,'setting');
save_display_status = 'off';
try
load('pls_profile');
catch
end
if strcmpi(save_display_status, 'off')
setting = [];
end
if ~isequal(setting, old_setting) & strcmpi(save_display_status, 'on')
% save_setting = ...
% questdlg('Would you like to save the display setting?', ...
% 'Save current fields', 'yes', 'no', 'yes');
if 1 % strcmp(save_setting, 'yes')
try
PLSresultFile = get(findobj(gcbf,'Tag','ResultFile'),'UserData');
setting4 = setting;
save(PLSresultFile, '-append', 'setting4');
catch
msg = 'Cannot save setting information';
msgbox(msg,'ERROR','modal');
end
end
end
% DeleteLinkedFigure;
% calling_fig = getappdata(gcf,'CallingFigure');
% set(calling_fig,'visible','on');
elseif (strcmp(action,'OpenResponseFnPlot'))
OpenResponseFnPlot;
elseif (strcmp(action,'OpenCorrelationPlot'))
OpenCorrelationPlot;
elseif (strcmp(action,'OpenDatamatcorrsPlot'))
OpenDatamatcorrsPlot;
elseif (strcmp(action,'OpenScoresPlot'))
bfm_plot_scores_ui(varargin{1});
elseif (strcmp(action,'OpenDesignPlot'))
OpenDesignPlot;
elseif (strcmp(action,'OpenBrainScoresPlot'))
OpenBrainScoresPlot;
elseif (strcmp(action,'OpenBrainPlot'))
OpenBrainPlot;
elseif (strcmp(action,'OpenEigenPlot'))
OpenEigenPlot;
elseif (strcmp(action,'OpenContrastWindow'))
OpenContrastWindow;
elseif (strcmp(action,'SetClusterReportOptions'))
SetClusterReportOptions;
elseif (strcmp(action,'LoadClusterReport'))
fmri_cluster_report('LoadClusterReport',gcbf);
elseif (strcmp(action,'OpenClusterReport'))
OpenClusterReport;
elseif (strcmp(action,'LoadBackgroundImage'))
LoadBackgroundImage;
elseif (strcmp(action,'SaveBackgroundImage'))
SaveBackgroundImage;
elseif (strcmp(action,'LoadResultFile'))
LoadResultFile;
elseif (strcmp(action,'SaveResultToIMG'))
SaveResultToIMG(0);
elseif (strcmp(action,'SaveDisplayToIMG'))
SaveResultToIMG(1);
elseif (strcmp(action,'RescaleBnPress'))
RescaleBnPress;
ShowResult(0,1);
elseif (strcmp(action,'EditXYZ'))
EditXYZ;
elseif (strcmp(action,'EditXYZmm'))
xyz_mm = str2num(get(findobj(gcbf,'tag','XYZmm'),'string'));
if isempty(xyz_mm) | ~isequal(size(xyz_mm),[1 3])
msg = 'XYZ(mm) should contain 3 numbers (X, Y, and Z)';
set(findobj(gcf,'Tag','MessageLine'),'String',msg);
return;
end
origin = getappdata(gcf,'Origin');
voxel_size = getappdata(gcf,'STVoxelSize');
xyz_offset = xyz_mm ./ voxel_size;
xyz = round(xyz_offset + origin);
set(findobj(gcbf,'tag','XYZVoxel'), 'string', num2str(xyz));
EditXYZ;
elseif (strcmp(action,'orient'))
orient;
end;
return;
%---------------------------------------------------------------------------
%
function h0 = init(PLSResultFile);
setting4 = [];
warning off;
load(PLSResultFile, 'setting4');
setting = setting4;
warning on;
save_display_status = 'off';
try
load('pls_profile');
catch
end
if strcmpi(save_display_status, 'off')
setting = [];
end
save_setting_status = 'on';
bfm_plot_datamatcorrs_pos = [];
try
load('pls_profile');
catch
end
if ~isempty(bfm_plot_datamatcorrs_pos) & strcmp(save_setting_status,'on')
pos = bfm_plot_datamatcorrs_pos;
else
fig_w = 0.85;
fig_h = 0.8;
fig_x = (1 - fig_w)/2;
fig_y = (1 - fig_h)/2;
pos = [fig_x fig_y fig_w fig_h];
end
% [r_path,r_file,r_ext] = fileparts(PLSResultFile);
h0 = figure('Units','normal', ...
'Color',[0.8 0.8 0.8], ...
'Name','Blocked fMRI BLV Plot', ...
'NumberTitle','off', ...
'DoubleBuffer','on', ...
'MenuBar','none',...
'Position',pos, ...
'DeleteFcn','bfm_plot_datamatcorrs(''DeleteFigure'')', ...
'Tag','PlotBrainLV');
%
x = .37;
y = .1;
w = .5;
h = .85;
pos = [x y w h];
axes_h = axes('Parent',h0, ... % axes
'Units','normal', ...
'CameraUpVector',[0 1 0], ...
'CameraUpVectorMode','manual', ...
'Color',[1 1 1], ...
'Position',pos, ...
'XTick', [], ...
'YTick', [], ...
'Tag','BlvAxes');
x = x+w+.02;
w = .04;
pos = [x y w h];
colorbar_h = axes('Parent',h0, ... % c axes
'Units','normal', ...
'Position',pos, ...
'XTick', [], ...
'YTick', [], ...
'Tag','Colorbar');
%
x = .03;
y = .91;
w = .14;
h = .04;
pos = [x y w h];
fnt = 0.6;
h1 = uicontrol('Parent',h0, ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',pos, ...
'String','Group Index:', ...
'Style','text', ...
'Tag','ResultFileLabel');
x = x+w;
y = y+.01;
w = .05;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ...
'Units','normal', ...
'BackgroundColor',[1 1 1], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'ListboxTop',0, ...
'Position',pos, ...
'Style','edit', ...
'Callback','bfm_plot_datamatcorrs(''EditGroup'')', ...
'Tag','GroupIndexEdit');
x = x+w;
y = y-.01;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','center', ...
'ListboxTop',0, ...
'Position',pos, ...
'String','of', ...
'Style','text', ...
'UserData', PLSResultFile, ...
'Tag','ResultFile');
x = x+w;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
'FontSize',fnt, ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',pos, ...
'Style','text', ...
'Tag','GroupNumberEdit');
x = .03;
y = y-h-.03;
w = .14;
pos = [x y w h];
h1 = uicontrol('Parent',h0, ...
'Units','normal', ...
'BackgroundColor',[0.8 0.8 0.8], ...
'fontunit','normal', ...
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -