[FieldTrip] channelrepair issue
Jim Li
megjim1 at gmail.com
Sun Jul 10 19:49:49 CEST 2011
Hello Jörn,
I sent an email to you guys a moment ago. Please let me know if you get that
email or not.
Thanks.
Jim
On Fri, Jul 8, 2011 at 8:33 PM, "Jörn M. Horschig" <
jm.horschig at donders.ru.nl> wrote:
> **
> Hi,
>
> SInce the new updates (which should be available in the new FT download
> version, see also the corresponding mail on the mailing list), I would
> suggest to use a user-defined neighbourstructure, verify this and then call
> channelrepair. E.g. try 'triangulation' as a method - it might result in a
> better neighbourhood representation.
> Also, currently neighbourselection is using config settings first before
> searching the data structure for sensor position information. So if you
> define cfg.layout, it will definitely use the layout (so, 2D coordinates)
> instead of 3D coordinates defined in your data. This might be suboptimal as
> well.
>
> Sorry for all the inconveniences. We will try to check why the problem you
> got causes an issue and hopefully find a more generic way to solve this.
> Jim, if not already done, it would be great if you followed Jan-Mathijs'
> suggestion to provide further information such as example data so that we
> can reproduce your problem and try to solve it.
> Don, thanks for helping out ;)
>
> Best,
> Jörn
>
>
>
> On 7/9/2011 12:57 AM, Rojas, Don ( Employee MEG-SOM ) wrote:
>
> As a short follow up on this, the behavior of ft_neighbourplot is suspect
> only when supplying a cfg.neighbours field and plotting the result using the
> 2d layout file (as in the example I gave below), so this issue may not be
> the same as for the channel repair function. Using no layout file, the 3D
> plotted locations and labels appear to be correct. I can verify that the
> lower level functions called by ft_neighbourplot such as channelposition.m
> are returning the correct position and label info, but haven't had time to
> track the 2d plotting result down further. The neighbours returned by
> ft_neighbourselection also appear to be okay given a specified input
> distance.
>
> On Jul 8, 2011, at 1:17 PM, Rojas, Don ( Employee MEG-SOM ) wrote:
>
> Jörn, Jim et al.
>
> There is indeed a general problem, most likely with channel indexing, in
> gradiometer systems. I think the data are read correctly with the low level
> functions, but functions like ft_channelrepair, ft_neighbourselection and
> ft_neighbourplot are not accounting for the locations correctly. I have
> attached a picture that I think illustrates this issue reasonably well. The
> following code was used t<neighbors.jpg>o generate this plot:
>
> % read in data
> cfg = [];
> cfg.dataset = 'e,rfhp1.0Hz,COH';
> coh = ft_preprocessing(cfg);
>
> % get neighbors and plot
> cfg = [];
> cfg.neighbourdist = .03;
> cfg.neighbours = ft_neighbourselection(cfg,coh);
> cfg.layout = '4D248.lay';
> ft_neighbourplot(cfg,coh);
>
> You can see that the channel selected is labeled A216, which is incorrect -
> it should be A248. It's three neighbors are also incorrect (A208, A118 and
> A134 should probably be A195, A228 and A247).
>
> I'm guessing this is the same indexing issue for gradiometers. Jan-Mathijs
> mentioned a fixed version of ft_channelrepair appearing today, so perhaps it
> will be the same problem and the fix can be propagated to these other
> functions.
>
> Don
>
> On Jul 8, 2011, at 2:20 AM, Jörn M. Horschig wrote:
>
> Dear Jim, Don and others,
>
> First of all, what Don suggested sounds indeed like the cause, if I
> remember things correctly (with my limited experience).
>
> Anyhow, could one of you check ft_neighbourplot with the dataset and the
> neighbourselection of choice? This allows you to see what neighbours are
> selected for which sensors and where they lie in space. If this looks fine,
> than the problem lies indeed in how sensor position is deduced from the data
> structure.
>
> Best,
> Jörn
>
>
> On 7/8/2011 9:11 AM, jan-mathijs schoffelen wrote:
>
> Dear Don,
>
> This sounds like a very likely cause of the problem. When we wrote the 4D
> reading code at the time, we had the 248-channel magnetometer system in
> mind. It could be that there are some flaws related to the handling of
> gradiometers. This should not only lead to (erratic) issues at the level of
> channelrepair, but may also cause mayhem when doing planar gradient
> transformation, or source reconstruction.
> Would you happen to
> 1) feel like tackling this one with me, and improve FieldTrip to deal with
> gradiometer systems correctly?
>
> or
>
> 2) have a small gradiometer dataset which you can send to me (e.g. through
> DropBox), so that I can look into it?
>
> We can further discuss this off the discussion list.
>
> Best wishes,
>
> Jan-Mathijs
>
>
>
> On Jul 8, 2011, at 3:36 AM, Rojas, Don ( Employee MEG-SOM ) wrote:
>
> Jim et al.
>
> In thinking about this further, it seems to me that it is the indexing that
> is incorrect. The problem I think is specific to gradiometer systems, which
> have two (or more) locations per channel. The function appears to assume
> that the sensor index based on the sens.label field (only 1 per channel)
> will correspond 1 to 1 with the sens.grad field (2 locations per channel),
> which is not correct. So, my guess is that for first-order gradiometer
> systems, the correct index for the sensor location is 2x the index in the
> sens.label field.
>
> So, in an example I have handy at home, the label index for channel A234 is
> 107. Since I think Fieldtrip stores gradiometer locations (by default) as:
>
> Chn 1 lower coil x, y z
> Chn 1 upper coil x, y z
> Chn 2 lower coil x, y z
> Chn 2 upper coil x, y z
> .
> .
> .
> Chn N
>
> I think the correct position info for channel A234 would be found in
> sens.grad(214,:), not sens.grad(107,:), which is what the ft_channelrepair
> function chooses. So I think this is a bug in the function specific to
> gradiometer systems.
>
> Best,
>
> Don
>
> On Jul 7, 2011, at 5:38 PM, Jim Li wrote:
>
> Thank you very much for confirming the problem, Don, I appreciate it, :)
>
> Jim
>
> On Thu, Jul 7, 2011 at 4:30 PM, Rojas, Don <Don.Rojas at ucdenver.edu> wrote:
>
>> Jim,
>>
>> All I can do is confirm that this issue exists for our 4D data as well,
>> although we don't use the ft_channelrepair function. The same 4 quite
>> distant channels (one had been deleted in the dataset I had handy) were
>> chosen for repair when I ran this on one of our datasets (also a 248 channel
>> 4D system). I agree the choice doesn't make any sense given the 3 cm
>> distance you define. A quick look at the critical calculation in
>> ft_channelrepair, line 109 distance = ... is correct given the inputs. So I
>> wonder if the issue is with the actual channel indices used rather than the
>> calculation, but I don't have time to track that down. All I can say is that
>> for the distance you specify, channels A235, A216, A199, A215 would be much
>> closer to A234 than those that are selected via the channel repair function.
>> Channel A8 is in fact nearly 21 cm away from channel A234 in the array,
>> based on examination of the data read in from Eugene Kronberg's pdf4D matlab
>> object code, which I think was originally the basis for the FieldTrip 4D
>> reader function.
>>
>> Best,
>>
>> Don Rojas
>>
>>
>> On Jul 7, 2011, at 1:26 PM, Jim Li wrote:
>>
>> Dear Fieldtrip developer,
>>
>> Can anybody help me with this channel-repair issue I've been having? I can
>> provide the raw data if you need. I really want to solve the problem, you
>> know.
>>
>> Thanks a lot,
>>
>> Jim
>>
>> On Thu, Jul 7, 2011 at 2:22 PM, Jim Li <megjim1 at gmail.com> wrote:
>>
>>> Hi Odelia,
>>>
>>> Yes, I downloaded the latest version of Fieldtrip and tried your
>>> suggestion "cfg.neighbourdist = 0.03", but it still weirdly uses the
>>> far-away channels like A121 to do the channel-repair for A234 (these two
>>> channels are 24.1172cm apart!). Here is the detail:
>>>
>>> ---------------------------
>>> cfg = [];
>>> cfg.dataset = 'e,rfhp0.1Hz';
>>> cfg.trialdef.eventtype = 'TRIGGER';
>>> cfg.trialdef.eventvalue = 320;
>>> cfg.trialdef.prestim = 1;
>>> cfg.trialdef.poststim = 1;
>>> cfg = ft_definetrial(cfg);
>>> cfg.blc = 'yes'; % do
>>> baseline correction with the complete trial
>>>
>>> cfg.blcwindow = [-1 0];
>>> cfg.channel = {'MEG'};
>>> raw_DATA = ft_preprocessing(cfg);
>>>
>>>
>>> cfg = [];
>>> cfg.badchannel = {'A234'};
>>> cfg.neighbourdist = 0.03;
>>>
>>> [raw_DATA] = ft_channelrepair(cfg, raw_DATA)
>>>
>>> ---------------------------------------------------------------------
>>>
>>> And here is the outcome: -----------------------------
>>>
>>> the input is raw data with 248 channels and 201 trials
>>> repairing channel A234
>>> using neighbour A121
>>> using neighbour A143
>>> using neighbour A173
>>> using neighbour A8
>>>
>>> repairing bad channels for trial 1
>>> repairing bad channels for trial 2
>>> repairing bad channels for trial 3
>>> repairing bad channels for trial 4
>>> repairing bad channels for trial 5
>>> repairing bad channels for trial 6
>>> repairing bad channels for trial 7
>>> repairing bad channels for trial 8
>>> repairing bad channels for trial 9
>>> repairing bad channels for trial 10
>>> ....
>>>
>>> -------------------------
>>>
>>> Thank you.
>>>
>>> Jim
>>>
>> _______________________________________________
>>
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>> -----------------------
>> Don Rojas, Ph.D.
>> Associate Professor of Psychiatry
>> U. of Colorado Denver Anschutz Medical Campus
>> Director, UCD Magnetoencephalography Lab
>> 13001 E. 17th Pl F546
>> Aurora, CO 80045
>> 303-724-4994
>>
>>
>> _______________________________________________
>> 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
>
>
> -----------------------
> Don Rojas, Ph.D.
> Associate Professor of Psychiatry
> U. of Colorado Denver Anschutz Medical Campus
> Director, UCD Magnetoencephalography Lab
> 13001 E. 17th Pl F546
> Aurora, CO 80045
> 303-724-4994
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> Dr. J.M. (Jan-Mathijs) Schoffelen
> Donders Institute for Brain, Cognition and Behaviour,
> Centre for Cognitive Neuroimaging,
> Radboud University Nijmegen, The Netherlands
> J.Schoffelen at donders.ru.nl
> Telephone: 0031-24-3614793
>
>
> _______________________________________________
> fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> --
> Jörn M. Horschig
> PhD Student
> Donders Institute for Brain, Cognition and Behaviour
> Centre for Cognitive Neuroimaging
> Radboud University Nijmegen
> Neuronal Oscillations Group
>
> P.O. Box 9101
> NL-6500 HB Nijmegen
> The Netherlands
>
> Contact:
> E-Mail: jm.horschig at donders.ru.nl
> Tel: +31-(0)24-36-68493
> Web: http://www.ru.nl/donders
>
> Visiting address:
> Trigon, room 2.30
> Kapittelweg 29
> NL-6525 EN Nijmegen
> The Netherlands
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> -----------------------
> Don Rojas, Ph.D.
> Associate Professor of Psychiatry
> U. of Colorado Denver Anschutz Medical Campus
> Director, UCD Magnetoencephalography Lab
> 13001 E. 17th Pl F546
> Aurora, CO 80045
> 303-724-4994
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> -----------------------
> Don Rojas, Ph.D.
> Associate Professor of Psychiatry
> U. of Colorado Denver Anschutz Medical Campus
> Director, UCD Magnetoencephalography Lab
> 13001 E. 17th Pl F546
> Aurora, CO 80045
> 303-724-4994
>
>
> _______________________________________________
> fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> --
> Jörn M. Horschig
> PhD Student
> Donders Institute for Brain, Cognition and Behaviour
> Centre for Cognitive Neuroimaging
> Radboud University Nijmegen
> Neuronal Oscillations Group
>
> P.O. Box 9101
> NL-6500 HB Nijmegen
> The Netherlands
>
> Contact:
> E-Mail: jm.horschig at donders.ru.nl
> Tel: +31-(0)24-36-68493
> Web: http://www.ru.nl/donders
>
> Visiting address:
> Trigon, room 2.30
> Kapittelweg 29
> NL-6525 EN Nijmegen
> The Netherlands
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110710/e52ae5ce/attachment-0002.html>
More information about the fieldtrip
mailing list