Back to the main page.

Bug 2020 - improve mne2grad - sample the leadfield on more points and integrate over them

Status CLOSED FIXED
Reported 2013-02-28 15:09:00 +0100
Modified 2017-01-17 11:29:42 +0100
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 enhancement
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Vladimir Litvak - 2013-02-28 15:09:07 +0100

Created attachment 429 Suggested modifications Hi, Hamid Mohseni from Oxford (hamid.mohseni@eng.ox.ac.uk) expressed interest in taking over maintaining mne2grad from Laurence who is not very motivated at the moment because he moved to the FIL and uses CTF. Hamid made some improvements to represent the sensors by more points, but he seems to have used an old version of mne2grad as his starting point and also might need some assistance with making sure his changes don't break other FT functionality. His message is below. I'm starting this bug to keep track of the progress on this and I suggest that once we sort out the details Hamid is given access to SVN. Vladimir --------------------------- Dear Vladimier, Following our discussion in MEG-UK, there is a problem in fusion of gradiometer and magnetometer. A rough correction would be scaling the gradiometer by a factor of 0.0168, which is the distance between the gradiometers coils. If you don't do this correction the source localisation fails. But a more accurate way is to model the magnetometer by 9 points and gradiometer by 8 points as explained in the neuramg maxfilter manual. I think the simplest approach is correcting the mne2grad.m file which has been written by Laurence and Joachim. They basically use two points for each grad and one point for each mag (510 points in total). I now use 9 points for each mag and 8 points for each grad according to the ELEKTA manual (2550 points in total). Therefore the "pnt" and "ori" are 2550x3 matrices (not 510x3). I also changed the "tra" matrix to a 306x2550 according to the weight of each point. The program then runs fine and it doesn't affect the speed. The results are also quite similar when you just scale the gradiometer, but I think it is better to use it anyway. I attached the new version of mne2grad_v2.m which should replace mne2grad.m located in fieldtrip/fileio/private/mne2grad.m. One thing you may consider is the parameters of the geometry of the sensors. These parameters are for Oxford MEG (see attached file) and it should be changed according the manual of the device (I haven't found them in the fiff file). However, these parameters are the same for different systems and I guess old ELEKTA MEG systems should change them. If you use mne2grad_v2.m there is only one bug in the estimating the location of sensor. Basically spm estimate the location of sensors using "channelposition.m" file written by you. This file is used for showing the location of sensors in various figures. You need to change line 149-150: meanpnt1 = mean(sens.pnt(abs(sens.tra(sel(1),:))>0.5,:), 1); meanpnt2 = mean(sens.pnt(abs(sens.tra(sel(2),:))>0.5,:), 1); meanpnt3 = mean(sens.pnt(abs(sens.tra(sel(3),:))>0.5,:), 1); for example to following or any other small value: meanpnt1 = mean(sens.pnt(abs(sens.tra(sel(1),:))>0.05,:), 1); meanpnt2 = mean(sens.pnt(abs(sens.tra(sel(2),:))>0.05,:), 1); meanpnt3 = mean(sens.pnt(abs(sens.tra(sel(3),:))>0.05,:), 1); "channelposition.m" is in fieldtrip/plotting/private/channelposition.m and fieldtrip/private/channelposition.m. Also, when you correct grads using factor=0.0168, I think you still need this correction . Many thanks -- Hamid R. Mohseni, PhD Post-Doctoral Research Assistant Institute of Biomedical Engineering University of Oxford, OX3 7DQ, UK Tel: +44 (0) 1865 2 83826


Hamid - 2013-02-28 15:18:26 +0100

*** Bug 2019 has been marked as a duplicate of this bug. ***


Robert Oostenveld - 2013-02-28 16:51:59 +0100

(In reply to comment #1) The different unit aspect (T and T/m) that is mentioned is a duplicate of bug 963. Please follow up there. The representation of the sensor coils with more (and carefully placed) points is a new suggestion. Does anyone know what Matti is doing in MNE?


Vladimir Litvak - 2013-02-28 16:54:20 +0100

(In reply to comment #2) Alexandre might know. I added him as well.


Hamid - 2013-02-28 17:00:09 +0100

I am quite confident that Matti uses the accurate sensor modeling, please see http://www.martinos.org/meg/manuals/MNE-manual-2.7.pdf page 107 Note that ctf system also needs to model the sensors using 8 or 9 points.


Robert Oostenveld - 2013-02-28 17:04:09 +0100

(In reply to comment #4) thanks for the quick reference. I am surprised to see that he models the axial CTF gradiometers with 4+4. A 6+1 distribution is more accurate at (approximately) the same computational cost. That was also common for older systems with larger coil diameters, e.g. the one in Twente.


Hamid - 2013-02-28 17:05:54 +0100

I think we can write all information from page 107-111 of the mne user manual: http://www.martinos.org/meg/manuals/MNE-manual-2.7.pdf and based on the sensor coil ID (left column of the table) model the sensors for each different system?


Robert Oostenveld - 2013-02-28 17:09:44 +0100

(In reply to comment #6) it is indeed an idea to make a new xxx2grad that uses the same code for these systems based on sensor types. Note that not all systems are listed, but the list is quite complete and certainly detailed.


Robert Oostenveld - 2013-02-28 17:11:33 +0100

(In reply to comment #5) I should correct my my comment: MNE is using a 14 point approximation for the normal sensors (so also one point in the center, and both top and bottom coil with many points). The 4+4 was for the reference gradiometer.


Robert Oostenveld - 2014-03-26 14:50:56 +0100

I have discussed this with Arjen (now CC), for whom it is relevant to look into this. I also got some documentation from Elekta, but I believe it is largely the same as in the MNE manual (page 107).


Robert Oostenveld - 2016-01-19 12:10:53 +0100

this has been stuck for a long time. I now need better forward model accuracy for the Elekta system and will hence take this in my hand.


Arjen Stolk - 2016-01-19 19:08:58 +0100

You're right. I remember we had some ideas on paper but never got to the implementation part.


Robert Oostenveld - 2016-01-22 11:35:04 +0100

mac011> svn commit ft_defaults.m fileio/private/rotate.m fileio/private/translate.m fileio/ft_read_header.m fileio/private/ctf2grad.m fileio/private/mne2grad.m external/mne/coil_def.dat Adding external/mne/coil_def.dat Sending fileio/ft_read_header.m Sending fileio/private/ctf2grad.m Sending fileio/private/mne2grad.m Adding fileio/private/rotate.m Adding fileio/private/translate.m Sending ft_defaults.m Transmitting file data ..... Committed revision 11098. This is for CTF and MNE. Jan-Mathijs suggested to implement it for 4D as well.


Robert Oostenveld - 2016-07-04 13:33:44 +0200

this is implemented for elekta and ctf, and as such the issue can be closed.


Robert Oostenveld - 2017-01-17 11:29:42 +0100

closed multiple bugs that were resolved some time ago