📄 mfbox_tool_compareg.m
字号:
function varargout=mfbox_tool_compareg(varargin)% mfBox - The model-free toolbox for SPM%% mfbox_tool_compareg is the compare GUI window function.% Call this with SPM in the path, or directly from SPM.%% Copyright by Peter Gruber and Fabian J. Theis% Signal Processing & Information Theory group% Institute of Biophysics, University of Regensburg, Germany% Homepage: http://research.fabian.theis.name% http://www-aglang.uni-regensburg.de%% This file is free software, subject to the% GNU GENERAL PUBLIC LICENSE, see gpl.txt% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',mfilename, ... 'gui_Singleton',gui_Singleton, ... 'gui_OpeningFcn',@mfbox_tool_compareg_OpeningFcn, ... 'gui_OutputFcn',@mfbox_tool_compareg_OutputFcn, ... 'gui_LayoutFcn',[] , ... 'gui_Callback',[]);if (nargin&&(ischar(varargin{1}))) gui_State.gui_Callback = str2func(varargin{1});endif (nargout) [varargout{1:nargout}] = gui_mainfcn(gui_State,varargin{:});else gui_mainfcn(gui_State,varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before mfbox_tool_compareg is made visible.function mfbox_tool_compareg_OpeningFcn(hObject,eventdata,handles,varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin{1} button state% varargin{2} data% varargin{3} taskhandles.output = hObject;handles.buttons = varargin{1};data = varargin{2};handles.task = varargin{3};set(handles.selectdata,'String',{''},'Value',1);if (strcmp(handles.task,'start')) handles.buttons = struct('plot_comb',0,'plot_diff',0,'plot1',0,'plot2',0, ... 'spat_auto_group',0,'temp_auto_group',0,'spatiotemp_plot',0, ... 'spatial_match',0,'temporal_match',0,'add_data',1, ... 'remove_data',0,'dataselect1',0,'dataselect2',0,'run_ica',0, ... 'save_comparedata',0,'load_comparedata',1); handles.info = {}; handles.grouping = {}; handles.mfbsscomp = {}; handles.components_timeline = []; handles.frontend = struct(); handles.plots = struct(); handles.images = struct();elseif (strcmp(handles.task,'continue')) handles.info = data.info; handles.grouping = data.grouping; handles.mfbsscomp = data.mfbsscomp; handles.components_timeline = data.components_timeline; handles.frontend = data.frontend; handles.plots = data.plots; handles.images = data.images;endbut = fieldnames(handles.buttons);o = {'off','on'};for i=1:length(but) set(handles.(but{i}),'Enable',o{handles.buttons.(but{i})+1}); handles.buttons.(but{i}) = 0;endt = fieldnames(handles.plots);for i=1:length(t) j = t{i}; l = handles.plots.(j); p = l.plots; for k=1:length(p) v = p{k}; plot(handles.(j),v{:}); set(handles.(j),'NextPlot','add'); end set(handles.(j),'NextPlot','replace',l.axes{:});endt = fieldnames(handles.images);for i=1:length(t) l = handles.images.(t{i}); image(l{:},'Parent',handles.(t{i}));endt = fieldnames(handles.frontend);for i=1:length(t) l = handles.frontend.(t{i}); ln = fieldnames(l); x = {}; for j=1:length(ln) x{end+1} = ln{j}; x{end+1} = l.(ln{j}); end set(handles.(t{i}),x{:});endif (~isempty(handles.info)) cur = get(handles.selectdata,'Value'); set(handles.info_data,'String',handles.info{cur});endguidata(hObject,handles);if (strcmp(handles.task,'continue')) uiwait(hObject);end% --- Outputs from this function are returned to the command line.function varargout=mfbox_tool_compareg_OutputFcn(hObject,eventdata,handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin{1} the figure% varargin{2} task% varargin{3} button state% varargin{4} dataif (isstruct(handles)) if (strcmp(handles.task,'stop')) close(handles.output); delete(handles.output); handles.output = []; end if (nargout>0), varargout{1} = handles.output; end if (nargout>1), varargout{2} = 'continue'; end if (nargout>2), varargout{3} = handles.buttons; end if (nargout>3) data = struct(); data.grouping = handles.grouping; frontend = struct(); names = mknames(length(handles.mfbsscomp),'Data'); c = get(handles.dataselect1,'String'); if (~isempty(c)), [frontend.dataselect1] = find(strcmp(names,c{get(handles.dataselect1,'Value')})); else frontend.dataselect1 = []; end c = get(handles.dataselect2,'String'); if (~isempty(c)), [frontend.dataselect2] = find(strcmp(names,c{get(handles.dataselect2,'Value')})); else frontend.dataselect2 = []; end frontend.position = get(handles.position,'Value'); frontend.orderselect = get(handles.orderselect,'Value'); frontend.varthresh = get(handles.varthresh,'Value'); frontend.groups = get(handles.groups,'Value'); frontend.zoomfact = get(handles.zoomfact,'Value'); frontend.selectdata = get(handles.selectdata,'Value'); data.frontend = frontend; varargout{4} = data; endelse varargout{1} = []; if (nargout>1), varargout{2} = 'stop'; end if (nargout>2), varargout{3} = []; end if (nargout>3), varargout{4} = []; endend% --- Executes on selection change in components1.function components1_Callback(hObject,eventdata,handles)if (length(handles.mfbsscomp)>1) names = mknames(length(handles.mfbsscomp),'Data'); c = get(handles.dataselect1,'String'); sel1 = find(strcmp(names,c{get(handles.dataselect1,'Value')}));else sel1 = 1;endg = handles.grouping;curgroup = get(handles.groups,'Value');t = get(handles.components1,'Value');if (~isempty(t)) for i=1:size(g,2); if (i~=curgroup) v = g{sel1,i}; if (~isempty(v)) g{sel1,i} = v(~any(repmat(v(:)', ... length(t),1)==repmat(t(:),1,length(v)),1)); end end endendg{sel1,curgroup} = t;handles.grouping = fixgrouping(g,handles.mfbsscomp);uiresume(handles.output);guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function components1_CreateFcn(hObject,eventdata,handles)if (ispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))) set(hObject,'BackgroundColor','white');end% --- Executes on selection change in components2.function components2_Callback(hObject,eventdata,handles)names = mknames(length(handles.mfbsscomp),'Data');c = get(handles.dataselect2,'String');sel2 = find(strcmp(names,c{get(handles.dataselect2,'Value')}));curgroup = get(handles.groups,'Value');g = handles.grouping;t = get(handles.components2,'Value');if (~isempty(t)) for i=1:size(g,2); if (i~=curgroup) v = g{sel2,i}; if (~isempty(v)) g{sel2,i} = v(~any(repmat(v(:)', ... length(t),1)==repmat(t(:),1,length(v)),1)); end end endendg{sel2,curgroup} = t;handles.grouping = fixgrouping(g,handles.mfbsscomp);uiresume(handles.output);guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function components2_CreateFcn(hObject,eventdata,handles)if (ispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))) set(hObject,'BackgroundColor','white');end% --- Executes on button press in save_comparedata.function save_comparedata_Callback(hObject, eventdata, handles)handles.buttons.save_comparedata = 1;uiresume(handles.output);guidata(hObject,handles);% --- Executes on button press in load_comparedata.function load_comparedata_Callback(hObject, eventdata, handles)handles.buttons.load_comparedata = 1;uiresume(handles.output);guidata(hObject,handles);% --- Executes on button press in temporal_match.function temporal_match_Callback(hObject, eventdata, handles)handles.buttons.temporal_match = 1;uiresume(handles.output);guidata(hObject,handles);% --- Executes on button press in spatial_match.function spatial_match_Callback(hObject, eventdata, handles)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -