[FieldTrip] Fwd: head motion regression with ft_regressconfound on a continuous MEG data

Stolk, A. (Arjen) a.stolk at fcdonders.ru.nl
Mon Dec 9 20:09:37 CET 2013


Dear Inna, The output you get is as one would expect. Could you try and spot any principal differences between the timelock structure you have and the one we just simulated? Alternatively, could you send me a reduced/exchangeable timelock structure with say, about 3 trials, for me to replicate your error (<15mb?, by direct email to a.stolk8 at gmail.com)? Yours Arjen ----- Oorspronkelijk bericht -----
> Van: "Inna McGowin" <mcgoiv0 at wfu.edu>
> Aan: "FieldTrip discussion list" <fieldtrip at science.ru.nl>
> Verzonden: Maandag 9 december 2013 19:04:20
> Onderwerp: Re: [FieldTrip] Fwd: head motion regression with
> ft_regressconfound on a continuous MEG data
> Thanks you
> Your code works fine. Here is the Matlab output for this code:
> the input is timelock data with 2 channels and 5 timebins
> removing confound 1 2 3
> keeping confound
> normalizing the confounds, except the constant
> estimating the regression weights and removing the confounds
> updating descriptives
> the input is timelock data with 2 channels and 5 timebins
> Warning: the data does not contain a trial definition
> > In utilities\private\warning_once at 158
> In utilities\private\fixsampleinfo at 66
> In ft_datatype_raw at 154
> In ft_checkdata at 298
> In ft_timelockanalysis at 105
> In ft_regressconfound at 313
> Warning: reconstructing sampleinfo by assuming that the trials are
> consecutive segments of a continuous
> recording
> > In utilities\private\warning_once at 158
> In utilities\private\fixsampleinfo at 79
> In ft_datatype_raw at 154
> In ft_checkdata at 298
> In ft_timelockanalysis at 105
> In ft_regressconfound at 313
> averaging trials
> averaging trial 20 of 20
> the call to "ft_timelockanalysis" took 1 seconds
> the call to "ft_regressconfound" took 4 seconds
> The data I am trying to correct for the motion is real. It was
> collected with a current phantom generating the signal by a dipole.
> The data is continuous but can be broken into trials of 1 sec (the
> dipole generates 7 Hz sinusoidal signal continuously). The phantom was
> mechanically moved during the scan for a precisely known amount (e.g.
> 1 cm down). The data was recorded by CTF 275-sensor MEG unit with the
> continuous head coils localization. I was able to apply the SSS motion
> correction algorithm successfully to this data set. If there is a way
> I could share this data set.
> Thanks,
> Inna
> Inna McGowin
> On Mon, Dec 9, 2013 at 9:48 AM, Arjen Stolk < a.stolk8 at gmail.com >
> wrote:
> > Hi Inna,
> > Testing ft_regressconfound with some fake data, everything seems to
> > be
> > fine here:
> > timelock = [];
> > timelock.label = {'1' '2'};
> > timelock.time = 1:5;
> > timelock.dimord = 'rpt_chan_time';
> > timelock.trial = randn(20,2,5);
> > timelock.avg = randn(2,5);
> > cfg = [];
> > cfg.confound = randn(20,3);
> > cfg.reject = [1:3];
> > timelock_out = ft_regressconfound(cfg, timelock);
> > Does this example code work for you? I could not detect any mistake
> > in
> > your lines of code. What does your 'timelock' structure look like?
> > Are
> > there any real values in the data? (don't think this is causing it,
> > but please update to newest Ft version just to be sure)
> > Yours,
> > Arjen
> > 2013/12/2 McGowin, Inna < mcgoiv0 at wfu.edu >
> > > Thank you Arjen,
> > > Actually, I am testing the FieldTrip motion regression on MEG data
> > > specifically collected with a current phantom and known motion. I
> > > can
> > > treat the data as ERP data and average over 1 sec trials if
> > > needed.
> > > Following your advise on reduction of the regressors number (on
> > > 120
> > > trials of 1 sec long) I was able to avoid the "out of memory"
> > > issue.
> > > Though I run into the different set of problems now that I need
> > > help
> > > to understand:
> > > ______________________________________________
> > > ??? Error using ==> mxSerialize
> > > Error during serialization of (null)
> > > Error in ==> ft_postamble_provenance at 91
> > > cfg.callinfo.outputhash{iargout} = CalcMD5(mxSerialize(tmparg));
> > > Error in ==> ft_postamble at 55
> > > evalin('caller', ['ft_postamble_' cmd]);
> > > Error in ==> ft_timelockanalysis at 370
> > > ft_postamble provenance timelock
> > > Error in ==> ft_regressconfound at 313
> > > dataout = ft_timelockanalysis(tempcfg, dataout);% reaveraging
> > > _________________________________________________________
> > > Here is the code I run to regress the head motion:
> > > %%
> > > addpath C:\Userdata\MATLAB\FieldTrip\fieldtrip-20131023
> > > ft_defaults
> > > cfg.dataset = 'InnaTest_Current-Phantom_20131004_09.ds';
> > > cfg.trialdef.triallength=1;
> > > cfg.trialdef.ntrials=120;
> > > cfg.continuous = 'yes';
> > > cfg = ft_definetrial(cfg);
> > > cfg.channel = {'MEG'};
> > > cfg.demean = 'yes';
> > > data = ft_preprocessing(cfg);
> > > %%
> > > cfg = [];
> > > cfg.keeptrials = 'yes';
> > > timelock = ft_timelockanalysis(cfg, data);
> > > %%
> > > cfg = [];
> > > cfg.dataset = 'InnaTest_Current-Phantom_20131004_09.ds';
> > > cfg.trialdef.triallength=1;
> > > cfg.trialdef.ntrials=120;
> > > cfg.continuous = 'yes';
> > > cfg = ft_definetrial(cfg);
> > > %%
> > > cfg.channel = {'HLC0011','HLC0012','HLC0013', ...
> > > 'HLC0021','HLC0022','HLC0023', ...
> > > 'HLC0031','HLC0032','HLC0033'};
> > > headpos = ft_preprocessing(cfg);
> > > ntrials = length(headpos.sampleinfo)
> > > for t = 1:ntrials
> > > coil1(:,t) = [mean(headpos.trial{1,t}(1,:));
> > > mean(headpos.trial{1,t}(2,:)); mean(headpos.trial{1,t}(3,:))];
> > > coil2(:,t) = [mean(headpos.trial{1,t}(4,:));
> > > mean(headpos.trial{1,t}(5,:)); mean(headpos.trial{1,t}(6,:))];
> > > coil3(:,t) = [mean(headpos.trial{1,t}(7,:));
> > > mean(headpos.trial{1,t}(8,:)); mean(headpos.trial{1,t}(9,:))];
> > > end
> > > cc = circumcenter(coil1, coil2, coil3);
> > > cc_dem = [cc - repmat(mean(cc,2),1,size(cc,2))]';
> > > %%
> > > confound = [cc_dem ...
> > > ones(size(cc_dem,1),1)];
> > > %%
> > > cfg = [];
> > > cfg.confound = confound;
> > > cfg.reject = [1:6];
> > > regr = ft_regressconfound(cfg, timelock);
> > > %%
> > > _________________________________________________________________
> > > Sorry for the lengthy letter and thanks for the help!
> > > Inna
> > > On Thu, Nov 28, 2013 at 12:23 PM, Stolk, A. (Arjen) <
> > > a.stolk at fcdonders.ru.nl > wrote:
> > > > Hi Inna,
> > > > Are you using the same design matrix as on the wiki page? That
> > > > one
> > > > covers the primary head translations and rotations, but also
> > > > their
> > > > derivatives. You could try using the primary measures only (3
> > > > translastions, and 3 rotations of the circumcenter, totaling 6 +
> > > > 1
> > > > constant regressors). It is also mentionworthy that there should
> > > > be
> > > > a
> > > > balance between the number of regressors and the number of
> > > > observations (i.e. trials). I believe on the respective wiki
> > > > page
> > > > on
> > > > head movement regression it states that the ratio is recommended
> > > > to
> > > > be
> > > > not larger than 1:10 (regressors:trials), accompanied with a
> > > > reference. Accordingly, I'd suggest to use those 7 regressors,
> > > > and
> > > > your data (120s resting state) split in segments of 1 or 2
> > > > seconds,
> > > > totaling 60 or 120 trials. These specifications might hopefully
> > > > also
> > > > allow working around your memory issue.
> > > > Second, it may be worth mentioning what you would like to do
> > > > with
> > > > the
> > > > data post-movement-regression. Namely, the movement compensation
> > > > will
> > > > remove contributions from head movement to the signal. But this
> > > > requires that signal to behave consistently over trials, which
> > > > does
> > > > not seem the case with the signal in your resting study? That
> > > > is,
> > > > with
> > > > an ERP study, the signal fluctuations appear consistent over
> > > > trials,
> > > > with amplitudes being modulated by head movement (i.e.
> > > > sensor-source
> > > > distance, see our neuroimage paper - 2013) in a predictable
> > > > fashion.
> > > > So if you're planning on doing frequency analysis, or maybe
> > > > connectivity analysis, after head movement compensation, I'd
> > > > recommend
> > > > reversing that order. The rule of thumb is to use
> > > > ft_regressconfound
> > > > just prior to ft_xxxstatistics, removing otherwise unexplained
> > > > variance (over trials) due to head movement, benefitting your
> > > > statistical assessments.
> > > > Hope these suggestions may help you with further analyses. I'm
> > > > not
> > > > familiar with anyone implementing this method to resting state
> > > > analyses, but maybe someone else has some first-hand experience
> > > > here.
> > > > Furthermore, too late for your current dataset, but for a next
> > > > one
> > > > I'd
> > > > recommend using the online head position
> > > > monitoring/respositioning
> > > > tool that we have developed for CTF systems (a neuromag version
> > > > is
> > > > approaching the final stage). This tool is routinely used in our
> > > > lab
> > > > to monitor and reduce head movment throughout recording (after
> > > > which
> > > > ft_regressconfound is being used to deal with the trial-by-trial
> > > > crumbles).
> > > > Yours,
> > > > Arjen
> > > > _______________________________________________
> > > > fieldtrip mailing list
> > > > fieldtrip at donders.ru.nl
> > > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> > > _______________________________________________
> > > fieldtrip mailing list
> > > fieldtrip at donders.ru.nl
> > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> > _______________________________________________
> > fieldtrip mailing list
> > fieldtrip at donders.ru.nl
> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-- Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen Email: a.stolk at donders.ru.nl Phone: +31(0)243 68294 Web: www.arjenstolk.nl 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20131209/2b9b03e6/attachment-0001.html>


More information about the fieldtrip mailing list