[FieldTrip] Dipole time course

Andreas Wollbrink a.wollbrink at uni-muenster.de
Mon Apr 4 15:51:26 CEST 2011


Hi Don,

thanks for your advices.

I succeeded calculating the source waveform time series using your 
modified script lines.
Since the number of sensors in the data.grad field was different from 
the number of channels in the data.avg matrix I added the following line 
to the beginning of your code:

  [vol, grad] = ft_prepare_vol_sens(vol, avgData.grad, 'channel', 
avgData.label);

I am using data recorded with the 275 channel axial gradiometer VSM 
system. During the recording 3 channels were defined as bad. The noise 
balancing was set to 1 (first order synthetic gradiometers).

Using ft_preprocessing and ft_timelockanalysis with the the setting
cfg.channel = 'MEG' one ends up with 272 channels in the data.avg matrix 
and 281 sensors in the cfg.grad structure.

Since I am not sure whether it is correct to apply the 
ft_prepare_vol_sens function in the way I did it I would appreciate if 
an expert could comment on that.

Andreas

On 04/01/11 20:15, Rojas, Don wrote:
> Andreas,
>
> I just wrote that code snippet from memory so it figures it wouldn't work without a little clean up. I forgot what the dimensions would be of the Li and Qn variables and the dot operation has to have arrays of the same size as input. I tested an example and this correction should work for you. I also corrected a parenthetic error on the use of double in the Qn line that would not have generated an error. I added a couple of transposes here and there. But, check your sizes as follows if you have problems - often, something will just need to be transposed to get it into the proper shape. I added some info on each input and variable to hopefully clarify what I'm after in the example:
>
> source.dip.pos: 1 x 3
> orientation_vector: 1 x 3 (Fieldtrip source structure orientation is 3 x 1 per dipole, so probably need to transpose if getting from source structure)
> L: nchannels x 3
> Li: 3 x nchannels;
> Qn: 1 x 3, then 3 x nchannels after repmat()
> W: 1 x nchannels
> waveform: 1 x nsamples
> data: Fieldtrip timelock structure with avg field
> data.avg: nchannels x nsamples
> vol: volume conductor in Fieldtrip - I coded this with a single sphere model
> source: source output from ft_dipolefitting()
>
> Revised code example:
>
> L 			= ft_compute_leadfield(source.dip.pos, data.grad,vol,'reducerank',2); % leadfield
> Li 			= pinv(L); % pseudoinverse of L
> Qn 			= double(orientation_vector/norm(orientation_vector)); % normed orientation vector
> Qn 			= repmat(Qn,length(Li),1)'; % make Qn the same size as Li
> W 		 	= dot(Li,Qn)'; % weights for projection to source space
> waveform 	= dot(data.avg,repmat(W,1,size(data.avg,2))); % source waveform
>
> Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly.
>
> Don
>
> On Apr 1, 2011, at 8:37 AM, Andreas Wollbrink wrote:
>
>> Hi Don,
>>
>> I just tried out your approach on how to achieve the source waveform
>> based on a given dipole source but failed calculating the scalar product
>> of the inverse leadfield matrix and the normed orientation vector:
>>
>> W = dot(Li,Qn);
>>
>> error message: A and B must be same size.
>>
>> May I ask you for a suggestion?
>>
>> Best,
>> Andreas
>>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-- 


======================================================================

   Andreas Wollbrink, Biomedical Engineer

   Institute for Biomagnetism and Biosignalanalysis       	
   Muenster University Hospital

   Malmedyweg 15         phone:   +49-(0)251-83-52546
   D-48149 Muenster      mobil:   +49-(0)160-98527553
   Germany               fax:     +49-(0)251-83-56874	
                         e-Mail: a.wollbrink at uni-muenster.de

======================================================================



More information about the fieldtrip mailing list