Back to the main page.

Bug 2264 - ft_sourceinterpolate does not work on mne method

Status CLOSED WONTFIX
Reported 2013-08-23 14:26:00 +0200
Modified 2013-10-26 18:12:09 +0200
Product: FieldTrip
Component: inverse
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Behnam - 2013-08-23 14:26:26 +0200

Hi Performing ft_sourceanalysis by mne method and passing the results to ft_sourceinterpolate crashes. Indeed, ft_sourceinterpolate is not addapted with time-dependent functional maps (such as those generated by mne method). Best, Behnam M. A.


Behnam - 2013-08-23 14:57:31 +0200

Here is the code which crashes at : source = ft_sourceinterpolate(cfg, source , mri); ---------- load('E:\InstalledMatlabTools\FieldTrip\fieldtrip-20130818\template\headmodel\standard_bem.mat') % loads 'vol' load('E:\InstalledMatlabTools\FieldTrip\fieldtrip-20130818\template\headmodel\standard_mri.mat'); %loads 'mri' CMMM = 'cm'; ; scale=1; vol = ft_convert_units(vol, CMMM); % Convert the vol to cm, or mm close all % construct the dipole grid in the template brain coordinates % the source units are in cm % the negative inwardshift means an outward shift of the brain surface for inside/outside detection cfg = []; cfg.grid.xgrid = scale*[-20:1:20]; cfg.grid.ygrid = scale*[-20:1:20]; cfg.grid.zgrid = scale*[-20:1:20]; cfg.grid.unit = CMMM; cfg.grid.tight = 'yes'; cfg.inwardshift = -scale*0; cfg.vol = vol; template_grid = ft_prepare_sourcemodel(cfg); %%% make a figure with the template head model and dipole grid figure hold on ft_plot_vol(vol, 'facecolor', 'cortex', 'edgecolor', 'none');alpha 0.5; camlight; ft_plot_mesh(template_grid.pos(template_grid.inside,:)); elecs = ft_read_sens('E:\InstalledMatlabTools\FieldTrip\fieldtrip-20130818\template\electrode\standard_1020.elc'); elecs = ft_convert_units(elecs, CMMM); [vol, elecs] = ft_prepare_vol_sens(vol, elecs) ft_plot_mesh(elecs.elecpos,'vertexcolor',[1 .3 .3]); data = []; cfg.grid = template_grid; cfg.vol = vol; cfg.elec = elecs; cfg.unit = CMMM; [grid] = ft_prepare_leadfield(cfg, data); grid = ft_convert_units(grid, CMMM); %% does not really work %%% Dipole simulation % note that beamformer scanning will be done with a 1cm grid, so you should % not put the dipole on a position that will not be covered by a grid % location later cfg = []; cfg.vol = vol; cfg.elec = elecs; cfg.dip.pos = scale*[ 3 -3 6 % dipole 1 ]; cfg.dip.mom = [ 1 0 0 ]'; cfg.dip.frequency = [10]*1; cfg.dip.phase=pi/4*[1]; cfg.dip.amplitude=[10]; cfg.relnoise = .1; cfg.ntrials = 20; data = ft_dipolesimulation(cfg); % compute the data covariance matrix, which will capture the activity of % the simulated dipole cfg = []; cfg.covariance = 'yes'; cfg.covariancewindow = [data.time{1}(1) data.time{1}(end)]; timelock = ft_timelockanalysis(cfg, data); %%% source analysis cfg = []; METHOD = 'mne'; cfg.method = METHOD; cfg.grid = grid; cfg.vol = vol; cfg.elec = elecs; cfg.snr = 10; source = ft_sourceanalysis(cfg, timelock); cfg = []; cfg.downsample = 2; cfg.parameter = 'avg.pow'; source = ft_sourceinterpolate(cfg, source , mri); %Note: this function crashes if mne method is used cfg = []; cfg.funparameter = 'avg.pow'; cfg.method = 'ortho'; ft_sourceplot(cfg, source);


Jan-Mathijs Schoffelen - 2013-10-09 16:10:18 +0200

This is a known feature of the function, to protect the user against him/herself. The reason being that it will probably blow up your RAM if you want to go from a ~10000 dipole positions x 200 time points matrix to a 256^3 dipole positions x 200 time point matrix. I suggest that you design an appropriate warning message to point the user to this, and tell me where I have to insert it into the function.


Jan-Mathijs Schoffelen - 2013-10-26 18:12:09 +0200

Since my suggestion to create an appropriate warning has not been followed up by the reported, I am closing this bug. @Benham: if you still are willing to contribute, which is greatly appreciated, feel free to reopen this bug and give the input we asked for. Thanks, on behalf of the FT-team.