Home > functions > job > job_view_leadfield_dir > job_view_lf_load_leadfield.m

job_view_lf_load_leadfield

PURPOSE ^

Load leadfield

SYNOPSIS ^

function job_view_lf_load_leadfield(inst_id,basisfile)

DESCRIPTION ^

 Load leadfield

 --- Syntax
 function job_view_lf_load_leadfield(inst_id,basisfile)

 --- History
 2009-01-27 Taku Yoshioka

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function job_view_lf_load_leadfield(inst_id,basisfile)
0002 % Load leadfield
0003 %
0004 % --- Syntax
0005 % function job_view_lf_load_leadfield(inst_id,basisfile)
0006 %
0007 % --- History
0008 % 2009-01-27 Taku Yoshioka
0009 %
0010 % Copyright (C) 2011, ATR All Rights Reserved.
0011 % License : New BSD License(see VBMEG_LICENSE.txt)
0012 
0013 global vbmeg_inst; 
0014 
0015 %
0016 % Global variables
0017 %
0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0019 h_fig = vbmeg_inst.viewlf{inst_id}.h_fig; 
0020 set(h_fig,'Pointer','watch');
0021 
0022 %
0023 % Load lead field data and sensor information
0024 %
0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0026 if ~exist(basisfile,'file'),
0027   warndlg(['File ' basisfile ' does not exist.']);
0028   set(h_fig,'Pointer','arrow');
0029   return;
0030 end
0031 
0032 vbmeg_inst.viewlf{inst_id}.basisfile = basisfile;
0033 basis = vb_load_basis(basisfile);
0034 vbmeg_inst.viewlf{inst_id}.basis_org = (basis*1e-9*1e15)';
0035 
0036 % Sensor information
0037 load(basisfile,'basis_parm');
0038 megfile = basis_parm.meg_file;
0039 if iscell(megfile), megfile = megfile{1}; end
0040 if ~exist(megfile), 
0041   warndlg(['File ' megfile ' does not exist.\n ' ...
0042            'You can manually load MEG/EEG file, including sensor ' ...
0043            'information.']);
0044   uiwait;
0045   [meg_dir,meg_file] = vb_file_select({'.meg.mat','.eeg.mat'}, ...
0046                                       'Load MEG/EEG data');
0047   if ~isempty(meg_file), 
0048     megfile = [meg_dir filesep meg_file{1}];
0049   else
0050     vbmeg_inst.viewlf{inst_id}.basis_org = [];
0051     set(h_fig,'Pointer','arrow');
0052     return;
0053   end
0054   
0055   if ~exist(megfile), 
0056     warndlg(['File ' megfile ' does not exist.\n ']);
0057     vbmeg_inst.viewlf{inst_id}.basis_org = [];
0058     set(h_fig,'Pointer','arrow');
0059     return;
0060   end
0061 end
0062 
0063 
0064 vbmeg_inst.viewlf{inst_id}.MEGinfo = vb_load_meg_info(megfile);
0065 pick = vb_load_sensor(megfile);
0066 if size(pick,1)==2*size(vbmeg_inst.viewlf{inst_id}.basis_org,1), 
0067   pick = pick(1:size(vbmeg_inst.viewlf{inst_id}.basis_org,1),:);
0068 end
0069 vbmeg_inst.viewlf{inst_id}.pick = pick;
0070 
0071 job_view_lf_change_filter_radius(inst_id); % Smoothed lead field
0072 
0073 %
0074 % Update plots
0075 %
0076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0077 job_view_lf_update_cortexpattern(inst_id);
0078 job_view_lf_update_sensorpattern(inst_id);
0079 set(h_fig,'Pointer','arrow');
0080 
0081 %
0082 % Change figure title
0083 %
0084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0085 [tmp,fname,ext] = fileparts(basisfile);
0086 set(h_fig,'Name',['job_view_leadfield: ' fname ext]);

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005