Back to the main page.
Bug 2652 - ft_prepare_layout is not keeping provenance correctly
Status | CLOSED FIXED |
Reported | 2014-07-16 15:35:00 +0200 |
Modified | 2019-08-10 12:43:45 +0200 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P5 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Robert Oostenveld - 2014-07-16 15:35:13 +0200
Created attachment 653 screen shot of ft_analysispipeline if you do this ---- %% part 1, prepare some data cfg = []; cfg.layout = 'elec1020'; layout = ft_prepare_layout(cfg); data = []; data.label = layout.label; data.trial = {}; for i=1:10 data.time{i} = 1:1000; data.trial{i} = randn(length(data.label), 1000); end %% part 2, show the issue cfg = []; cfg.method = 'pca'; cfg.numcomponent = 5; comp = ft_componentanalysis(cfg, data); cfg = [] cfg.layout = 'elec1020'; cfg.component = 1 cfg = {cfg} tic; cfg{end+1} = ft_topoplotIC(cfg{end}, comp); toc; tmp = cfg{end}; details = whos('tmp') tic; cfg{end+1} = ft_topoplotIC(cfg{end}, comp); toc; tmp = cfg{end}; details = whos('tmp') tic; cfg{end+1} = ft_topoplotIC(cfg{end}, comp); toc; tmp = cfg{end}; details = whos('tmp') tic; cfg{end+1} = ft_topoplotIC(cfg{end}, comp); toc; tmp = cfg{end}; details = whos('tmp') tic; cfg{end+1} = ft_topoplotIC(cfg{end}, comp); toc; tmp = cfg{end}; details = whos('tmp') ---- you can see that the cfg is increasing in size. This is due to cfg.layout.cfg.layout.cfg... nesting. It also messes up the figure from ft_analysispipeline([], cfg{end})
Robert Oostenveld - 2014-07-16 15:38:53 +0200
the specific input/output call structure of ft_prepare_layout is also being used elsewhere: mac011> grep function.*,\ cfg.*\( *.m ft_prepare_bemmodel.m:function [vol, cfg] = ft_prepare_bemmodel(cfg, mri) ft_prepare_concentricspheres.m:function [vol, cfg] = ft_prepare_concentricspheres(cfg) ft_prepare_headmodel.m:function [vol, cfg] = ft_prepare_headmodel(cfg, data) ft_prepare_layout.m:function [layout, cfg] = ft_prepare_layout(cfg, data) ft_prepare_leadfield.m:function [grid, cfg] = ft_prepare_leadfield(cfg, data) ft_prepare_localspheres.m:function [vol, cfg] = ft_prepare_localspheres(cfg, mri) ft_prepare_mesh.m:function [bnd, cfg] = ft_prepare_mesh(cfg, mri) ft_prepare_neighbours.m:function [neighbours, cfg] = ft_prepare_neighbours(cfg, data) ft_prepare_singleshell.m:function [vol, cfg] = ft_prepare_singleshell(cfg, mri) ft_prepare_sourcemodel.m:function [grid, cfg] = ft_prepare_sourcemodel(cfg, vol, sens) ft_sourcestatistics.m:function [dat, cfg] = getfunctional(cfg, varargin) ft_statistics_analytic.m:function [stat, cfg] = ft_statistics_analytic(cfg, dat, design) ft_statistics_montecarlo.m:function [stat, cfg] = ft_statistics_montecarlo(cfg, dat, design, varargin) ft_statistics_stats.m:function [stat, cfg] = ft_statistics_stats(cfg, dat, design) That means that the same problem potentially happens in these as well.
Robert Oostenveld - 2014-07-16 15:41:19 +0200
(In reply to Robert Oostenveld from comment #1) yup, this also has it cfg = []; cfg.grid.pos = randn(100,3); cfg.grid = ft_prepare_sourcemodel(cfg) cfg.grid = ft_prepare_sourcemodel(cfg) cfg.grid = ft_prepare_sourcemodel(cfg) cfg.grid = ft_prepare_sourcemodel(cfg) and then ft_analysispipeline([], cfg)
Robert Oostenveld - 2014-07-16 15:57:35 +0200
I tried this tmpcfg = keepfields(cfg, {'rotate', 'style', 'projection', 'layout', 'grad', 'elec', 'gradfile', 'elecfile', 'output', 'feedback', 'montage', 'image', 'mesh', 'bw', 'channel', 'skipscale', 'skipcomnt', 'overlap'}); layout = ft_prepare_layout(tmpcfg, comp); [cfg] = rollback_provenance(cfg, layout); cfg.layout = layout; but it did not help. There is something conceptually wrong...
Jan-Mathijs Schoffelen - 2019-03-28 10:35:31 +0100
Did you by any chance happen to address this one along the way?
Robert Oostenveld - 2019-03-28 11:02:50 +0100
(In reply to Jan-Mathijs Schoffelen from comment #4) hmm, eentje uit de oude doos. I did not look into this specifically, but I will check it out with the tutorial on the iEEG layout. The combination of freq data with multiple layouts and ft_appendlayout should result in an interesting provenance tree.
Robert Oostenveld - 2019-03-28 12:04:03 +0100
Created attachment 883 screenshot It now works like a charm, see attached screenshot.
Jan-Mathijs Schoffelen - 2019-03-28 12:05:13 +0100
Schouderklopje verdiend! Aan jou de eer om deze weer te sluiten dacht ik zo.
Robert Oostenveld - 2019-03-28 12:39:21 +0100
commit ad58d6f8e92d1331313b4bb8c74d7cff39b77793 (HEAD -> bug2652, origin/bug2652) Author: Robert Oostenveld Date: Thu Mar 28 12:38:15 2019 +0100 ENH - add cfg.renderer and figure title consistently commit 0483314279b5b48117ec019bb46e851f1f571286 Author: Robert Oostenveld Date: Thu Mar 28 11:59:35 2019 +0100 ENH - implemented the FieldTrip menu item for the figures in a consistent manner and added it to all plotting functions
Robert Oostenveld - 2019-03-28 13:55:01 +0100
https://github.com/fieldtrip/fieldtrip/pull/1053 includes some improvements that relate to the plotting, fieldtrip menu and pipeline figure.