Back to the main page.

Bug 866 - ft_neighbourselection outputs non-optimal neighbour structure

Status CLOSED FIXED
Reported 2011-08-12 14:28:00 +0200
Modified 2012-08-23 14:02:06 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Lilla Magyari - 2011-08-12 14:28:21 +0200

Hi, here, at the MPI we use an actiCap with 59 electrodes and equidistant montage. When I calculate the neighbours of each electrode with the ft_neighbourselection function, it looks OK if the cfg.neighbourdist = 50 (see attached file: nb_plot_50.jpg), but it looks pretty bad when cfg.neighbourdist = 40 (see: nb_plot_40.jpg). Lilla


Lilla Magyari - 2011-08-12 14:29:13 +0200

Created attachment 113 pics and elec file


Jörn M. Horschig - 2011-08-13 09:07:12 +0200

Hey Lilla, I don't think that you should call this a bug, it is just that the method is really bad for the montage. You could try using cfg.method = 'triangulation' instead, that should look better. Anyhow, I can work on a template that is more optimal when I am back from vacation (in 2 weeks)


Lilla Magyari - 2011-08-15 13:23:17 +0200

(In reply to comment #2) > Hey Lilla, > > I don't think that you should call this a bug, it is just that the method is > really bad for the montage. > You could try using cfg.method = 'triangulation' instead, that should look > better. Anyhow, I can work on a template that is more optimal when I am back > from vacation (in 2 weeks) Hey Jorn, thanks. I also tried to use the triangulation method, but then I got 7 neighbors in average per electrode that I think is a bit too many. I posted as a bug because I did not understand why neighbors are missing at some part while not at the other parts when it is supposed to be an equidistant montage.


Jörn M. Horschig - 2011-08-29 14:23:01 +0200

Hey Lilla, I just took a more detailled look. So, the problem most likely occurs because the neighbourselection method is projecting the sensors on a 2D plane, meaning that the positions will be slightly off. However, I can work on a template that looks optimal. I will do that today or tomorrow, depending on how fast (and buggy) my data analysis is - cause I prefer working on my data ;P Can you let me know how the corresponding layout file for your cap is called?


Jörn M. Horschig - 2011-08-29 14:48:55 +0200

Is there a channel missing between 49, 56 and 55? there is a hole in the plot


Jörn M. Horschig - 2011-08-29 14:56:20 +0200

Created attachment 126 template candidate This is what I came up with - looks symmetric and with not too much overlap. Let me know what you think! And if you let me know the name of the corresponding layout-file for the EEG cap, then I can store the template in the FT directory with a proper name ;)


Lilla Magyari - 2011-08-31 11:15:14 +0200

(In reply to comment #6) > Created attachment 126 [details] > template candidate > > This is what I came up with - looks symmetric and with not too much overlap. > Let me know what you think! > And if you let me know the name of the corresponding layout-file for the EEG > cap, then I can store the template in the FT directory with a proper name ;) hi, sorry for not replying so long. the name of the layout file is: 61chan_MPI.lay but the name of the elec file is: mpi_59_channels_elec.mat Yes, you can see missing channels because the left mastoid is between 56 and 55. We also do not use (or only for reference) channel 32 which is at the place of the right mastoid (between 23 and 24). I can test your template probably next week. thanks a lot. Lilla


Lilla Magyari - 2011-09-16 14:41:22 +0200

hi when I try to plot the new neighbourhood structure, using the attached elec file, I get this error message: >> cfg=[]; >> cfg.elec = elec; >> ft_neighbourplot(cfg, neighbours) ??? Error: File: ft_neighbourplot.m Line: 216 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "ft_neighbourplot".) [Fatal Error] :-1:-1: Premature end of file. Am I doing something wrong? Lilla


Jörn M. Horschig - 2011-09-16 15:29:38 +0200

Hey Lilla, you should put neighbours in the cfg. The only second argument allowed in neighbourplot would be data, in case neighbourplot should compute the neighbours. cfg = []; cfg.elec = elec; cfg.neighbours = neighbours; ft_neighbourplot(cfg); that should do. Anyway, the error has nothing to do with this, but with 'someone' placing code outside the function (Hi Robert! ;) Should work now (or, if you have no access to svn, just move the last end to the end of the function)


Jörn M. Horschig - 2011-10-20 15:47:40 +0200

how should the template be called? Is 61chan_MPI more appropriate or mpi_59_channels?


Jörn M. Horschig - 2012-01-06 15:53:28 +0100

Lilla, could you answer the question from a while ago? :)


Lilla Magyari - 2012-01-10 18:23:13 +0100

(In reply to comment #11) yes, sorry. so, let's call it mpi_59_channels. Are you working with one that I have sent? I can't check it now, is RM (=right mastoid) included? If yes, then may it is useful to tell in the documentation that channel selection should be used if people do not want that included.


Jörn M. Horschig - 2012-02-01 14:09:17 +0100

I added and comitted the new neighbour template as mpi_59_channels I changed ft_prepare_neighbours to call ft_channelselection automatically when providing data as input. 171 $ svn ci template/neighbours/mpi_59_channels.mat ft_prepare_neighbours.m test/test_ft_megplanar.m test/test_datasets.m -m "bugfix-#866- addded neighbour template for EEG cap at the MPI and made prepare_neighbours to select only those channels that are present in the data" Sending ft_prepare_neighbours.m Adding (bin) template/neighbours/mpi_59_channels.mat Sending test/test_datasets.m Sending test/test_ft_megplanar.m Transmitting file data .... Committed revision 5197. And then changed the name of the template: 176 $ svn ci -m "changed name of neighbour template to make it consistent" Deleting neighbours/mpi_59_channels.mat Adding (bin) neighbours/mpi_59_channels_neighb.mat


Boris Reuderink - 2012-02-03 21:30:11 +0100

Dear Lilla, it seems that Jorn fixed the issue. Can you confirm that it works for you?


Jörn M. Horschig - 2012-08-23 14:02:06 +0200

bug closing time (http://www.youtube.com/watch?v=xGytDsqkQY8)