[FieldTrip] issue with FieldTrip-SimBio pipeline for EEG FEM forward solution

Johannes Vorwerk j.vorw01 at gmail.com
Fri Feb 22 14:39:21 CET 2019


Dear Pierre,

I am glad it works now. Regarding the call to ft_prepare_sourcemodel I agree with you that this is repetitive at this position. I think you could actually just skip the first call and directly include the definition of the sources in the cfg for the call to ft_prepare_leadfield. I do not think another check is necessary here, since the computation times for ft_prepare_sourcemodel are usually pretty short.

Thanks for your correction regarding the parallelization. Indeed, the command „clear vecb“ also needs to be replaced/removed (since vecb is zeroed in l 38 and is only defined inside the loop), I oversaw that when looking up the parallelized version of sb_transfer.m I am using. I haven’t made any tests to parallelize ft_compute_leadfield, your approach sounds promising though.

Best,
	Johannes

> Am 22.02.2019 um 13:37 schrieb Pierre Bastien Megevand <Pierre.Megevand at unige.ch>:
> 
> Dear Johannes, thank you for your answer. My bad--I was not using an up-to-date version of FieldTrip. Indeed, now that I have updated the code, the transfer matrix is not computed again by ft_prepare_leadfield. I think that a similar check might be necessary for the call to ft_prepare_sourcemodel (line 178 of ft_prepare_leadfield), since the FieldTrip-SimBio pipeline also calls that function explicitly beforehand.
> 
> In order to parallelize the transfer matrix computation, in sb_transfer, I suggest that the code at line 41, which currently reads "clear vecb;", be replaced by "vecb=[];", because there is a transparency issue when using "clear" within a parfor loop (see https://ch.mathworks.com/help/distcomp/transparency.html <https://ch.mathworks.com/help/distcomp/transparency.html>).
> 
> I have also been trying to parallelize ft_prepare_leadfield. Given that ft_compute_leadfield is called once per grid point, I replaced the for loop at line 301 of ft_prepare_leadfield with a parfor loop. The indexing of grid.leadfield{thisindx} poses a "sliced variable" problem to MATLAB though. The workaround I used was to create a temporary variable, grid_leadfield, and to index it with {i} instead of {thisindx}. At the end of the loop, the "grid.leadfield(insideindx)=grid_leadfield;" line reestablishes that variable. I am currently testing this.
> 
> Pierre
> 
> 
> 
> De : fieldtrip <fieldtrip-bounces at science.ru.nl <mailto:fieldtrip-bounces at science.ru.nl>> de la part de fieldtrip-request at science.ru.nl <mailto:fieldtrip-request at science.ru.nl> <fieldtrip-request at science.ru.nl <mailto:fieldtrip-request at science.ru.nl>>
> Envoyé : vendredi, 22 février 2019 12:00
> À : fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>
> Objet : fieldtrip Digest, Vol 99, Issue 22
>  
> Send fieldtrip mailing list submissions to
>         fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
> or, via email, send a message with subject or body 'help' to
>         fieldtrip-request at science.ru.nl <mailto:fieldtrip-request at science.ru.nl>
> 
> You can reach the person managing the list at
>         fieldtrip-owner at science.ru.nl <mailto:fieldtrip-owner at science.ru.nl>
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fieldtrip digest..."
> 
> 
> Today's Topics:
> 
>    1. Postdoc opportunity (up to 4 years), Obleser lab, Lübeck
>       (GER) (Jonas Obleser)
>    2. Re: Error in source localisation statistics
>       (Schoffelen, J.M. (Jan Mathijs))
>    3. issue with FieldTrip-SimBio pipeline for EEG FEM forward
>       solution (Pierre Bastien Megevand)
>    4. Parcellate the reconstructed source time series (Neeraj kumar)
>    5. Re: issue with FieldTrip-SimBio pipeline for EEG FEM forward
>       solution (Johannes)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 21 Feb 2019 14:46:54 +0100
> From: Jonas Obleser <jonas at obleser.de <mailto:jonas at obleser.de>>
> To: fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>
> Subject: [FieldTrip] Postdoc opportunity (up to 4 years), Obleser lab,
>         Lübeck (GER)
> Message-ID: <0866A3D2-FD30-421C-A138-B34E45CE7704 at obleser.de <mailto:0866A3D2-FD30-421C-A138-B34E45CE7704 at obleser.de>>
> Content-Type: text/plain; charset="utf-8"
> 
> Dear colleagues, 
> 
> sorry for any crossposting:
> I am hiring a Postdoc to do some exciting Cogn Neuro with my lab and me near the baltic sea in the years to come.
> 
> This post is not grant-based, so more-than-usual freedom, topicwise, but some modest teaching involvement. Application deadline March 15, starting date any time, full German contract up to 4 years.
> 
> If interested/in doubt, please talk to me. Contact details below.
> Thanks for spreading the news, 
> Jonas
> 
> obleserlab.com <http://obleserlab.com/> <http://obleserlab.com/ <http://obleserlab.com/>>
> uni-luebeck.de <http://uni-luebeck.de/> <http://uni-luebeck.de/ <http://uni-luebeck.de/>> 
> 
> Job ad in English:
> https://auditorycognition.com/docs/Postdoc-Obleserlab-March2019.pdf <https://auditorycognition.com/docs/Postdoc-Obleserlab-March2019.pdf> <https://auditorycognition.com/docs/Postdoc-Obleserlab-March2019.pdf <https://auditorycognition.com/docs/Postdoc-Obleserlab-March2019.pdf>> 
> 
> Job ad in German:
> https://www.academics.de/jobs/wissenschaftlicher-mitarbeiter-post-doc-m-w-d-am-institut-fuer-psychologie-universitaet-zu-luebeck-luebeck-1004361?user_token=SFMyNTY.g3QAAAACZAAEZGF0YWIAAG6AZAAGc2lnbmVkbgYAt8Q1EGkB.yJa3d_6Otl3R_0t0GvEOLq-etYWIp13xoZ4MDhwN5m0&utm_campaign=jobnewsletter&utm_medium=nl&utm_source=2019-02-21&wt_zmc=nl.int.aca.jobnewsletter.2019-02-21.acade.textlink.stellenanzeige_supertreffer.job <https://www.academics.de/jobs/wissenschaftlicher-mitarbeiter-post-doc-m-w-d-am-institut-fuer-psychologie-universitaet-zu-luebeck-luebeck-1004361?user_token=SFMyNTY.g3QAAAACZAAEZGF0YWIAAG6AZAAGc2lnbmVkbgYAt8Q1EGkB.yJa3d_6Otl3R_0t0GvEOLq-etYWIp13xoZ4MDhwN5m0&utm_campaign=jobnewsletter&utm_medium=nl&utm_source=2019-02-21&wt_zmc=nl.int.aca.jobnewsletter.2019-02-21.acade.textlink.stellenanzeige_supertreffer.job> <https://www.academics.de/jobs/wissenschaftlicher-mitarbeiter-post-doc-m-w-d-am-institut-fuer-psychologie-universitaet-zu-luebeck-luebeck-1004361?user_token=SFMyNTY.g3QAAAACZAAEZGF0YWIAAG6AZAAGc2lnbmVkbgYAt8Q1EGkB.yJa3d_6Otl3R_0t0GvEOLq-etYWIp13xoZ4MDhwN5m0&utm_campaign=jobnewsletter&utm_medium=nl&utm_source=2019-02-21&wt_zmc=nl.int.aca.jobnewsletter.2019-02-21.acade.textlink.stellenanzeige_supertreffer.job <https://www.academics.de/jobs/wissenschaftlicher-mitarbeiter-post-doc-m-w-d-am-institut-fuer-psychologie-universitaet-zu-luebeck-luebeck-1004361?user_token=SFMyNTY.g3QAAAACZAAEZGF0YWIAAG6AZAAGc2lnbmVkbgYAt8Q1EGkB.yJa3d_6Otl3R_0t0GvEOLq-etYWIp13xoZ4MDhwN5m0&utm_campaign=jobnewsletter&utm_medium=nl&utm_source=2019-02-21&wt_zmc=nl.int.aca.jobnewsletter.2019-02-21.acade.textlink.stellenanzeige_supertreffer.job>> 
> 
> 
> Jonas Obleser
> Professor
> Chair in Physiological Psychology and Research Methods
> 
> University of Lübeck
> Department of Psychology
> MFC 8, Maria-Goeppert-Straße 9a
> 23562 Lübeck, Germany
> 
> Phone +49 (0)451 3101 3620 <tel:+49%20451%203101%203620>
> Mobile +49 (0)171 6993337 <tel:+49%20171%206993337>
> jonas.obleser at uni-luebeck.de <mailto:jonas.obleser at uni-luebeck.de>
> http://jonasobleser.com <http://jonasobleser.com/>
> 
> ---Schedule a meeting with me? https://calendly.com/jonasobleser <https://calendly.com/jonasobleser> ---
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190221/b1e2be54/attachment.html <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190221/b1e2be54/attachment.html>>
> 
> ------------------------------
> 
> Message: 2
> Date: Thu, 21 Feb 2019 15:10:18 +0000
> From: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl <mailto:jan.schoffelen at donders.ru.nl>>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>>
> Subject: Re: [FieldTrip] Error in source localisation statistics
> Message-ID: <21612B35-BED5-4A31-8206-CAC578C72109 at donders.ru.nl <mailto:21612B35-BED5-4A31-8206-CAC578C72109 at donders.ru.nl>>
> Content-Type: text/plain; charset="utf-8"
> 
> Hi Xavier,
> 
> I see. Unfortunately you happened to end up in a corner of the code that is a bit shaky, and possibly not well tested (although once upon a time it may have worked). This may be due to the fact that you are trying to ‘fool’ fieldtrip into treating a multiple subject design as if it’s a single subject design with multiple trials (where each of the trials represents a single condition estimate for a subject), correct? (as a side note: you would want to use ‘depsamplesT’ rather than ‘indepsamplesT’ as your test statistic).
> 
> I think that you should not do this. First, as you have noticed this leads to downstream problems (specifically handcrafting combined data could easily lead to a user-error causing the data to deviate according to what FieldTrip can handle, but also using the cfg.rawtrial option of ft_sourceanalaysis historically and notoriously is a dysfunctional (or at least unpredictable in its behavior) option. (nominated to be removed once we find the time). Next to this, even though it seems your geometrical data (i.e. electrode positions, headmodel, sourcemodel) are shared across subjects, the covariance structure of the data will for sure be subject-specific, and I don’t think that it is a good idea to combine data across subjects before sourceanalysis.
> 
> This is what I would do:
> 
> for each subject do:
> 
> ft_timelockanalysis with the subject-specific data combined across conditions
> ft_timelockanalysis with the subject-specific data for each of the conditions separately
> 
> ft_sourceanalysis with the subject-specific data combined across conditions AND cfg.lcmv.keepfilter = ‘yes’; (and don’t specify cfg.keeptrials or cfg.rawtrial)
> 
> input the source.avg.filter from the previous step into the cfg
> 
> for each condition (in each subject) do:
>   ft_sourceanalysis
> 
> 
> after this you should have a set of Nsubject times number of conditions source structures
> 
> then you should be able to use ft_sourcestatistics with cfg.statisti = ‘depsamplesT’:
> 
> ft_sourcestatistics(cfg, source{:}); % if in the previous for-loop you have stored the individual source-objects into a cell-array this syntax works (and is much cleaner than either ft_sourcestatistics(cfg, source1a, source2a ,…etc), and cleaner than going through ft_sourcegrandaverage).
> 
> ft_sourcedescriptives should not be needed in this recipe.
> 
> Good luck,
> Jan-Mathijs
> 
> 
> J.M.Schoffelen, MD PhD
> Senior Researcher, VIDI-fellow - PI, language in interaction
> Telephone: +31-24-3614793 <tel:+31-24-3614793>
> Physical location: room 00.028
> Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands
> 
> 
> 
> On 20 Feb 2019, at 21:32, Xavier Vrijdag <x.vrijdag at auckland.ac.nz <mailto:x.vrijdag at auckland.ac.nz><mailto:x.vrijdag at auckland.ac.nz <mailto:x.vrijdag at auckland.ac.nz>>> wrote:
> 
> Hi Jan-Mathijs,
> 
> Thank you for your help. I went in to have a look at what is going on inside those loops and found that the error is occurring in iteration 6, when the field source.trial(1).label is concatenated. It uses the indexes for the big data cells (ori, mom & filter) which clearly doesn’t work on the small cell with the labels. This seems to me that this is a bug.
> 
> I added a piece of code in front of the loop that was giving the error (before line 177 and make the if and elseif.
>       if isequal(fn{i}, 'label')
>             for j=1:nrpt
>                     source_new.label(:,j) = source.trial(j).label;
>             end
>       elseif iscell(dat)
> 
> This worked to circumvent the problem. However, I do get the warning that the dimord of “ori” and “df” could not be determined. When using this cleaned source struct in source statistics I get further errors.
> 
> It looks like an issue with how the source struct is built by the source analysis function with trials, and lateron needs to be restructured. SO I would like to know what is the needed structure for ft_sourcestatistics, so we can adjust the code correctly.
> 
> Regards,
> 
> Xavier
> 
> 
> From: fieldtrip <fieldtrip-bounces at science.ru.nl <mailto:fieldtrip-bounces at science.ru.nl><mailto:fieldtrip-bounces at science.ru.nl <mailto:fieldtrip-bounces at science.ru.nl>>> on behalf of "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl <mailto:jan.schoffelen at donders.ru.nl><mailto:jan.schoffelen at donders.ru.nl <mailto:jan.schoffelen at donders.ru.nl>>>
> Reply-To: FieldTrip discussion list <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl><mailto:fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>>>
> Date: Wednesday, 20 February 2019 at 2:59 AM
> To: FieldTrip discussion list <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl><mailto:fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>>>
> Subject: Re: [FieldTrip] Error in source localisation statistics
> 
> Hi Xavier,
> 
> My recommendation here would be to use the matlab debugger and inspect the cause of the error. The ‘Index exceeds array bounds’ is quite a clear error message, and suggests that there is a mismatch between the number of elements in dat/val, and the numbers represented in indx(k).
> 
> Good luck,
> 
> Jan-Mathijs
> 
> 
> On 18 Feb 2019, at 07:23, Xavier Vrijdag <x.vrijdag at auckland.ac.nz <mailto:x.vrijdag at auckland.ac.nz><mailto:x.vrijdag at auckland.ac.nz <mailto:x.vrijdag at auckland.ac.nz>>> wrote:
> 
> Hello,
> 
> I have a dataset from an experiment where 12 participants were exposed to 3 levels of nitrous oxide, while I measured their EEG. I also have a baseline recording. I took for each exposure (and baseline) a 1 minute sample for further analysis. I want to do source localization to better understand  which parts of the brain are involved. I don’t have MRI scans of my participants, so I used the standard MRI and BEM. I would like to thanks the persons who made the various manuals and analysis examples on the website, as they helped me tremendously to do this analysis.
> 
> After cleaning and preprocessing, I combined the datasets into one for further analysis. I also chose to make 5 sec “trials” for further analysis. For this source analysis I loaded the data of 1 exposure and the baseline data, to compare them.
> 
>         %Calculate the channel covariance matric
>         cfg = [];
>         cfg.covariance = 'yes';
>         cfg.covariancewindow = 'all';
>         cfg.keeptrials  = 'yes';
>         timelock = ft_timelockanalysis(cfg, data_filt);
> 
>         %Global filter
>         cfg = [];
>         cfg.headmodel = vol;
>         cfg.elec = elec_aligned;
>         cfg.grid = grid;
>         cfg.method = 'lcmv';
>         cfg.lcmv.projectnoise='yes'; %needed for neural activity index
>         cfg.lcmv.fixedori = 'yes';  %Project onto largest variance orientation
>         cfg.lcmv.keepfilter = 'yes'; %Keep the beamformer weights
>         cfg.lcmv.lambda = '5%'; %Regularise a little
>         cfg.rawtrial    = 'yes';      % project each single trial through the filter.
>         cfg.keeptrials  = 'yes';
>         source = ft_sourceanalysis(cfg, timelock);
> 
>         cfg = [];
>         cfg.dim         = source.dim;
>         cfg.method      = 'montecarlo';
>         cfg.statistic   = 'ft_statfun_indepsamplesT';
>         cfg.parameter   = 'pow';
>         cfg.correctm    = 'cluster';
>         cfg.numrandomization = 1000;
>         cfg.alpha       = 0.05; % note that this only implies single-sided testing
>         cfg.tail        = 0;
>         cfg.design(1,:) = [1:nTrials 1:nTrials];
>         cfg.design(2,:) = [ones(1,nTrials) ones(1,nTrials).*2];
>         cfg.uvar        = 1; % row of design matrix that contains unit variable (in this case: trials)
>         cfg.ivar        = 2; % row of design matrix that contains independent variable (the conditions)
>         stat = ft_sourcestatistics(cfg, source);
> 
> After the source analysis the source statistics script calls the checkdata script and I get the following error:
> 
> Index exceeds array bounds.
> 
> Error in ft_datatype_source (line 183)
>             val{indx(k)}(1,:,:,:) = dat{indx(k)};
> 
> Error in ft_checkdata (line 278)
>   data = ft_datatype_source(data);
> 
> Error in ft_sourcestatistics (line 94)
>   varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'source', 'feedback', 'no');
> 
> Error in sourcelocalisation_N2O (line 114)
>         stat = ft_sourcestatistics(cfg, source);
> 
> The source struct has the following content:
>       time: [1×15360 double]
>        dim: [24 31 25]
>     inside: [18600×1 logical]
>        pos: [18600×3 double]
>     method: 'rawtrial'
>      trial: [1×24 struct]
>         df: 24
>        cfg: [1×1 struct]
> 
> With source.trial:
>   1×24 struct array with fields:
>     ori
>     pow
>     mom
>     noise
>     filter
>     label
>     filterdimord
> 
> I would like your help to understand the error and how to fix it.
> 
> Regards,
> 
> Xavier Vrijdag
> 
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
> https://doi.org/10.1371/journal.pcbi.1002202 <https://doi.org/10.1371/journal.pcbi.1002202>
> 
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
> https://doi.org/10.1371/journal.pcbi.1002202 <https://doi.org/10.1371/journal.pcbi.1002202>
> 
> 
> 
> 
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190221/f14fa3db/attachment.html <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190221/f14fa3db/attachment.html>>
> 
> ------------------------------
> 
> Message: 3
> Date: Thu, 21 Feb 2019 16:16:47 +0000
> From: Pierre Bastien Megevand <Pierre.Megevand at unige.ch <mailto:Pierre.Megevand at unige.ch>>
> To: "fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>" <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>>
> Subject: [FieldTrip] issue with FieldTrip-SimBio pipeline for EEG FEM
>         forward solution
> Message-ID: <617c8035ce184327b4ed18a9caa3a033 at unige.ch <mailto:617c8035ce184327b4ed18a9caa3a033 at unige.ch>>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Dear all,
> 
> 
> I think I have found an inconsistency in the way Fieldtrip handles the building of a FEM forward solution. I am following the procedure described in Vorwerk, Oostenveld et al., The FieldTrip-SimBio pipeline for EEG forward solutions. Biomed Eng Online. 2018 (https://biomedical-engineering-online.biomedcentral.com/articles/10.1186/s12938-018-0463-y <https://biomedical-engineering-online.biomedcentral.com/articles/10.1186/s12938-018-0463-y>). This procedure suggests to build the forward solution by calling the following Fieldtrip functions:
> 
> ft_read_mri
> 
> ft_volumerealign
> 
> ft_volumereslice
> 
> ft_volumesegment
> 
> ft_prepare_mesh
> 
> ft_prepare_headmodel
> 
>     ft_read_header (to get electrode data)
> 
>     ft_electroderealign
> 
> ft_prepare_vol_sens
> 
> ft_prepare_sourcemodel
> 
> ft_prepare_leadfield
> 
> 
> My issue is the following: the FieldTrip-SimBio pipeline explicitly calls ft_prepare_vol_sens, which takes very long to execute (over 6 hours in the case of the published paper, which used about 80 electrodes). However, ft_prepare_leadfield later calls (line 165) prepare_headmodel, which itself calls (line 113) ft_prepare_vol_sens again, with the same parameters as far as I can tell (and again taking ages to run).
> 
> 
> Is this redundancy intended? If not, can it be circumvented?
> 
> 
> Thank you in advance,
> 
> 
> Pierre
> 
> 
> Pierre Mégevand, MD, PhD
> Senior research associate, Dept. of basic neurosciences
> Faculty of medicine, University of Geneva, Switzerland
> T. +41 76 693 65 22 <tel:+41%2076%20693%2065%2022> | pierre.megevand at unige.ch <mailto:pierre.megevand at unige.ch>
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190221/25fb3525/attachment.html <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190221/25fb3525/attachment.html>>
> 
> ------------------------------
> 
> Message: 4
> Date: Fri, 22 Feb 2019 15:44:42 +0530
> From: Neeraj kumar <neeraj750kumar at gmail.com <mailto:neeraj750kumar at gmail.com>>
> To: fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>
> Subject: [FieldTrip] Parcellate the reconstructed source time series
> Message-ID:
>         <CA+pWvbqu5QoCWvoiEy1xjB8bQa9hFWBMJ3657G6C59JSO7y6VA at mail.gmail.com <mailto:CA+pWvbqu5QoCWvoiEy1xjB8bQa9hFWBMJ3657G6C59JSO7y6VA at mail.gmail.com>>
> Content-Type: text/plain; charset="utf-8"
> 
> Hello all,
> 
> I want to parcellate the reconstructed source time series (~ 1000ms).
> I have moments in source.avg.mom for around 6000 grids.
> Additionally, do I need to perform some normalization on time series before
> or after parcellation to perform network analysis?
> 
> Thanks in advance.
> 
> Neeraj Kumar,
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190222/5cfcf663/attachment.html <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190222/5cfcf663/attachment.html>>
> 
> ------------------------------
> 
> Message: 5
> Date: Fri, 22 Feb 2019 11:40:28 +0100
> From: Johannes <j.vorw01 at gmail.com <mailto:j.vorw01 at gmail.com>>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>>
> Subject: Re: [FieldTrip] issue with FieldTrip-SimBio pipeline for EEG
>         FEM forward solution
> Message-ID:
>         <CAMtnjmVNo7PDn062vPAzg14LGmgOXGsBdW5+QxN5cXSt4cOFFw at mail.gmail.com <mailto:CAMtnjmVNo7PDn062vPAzg14LGmgOXGsBdW5+QxN5cXSt4cOFFw at mail.gmail.com>>
> Content-Type: text/plain; charset="utf-8"
> 
> Dear Pierre,
> 
> if you are running a recent version of FieldTrip (newer than Dec 15, 2018),
> there should be a check included in ft_prepare_vol_sens to avoid this
> behavior, i.e., if a transfer matrix is detected in the vol-struct provided
> to ft_prepare_vol_sens, it is checked if whether this fits to the indicated
> sensor configuration and if this is the case no new transfer matrix is
> computed. This should also work if a subset of sensors is selected. Thus,
> it would be great, if you could check whether this behavior remains when
> using a recent checkout of FieldTrip.
> 
> Regarding the time requirement for computing the transfer matrix - the
> calculation in sb_transfer can be easily parallelized by replacing l 35 in
> sb_transfer with a parfor loop, e.g., parfor(i=2:length(vol.elecnodes),8),
> if you want to compute on 8 cores.
> 
> I hope this answer is helpful to you!
> 
> Best,
>     Johannes
> 
> Am Do., 21. Feb. 2019 um 17:17 Uhr schrieb Pierre Bastien Megevand <
> Pierre.Megevand at unige.ch <mailto:Pierre.Megevand at unige.ch>>:
> 
> > Dear all,
> >
> >
> > I think I have found an inconsistency in the way Fieldtrip handles the
> > building of a FEM forward solution. I am following the procedure
> > described in Vorwerk, Oostenveld et al., The FieldTrip-SimBio pipeline
> > for EEG forward solutions. Biomed Eng Online. 2018 (
> > https://biomedical-engineering-online.biomedcentral.com/articles/10.1186/s12938-018-0463-y <https://biomedical-engineering-online.biomedcentral.com/articles/10.1186/s12938-018-0463-y>).
> > This procedure suggests to build the forward solution by calling the
> > following Fieldtrip functions:
> >
> > ft_read_mri
> >
> > ft_volumerealign
> >
> > ft_volumereslice
> >
> > ft_volumesegment
> >
> > ft_prepare_mesh
> >
> > ft_prepare_headmodel
> >
> >     ft_read_header (to get electrode data)
> >
> >     ft_electroderealign
> >
> > ft_prepare_vol_sens
> >
> > ft_prepare_sourcemodel
> >
> > ft_prepare_leadfield
> >
> >
> > My issue is the following: the FieldTrip-SimBio pipeline explicitly calls
> > ft_prepare_vol_sens, which takes very long to execute (over 6 hours in the
> > case of the published paper, which used about 80 electrodes). However,
> > ft_prepare_leadfield later calls (line 165) prepare_headmodel, which
> > itself calls (line 113) ft_prepare_vol_sens again, with the same
> > parameters as far as I can tell (and again taking ages to run).
> >
> >
> > Is this redundancy intended? If not, can it be circumvented?
> >
> >
> > Thank you in advance,
> >
> >
> > Pierre
> >
> >
> > Pierre Mégevand, MD, PhD
> > Senior research associate, Dept. of basic neurosciences
> > Faculty of medicine, University of Geneva, Switzerland
> > T. +41 76 693 65 22 <tel:+41%2076%20693%2065%2022> | pierre.megevand at unige.ch <mailto:pierre.megevand at unige.ch>
> >
> > _______________________________________________
> > fieldtrip mailing list
> > https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
> > https://doi.org/10.1371/journal.pcbi.1002202 <https://doi.org/10.1371/journal.pcbi.1002202>
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190222/bfbf8d29/attachment.html <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190222/bfbf8d29/attachment.html>>
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
> https://doi.org/10.1371/journal.pcbi.1002202 <https://doi.org/10.1371/journal.pcbi.1002202>
> 
> 
> ------------------------------
> 
> End of fieldtrip Digest, Vol 99, Issue 22
> *****************************************
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
> https://doi.org/10.1371/journal.pcbi.1002202 <https://doi.org/10.1371/journal.pcbi.1002202>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190222/93d30573/attachment-0002.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list