📄 mfbox_tool_maing.m
字号:
function varargout=mfbox_tool_maing(varargin)% mfBox - The model-free toolbox for SPM%% mfbox_tool_maing is the main 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_maing_OpeningFcn, ... 'gui_OutputFcn',@mfbox_tool_maing_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_maing is made visible.function mfbox_tool_maing_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};if (strcmp(handles.task,'start')) handles.buttons = struct('import_data',1,'save_res',0,'load_res',1,'import_ref',0, ... 'import_des',0,'import_bg',0,'design_clear',0,'reference_clear',0, ... 'export_data',0,'export_result',0,'plot_ic_wo',0, ... 'run',0,'clear_post',0,'run_pre',0,'run_post',0,'plot',0, ... 'keeppre',0,'run_estimate',0,'load_params',1,'save_params',1, ... 'modify_params',0,'export_mask',0,'export_congraph',0, ... 'export_ics',0,'export_ic',0,'export_cross',0,'compare_ics',0); handles.info = handles.info; handles.algos = data.algos; handles.algo_pre_name = data.algo_select.pre_name; handles.algo_name = data.algo_select.name; handles.algo_rel_name = data.algo_select.rel_name; handles.algo_pos_name = data.algo_select.pos_name; handles.permutation = data.permutation; handles.frontend = struct(); handles.plots = struct(); handles.images = struct();elseif (strcmp(handles.task,'continue')) handles.info = data.info; handles.algo_pre_name = data.algo_select.pre_name; handles.algo_name = data.algo_select.name; handles.algo_rel_name = data.algo_select.rel_name; handles.algo_pos_name = data.algo_select.pos_name; handles.frontend = data.frontend; handles.plots = data.plots; handles.images = data.images;else handles.algo = struct('pre',{{}},'algo',{{}},'rel',{{}},'pos',{{}});endset(handles.algo_preprocess,'String',handles.algo.pre,'Value',strcmp(handles.algo.pre,handles.algo_pre_name));set(handles.mf_algo,'String',handles.algo.algo,'Value',strcmp(handles.algo.algo,handles.algo_name));set(handles.algo_reliability,'String',handles.algo.rel,'Value',strcmp(handles.algo.rel,handles.algo_rel_name));set(handles.algo_postprocess,'String',handles.algo.pos,'Value',strcmp(handles.algo.pos,handles.algo_pos_name));but = 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)) set(handles.info,'String',handles.info);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(); algo_select = struct(); algo_select.pre_name = handles.algo.pre{get(handles.algo_preprocess,'Value')}; algo_select.name = handles.algo.algo{get(handles.mf_algo,'Value')}; algo_select.rel_name = handles.algo_rel_algo{get(handles.algo_reliability,'Value')}; algo_select.pos_name = handles.algo_pos_algo{get(handles.algo_postprocess,'Value')}; data.algo_select = algo_select; frontend = struct(); frontend.time_pos = get(handles.time_pos,'Value'); frontend.comp_pos = get(handles.comp_pos,'Value'); frontend.max_time_pos = get(handles.max_time_pos,'Max'); frontend.max_comp_pos = get(handles.max_comp_pos,'Max'); frontend.plot_type = get(handles.plot_type,'Value'); frontend.display_opts = get(handles.display_opts,'Value'); frontend.sort_comp = get(handles.sort_comp,'Value'); frontend.keeppre = get(handles.keeppre,'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 button press in import_data.function import_data_Callback(hObject,eventdata,handles)handles.buttons.import_data = 1;uiresume(handles.output);guidata(hObject,handles);% --- Executes on button press in save_res.function save_res_Callback(hObject,eventdata,handles)handles.buttons.save_res = 1;uiresume(handles.output);guidata(hObject,handles);% --- Executes on button press in load_res.function load_res_Callback(hObject,eventdata,handles)handles.buttons.load_res = 1;uiresume(handles.output);guidata(hObject,handles);% --- Executes on selection change in plot_type.function plot_type_Callback(hObject,eventdata,handles)uiresume(handles.output);guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function plot_type_CreateFcn(hObject,eventdata,handles)if (ispc&&(isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor')))) set(hObject,'BackgroundColor','white');end% --- Executes on slider movement.function time_pos_Callback(hObject,eventdata,handles)v = floor(get(hObject,'Value'));set(hObject,'Value',v);uiresume(handles.output);guidata(hObject,handles);% --- Executes on slider movement.function comp_pos_Callback(hObject,eventdata,handles)v = floor(get(hObject,'Value'));set(hObject,'Value',v);uiresume(handles.output);guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function comp_pos_CreateFcn(hObject,eventdata,handles)if (isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))) set(hObject,'BackgroundColor',[.9,.9,.9]);end% --- Executes during object creation, after setting all properties.function time_pos_CreateFcn(hObject,eventdata,handles)if (isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))) set(hObject,'BackgroundColor',[.9,.9,.9]);end% --- Executes on selection change in mf_algo.function mf_algo_Callback(hObject,eventdata,handles)% --- Executes during object creation, after setting all properties.function mf_algo_CreateFcn(hObject,eventdata,handles)if (ispc&&(isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor')))) set(hObject,'BackgroundColor','white');end% --- Executes on button press in run.function run_Callback(hObject,eventdata,handles)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -