⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pop_dipfit_manual.m

📁 含有多种ICA算法的eeglab工具箱
💻 M
📖 第 1 页 / 共 2 页
字号:
% pop_dipfit_manual() - interactively do dipole fit of selected ICA components%% Usage: %  >> OUTEEG = pop_dipfit_manual( INEEG )%% Inputs:%   INEEG       input dataset%% Outputs:%   OUTEEG      output dataset%% Author: Robert Oostenveld, SMI/FCDC, Nijmegen 2003%         Arnaud Delorme, SCCN, La Jolla 2003% SMI, University Aalborg, Denmark http://www.smi.auc.dk/% FC Donders Centre, University Nijmegen, the Netherlands http://www.fcdonders.kun.nl/% Copyright (C) 2003 Robert Oostenveld, SMI/FCDC roberto@miba.auc.dk%% This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.%% This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% GNU General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA% $Log: pop_dipfit_manual.m,v $% Revision 1.24  2004/03/26 01:33:29  arno% plot only active dipoles%% Revision 1.23  2003/12/04 17:09:07  arno% num2str -> str2num%% Revision 1.22  2003/12/04 16:05:58  arno% setting values when modifying gui%% Revision 1.21  2003/10/31 16:45:52  arno% worind from Scott's feedback%% Revision 1.20  2003/10/30 02:39:14  arno% gui typo%% Revision 1.19  2003/10/29 23:21:01  arno% more checking for component index%% Revision 1.18  2003/10/29 23:03:37  arno% decrease window width%% Revision 1.17  2003/10/29 16:08:00  arno% removing debug msg%% Revision 1.16  2003/10/29 03:12:11  arno% contrain electrode to sphere%% Revision 1.15  2003/09/30 15:42:34  roberto% minor bug fix, related to the change in dipole constraint handling%% Revision 1.14  2003/09/12 08:43:18  roberto% changed symmetry constraint into optional input argument%% Revision 1.12  2003/07/01 23:49:08  arno% implementing dipole flipping%% Revision 1.11  2003/06/30 02:11:54  arno% *** empty log message ***%% Revision 1.10  2003/06/16 10:10:11  roberto% added interruptible dialog (gui) for non-linear fit%% Revision 1.9  2003/06/13 16:48:57  arno% remove chanlocs conversion%% Revision 1.8  2003/06/13 01:26:01  arno% automatic conversion of channel location files%% Revision 1.7  2003/06/13 01:17:49  arno% adding plotting button%% Revision 1.6  2003/03/12 10:32:32  roberto% fixed dialog title%% Revision 1.5  2003/03/06 15:58:21  roberto% fixed bug with channel selection of EEG data%% Revision 1.3  2003/03/03 16:52:27  roberto% modified for posxyz/momxyz instead of dip.pos/dip.mom% changed large listbox into edit field%% Revision 1.2  2003/02/28 23:03:14  arno% making the listbox to scroll component%% Revision 1.1  2003/02/24 10:06:15  roberto% Initial revision%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function [OUTEEG, com] = pop_dipfit_manual( EEG, subfunction, parent, dipnum )%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% the code for this interactive dialog has 4 major parts% - draw the graphical user interface% - synchronize the gui with the data% - synchronize the data with the gui% - execute the actual dipole analysisif nargin<1  help pop_dipfit_manual;  returnelseif nargin==1OUTEEG = EEG;com = '';if ~isfield(EEG, 'chanlocs')  error('No electrodes present');endif ~isfield(EEG, 'icawinv')  error('No ICA components to fit');endif ~isfield(EEG, 'dipfit')  error('General dipolefit settings not specified');endif ~isfield(EEG.dipfit, 'vol')  error('Dipolefit volume conductor model not specified');end% select all ICA components as 'fitable'select = 1:size(EEG.icawinv,2);if ~isfield(EEG.dipfit, 'current')  EEG.dipfit.current = 1;end% verify the presence of a dipole modelif ~isfield(EEG.dipfit, 'model')  % create empty dipole model for each component  for i=select    EEG.dipfit.model(i).posxyz = zeros(2,3);    EEG.dipfit.model(i).momxyz = zeros(2,3);    EEG.dipfit.model(i).rv     = 1;    EEG.dipfit.model(i).active = [1];    EEG.dipfit.model(i).select = [1];  endend% verify the size of each dipole modelfor i=select  if ~isfield(EEG.dipfit.model, 'posxyz') | length(EEG.dipfit.model) < i | isempty(EEG.dipfit.model(i).posxyz)    % replace all empty dipole models with a two dipole model, of which one is active    EEG.dipfit.model(i).active = [1];    EEG.dipfit.model(i).select = [1];    EEG.dipfit.model(i).rv = 1;    EEG.dipfit.model(i).posxyz = zeros(2,3);    EEG.dipfit.model(i).momxyz = zeros(2,3);  elseif size(EEG.dipfit.model(i).posxyz,1)==1    % replace all one dipole models with a two dipole model    EEG.dipfit.model(i).active = [1];    EEG.dipfit.model(i).select = [1];    EEG.dipfit.model(i).posxyz = [EEG.dipfit.model(i).posxyz; [0 0 0]];    EEG.dipfit.model(i).momxyz = [EEG.dipfit.model(i).momxyz; [0 0 0]];  elseif size(EEG.dipfit.model(i).posxyz,1)>2    % replace all more-than-two dipole models with a two dipole model    warning('pruning dipole model to two dipoles');    EEG.dipfit.model(i).active = [1];    EEG.dipfit.model(i).select = [1];    EEG.dipfit.model(i).posxyz = EEG.dipfit.model(i).posxyz(1:2,:);    EEG.dipfit.model(i).momxyz = EEG.dipfit.model(i).momxyz(1:2,:);  endend% default is not to use symmetry constraintconstr = [];%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% construct the graphical user interface%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% define the callback functions for the interface elementscb_plotmap         = 'pop_dipfit_manual(EEG, ''dialog_plotmap'', gcbf);';cb_selectcomponent = 'pop_dipfit_manual(EEG, ''dialog_selectcomponent'', gcbf);';cb_checkinput      = 'pop_dipfit_manual(EEG, ''dialog_checkinput'', gcbf);';cb_fitposition     = 'pop_dipfit_manual(EEG, ''dialog_getvalue'', gcbf); pop_dipfit_manual(EEG, ''dipfit_position'', gcbf); pop_dipfit_manual(EEG, ''dialog_setvalue'', gcbf);';cb_fitmoment       = 'pop_dipfit_manual(EEG, ''dialog_getvalue'', gcbf); pop_dipfit_manual(EEG, ''dipfit_moment''  , gcbf); pop_dipfit_manual(EEG, ''dialog_setvalue'', gcbf);';cb_close           = 'close(gcbf)';cb_help            = 'pophelp(''pop_dipfit_manual'');';cb_ok              = 'uiresume(gcbf);'; cb_plotdip         = 'pop_dipfit_manual(EEG, ''dialog_getvalue'', gcbf); pop_dipfit_manual(EEG, ''dialog_plotcomponent'', gcbf);';cb_flip1           = 'pop_dipfit_manual(EEG, ''dialog_flip'', gcbf, 1);';cb_flip2           = 'pop_dipfit_manual(EEG, ''dialog_flip'', gcbf, 2);';% vertical layout for each line geomvert  =   [1 1 1 1 1 1 1 1 1]; % horizontal layout for each line geomhoriz = {	      [0.8 0.5 0.8 1 1]              [1]              [0.7 0.7  0.7     2 2 1]              [0.7 0.5 0.2 0.5 0.2 2 2 1]              [0.7 0.5 0.2 0.5 0.2 2 2 1]              [1]               [1 1 1]              [1]              [1 1 1]            };% define each individual graphical user elementelements  = { ...              { 'style' 'text'       'string' 'Component to fit'    } ...              { 'style' 'edit'       'string' 'dummy'    'tag' 'component' 'callback' cb_selectcomponent } ...              { 'style' 'pushbutton' 'string' 'Plot map'                   'callback' cb_plotmap } ...              { 'style' 'text'       'string' 'Residual variance = '                                             } ...              { 'style' 'text'       'string' 'dummy'         'tag' 'relvar'                                  } ...              { } ...              { 'style' 'text'    'string' 'dipole'     } ...              { 'style' 'text'    'string' 'active'     } ...              { 'style' 'text'    'string' 'fit'        } ...              { 'style' 'text'    'string' 'position'   } ...              { 'style' 'text'    'string' 'moment'     } ...              { } ...              ...              { 'style' 'text'        'string' '#1' 'tag' 'dip1'                                 } ...              { 'style' 'checkbox'    'string' ''   'tag' 'dip1act'    'callback' cb_checkinput  } { } ...              { 'style' 'checkbox'    'string' ''   'tag' 'dip1sel'    'callback' cb_checkinput  } { } ...              { 'style' 'edit'        'string' ''   'tag' 'dip1pos'    'callback' cb_checkinput  } ...              { 'style' 'edit'        'string' ''   'tag' 'dip1mom'    'callback' cb_checkinput  } ...              { 'style' 'pushbutton'  'string' 'Flip (in|out)'         'callback' cb_flip1       } ...                 ...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -