load data with applying SSP(Signal-Space Projection) operation from fiffile. [USAGE] [bexp] = neuromag_load_meg_data_withSSP(<fif_file>, <index_in_fif_file>); [IN] fif_file : fif file(Continuous file or Evoked file) index_in_fiffile : = -1 : continuous = N : read data set number in fiffile. [OUT] bexp : The data of one channel in each row, a single time sample in each column. Units: SI units. fT/m for gradiometers, fT for magnetometers, V for electric channels. Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [bexp, ch_info, sf] = neuromag_load_meg_data_SSP(fif_file, index_in_fiffile) 0002 % load data with applying SSP(Signal-Space Projection) operation from fiffile. 0003 % [USAGE] 0004 % [bexp] = neuromag_load_meg_data_withSSP(<fif_file>, <index_in_fif_file>); 0005 % [IN] 0006 % fif_file : fif file(Continuous file or Evoked file) 0007 % index_in_fiffile : = -1 : continuous 0008 % = N : read data set number in fiffile. 0009 % [OUT] 0010 % bexp : The data of one channel in each row, a single time sample in 0011 % each column. Units: SI units. fT/m for gradiometers, fT for 0012 % magnetometers, V for electric channels. 0013 % 0014 % Copyright (C) 2011, ATR All Rights Reserved. 0015 % License : New BSD License(see VBMEG_LICENSE.txt) 0016 0017 % 0018 % --- Previous check 0019 % 0020 if ~exist('fif_file', 'var') 0021 error('fif_file is a required parameter.'); 0022 end 0023 if exist(fif_file, 'file') ~= 2 0024 error('fif_file:%s is not found.', fif_file); 0025 end 0026 if ~exist('index_in_fiffile', 'var') 0027 index_in_fiffile = -1; % continuous 0028 end 0029 0030 0031 % 0032 % --- Main Procedure 0033 % 0034 ch_info = neuromag_load_ch_info(fif_file); 0035 0036 if index_in_fiffile == -1 0037 % load Continuous data 0038 raw = fiff_setup_read_raw(fif_file); 0039 for k=1:length(raw.info.projs) 0040 raw.info.projs(k).active = true; 0041 end 0042 proj = mne_make_projector_info(raw.info); 0043 raw.proj = proj; 0044 bexp = fiff_read_raw_segment(raw); 0045 sf = raw.info.sfreq; 0046 else 0047 % load Evoked data 0048 raw = fiff_read_evoked(fif_file, index_in_fiffile); 0049 bexp = raw.evoked.epochs; 0050 sf = raw.info.sfreq; 0051 end 0052 0053 meg_ix = []; 0054 for k=1:ch_info.Nch 0055 channel_name = ch_info.channel_name(k, :); 0056 meg_ix = [meg_ix; strmatch(channel_name, raw.info.ch_names, 'exact')]; 0057 end 0058 bexp = bexp(meg_ix, :, :);