[FieldTrip] Sensor scaling in FieldTrip?

Robert Oostenveld r.oostenveld at donders.ru.nl
Tue Aug 21 13:15:37 CEST 2018

Hi Matii,

Good question, let me also CC this to the fieldtrip email list so that google might retrieve it for others in the future.

There is no automatic weighting of channels done in FT inverse estimation, neither for planar/magnetometer, nor for meg/eeg in more general. For the planar/magnetometer a known issue is that many people preprocess the data such that the planar gradiometers are defined in T/cm, whereas the data is defined in T/m. To ensure consistent units that match the forward computation code (which assumes SI units) you should use cfg.coilaccuracy in ft_preprocessing with a non-empty value (0, 1 or 2 are valid). When empty, units won’t be SI compatible (which is not a problem in many cases, but would be when combining different channels types).

The subspace projections in some (but not consistently in all) inverse functions predates the application of FT to Neuromag/Elekta/Megin/York_Instruments <https://www.york-instruments.com/elekta-to-sell-its-meg-business-to-york-instruments/> data. At that time different sensor types were not considered. The original implementation was used in combination with http://www.ijbem.org/volume7/number2/pdf/007.pdf <http://www.ijbem.org/volume7/number2/pdf/007.pdf> but I don’t think that the full code (from around 2004) survived. After that the subspace “machinery” has been extended here and there, but not with combined planar/magnetometer in mind.

Separate from this there is some code in ft_denoise_synthetic.m, ft_denoise_pca.m and ft_componentanalysis.m that relates to linear projections (for noise suppression) done on the data that also need to be replicated in the forward model (since the forward model should be distorted, just like the data). In that case the projections for the forward model are applied to grad.tra (and stored for reference in grad.balance). 

Although I am not doing combined planar/magnetometer estimations, I suspect that my strategy would be to implement it similar to ft_denoise_xxx (which updates the grad.tra) and implement it as ft_sensorscaling or ft_prewhitening or so. The function would apply a linear scaling to the data, and apply teh same scaling to the data.grad.tra (and store it in data.grad.balance) and if applicable idem for data.elec.tra/balance.

Hope this helps,

PS See also this <http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0121048> regarding the linear projections when they are meant to deal with artifacts. 

> On 20 Aug 2018, at 18:22, Matti Stenroos <matti.stenroos at aalto.fi> wrote:
> Hi Robert,
> While looking at FT code related to this illish-posed question, I noticed that regularization and subspace projection in beamformer_lcmv.m do not mention any preweighting based on sensor type (magnetometer vs gradiometer)...
> I have earlier gone through some preprocessing pipelines and I don't remember seeing any sensor scaling there. Is it applied somehow automatically to the covariance matrix and leadfield?
> ...if not, at least the regularization and subspace parts don't work correctly with 306-channel Elekta data. If yep, sorry for bothering... (didn't find anything with quick googling).
> See you in Philadelphia!
> m
> -------- Forwarded Message --------
> Subject: 	Re: [FieldTrip] Set regularization parameter after SSS
> Date: 	Mon, 20 Aug 2018 15:22:03 +0200
> From: 	Luca Kaiser <luca.kaiser at web.de>
> Reply-To: 	FieldTrip discussion list <fieldtrip at science.ru.nl>
> To: 	fieldtrip at science.ru.nl
> Hi Matti,
> sure-sorry and thanks for your quick reply. So here is what I am doing using the average covariance matrix (so data covariance).
> cfg=[];
> cfg.covariance='yes';
> cfg.channel=data.label;
> avg_data=ft_timelockanalysis(cfg, data);
> cfg=[];
> cfg.method='lcmv';
> cfg.grid=lf;
> cfg.vol=hdm;
> cfg.lcmv.keepfilter='yes';
> cfg.lcmv.fixedori= 'yes';
> cfg.lcmv.lambda= '10%'; %0% rank deficient data-use stronger regularization??
> lcmv_avg=ft_sourceanalysis(cfg, avg_data);
> Best,
> Luca
> *Gesendet:* Montag, 20. August 2018 um 15:10 Uhr
> *Von:* "Matti Stenroos" <matti.stenroos at aalto.fi>
> *An:* "Luca Kaiser" <luca.kaiser at web.de>
> *Betreff:* Re: [FieldTrip] Set regularization parameter after SSS
> Dear Luca,
> I think you'd need to tell a bit more, as the meaning of "lambda"
> depends on the algorithm you are using. Also "the covariance matrix" is
> not uniquely defined --- are you talking about noise covariance or
> measurement covariance?
> In general, the eigenvalue idea you had read does not make sense --- the
> eigenvalue text deals with condition numbers, while lambda does, in
> general, not relate directly to that. The advice might have been that
> "set lambda so that the ratio of largest and smallest eigenvalues is
> 1000"...
> Cheers,
> Matti
> also working with low-rankingMax-filtered MEG and coincidentally
> having a lot of covariance metrics on screen at the moment
> On 2018-08-20 15:39, Luca Kaiser wrote:
> > Dear FieldTrip community,
> > I am using ft_sourceanalysis on SSS preprocessed (neuromag) data. I
> > wonder if there are any suggestions on how to set lambda in this case?
> > My covariance matrix is rank deficient (rank 60, 306 sensors). I read in
> > the mailing list that I would need to look at the eigenvalues of XX' and
> > set lambda to be 1/1000 of the largest eigenvalue. However, I do not
> > really understand why to divide by 1/1000?
> > Every help would be very much appreciated,
> > Thanks!
> > Luca
> >
> >
> >
> >
> >
> > _______________________________________________
> > fieldtrip mailing list
> > https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> > https://doi.org/10.1371/journal.pcbi.1002202
> >
> <Attached Message Part.txt>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180821/fa6086b1/attachment-0002.html>

More information about the fieldtrip mailing list