Back to the main page.
Bug 2005 - ft_sourceanalysis: improve data handling
Status | CLOSED FIXED |
Reported | 2013-02-23 12:11:00 +0100 |
Modified | 2014-02-12 10:33:54 +0100 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P3 normal |
Assigned to: | Jan-Mathijs Schoffelen |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Jan-Mathijs Schoffelen - 2013-02-23 12:11:07 +0100
in particular: - when spatial filters are already in the input, sourcemodel csd doesn't need to be computed - when spatial filters are already in the input, do not rely on the dimensionality of the leadfields (for the scanning dipole) to determine the number of dipole orientations (input can be scalar filter). - when spatial filters are already in the input, and no refdip is specified, headmodel is not needed. Some of this is probably dealt with currently in ft_sourceanalysis, some of this in the lower level functions.
Jan-Mathijs Schoffelen - 2013-02-23 20:49:21 +0100
bash-3.2$ svn commit -m "enhancement - don't use leadfield to determine the number of orientations when filter is already in input (and can be used)" beamformer_pcc.m Sending beamformer_pcc.m Transmitting file data . Committed revision 7537.
Alexander Backus - 2013-08-20 11:23:07 +0200
(In reply to comment #1) beamformer_pcc.m line 249: Script wants to assign scandiplabel based on previous leadfield. However, variable lf (leadfield) is not instantiated when previously computed spatial filter is already input. Traced back to lines 83 and 160. Cheers & thanks, Alex
Jan-Mathijs Schoffelen - 2013-08-20 11:31:57 +0200
Could you please upload some small data + script for quick reproduction and testing?
Alexander Backus - 2013-08-20 11:45:29 +0200
(In reply to comment #3) %% Combined frequency and source analysis clear all load('bug2005_data.mat') % Frequency analysis foi = 5; cfg = []; cfg.foi = foi; cfg.trials = 'all'; cfg.keeptrials = 'yes'; cfg.keeptapers = 'yes'; cfg.output = 'fourier'; cfg.channel = 'MEG'; cfg.method = 'mtmfft'; cfg.taper = 'dpss'; cfg.tapsmofrq = 2; f_data = ft_freqanalysis(cfg, data); % f = frequency % JM hack cf_data = f_data; cf_data = ft_checkdata(cf_data,'cmbrepresentation','fullfast'); % efficiently compute crsspctrm cf_data = ft_checkdata(cf_data,'cmbrepresentation','sparse'); % remove redundancy in channelcomb cf_data = ft_checkdata(cf_data,'cmbrepresentation','sparsewithpow'); % restore power data % data is now ready to be fed into sourceanalysis % Source analysis % Compute common spatial filter cfg = []; cfg.method = 'dics'; cfg.grid = sourceModelGrid; cfg.vol = sourceModelVol; cfg.frequency = foi; cfg.keeptrials = 'yes'; cfg.(cfg.method).keepfilter = 'yes'; cfg.(cfg.method).fixedori = 'yes'; cfg.(cfg.method).realfilter = 'yes'; cfg.(cfg.method).lambda = '5%'; sf_data = ft_sourceanalysis(cfg, cf_data); % s = source cfg = []; cfg.method = 'pcc'; cfg.grid = sourceModelGrid; cfg.grid.filter = sf_data.avg.filter; cfg.vol = sourceModelVol; cfg.frequency = foi; cfg.keeptrials = 'yes'; cfg.(cfg.method).keepmom = 'yes'; % error is produced here: sf_data2 = ft_sourceanalysis(cfg, f_data);
Alexander Backus - 2013-08-20 11:47:01 +0200
Created attachment 507 source model + 4 preprocessed trials of data (bug in comment #3)
Alexander Backus - 2013-09-26 16:49:35 +0200
(In reply to comment #5) Beamforming single trials with precomputed filter. In beamformer_pcc.m, line 88: if isfield(dip, 'filter') needleadfield = 0; ...gives an error later on when describing the outputs, ~line 250: scandiplabel = repmat({'scandip'}, 1, size(lf, 2)); ...since variable lf is undefined. Easy to fix at line 181 or at the describing output stage.
Jan-Mathijs Schoffelen - 2013-09-26 16:50:52 +0200
I remember that I started looking at this already. Apparently, I did not fix it. Sorry. Will look into it soon.